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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
e4931021d2b9f9e0462a5f51412733c3c2009cf6 | 58a2995dd249b73813a4be2c16c552d7f5620bfe | /streamanalytics/resource-manager/Sources/streamanalytics/commands/Inputs.swift | 64ccc5d463149a4fa5be3975aeba4d903e838d10 | [
"MIT"
] | permissive | Azure/azure-libraries-for-swift | e577d83d504f872cf192c31d97d11edafc79b8be | b7321f3c719c381894e3ee96c5808dbcc97629d7 | refs/heads/master | 2023-05-30T20:22:09.906482 | 2021-02-01T09:29:10 | 2021-02-01T09:29:10 | 106,317,605 | 9 | 5 | MIT | 2021-02-01T09:29:11 | 2017-10-09T18:02:45 | Swift | UTF-8 | Swift | false | false | 2,142 | swift | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Inputs is the stream Analytics Client
import Foundation
import azureSwiftRuntime
extension Commands {
public struct Inputs {
public static func CreateOrReplace(subscriptionId: String, resourceGroupName: String, jobName: String, inputName: String, input: InputProtocol) -> InputsCreateOrReplace {
return CreateOrReplaceCommand(subscriptionId: subscriptionId, resourceGroupName: resourceGroupName, jobName: jobName, inputName: inputName, input: input)
}
public static func Delete(subscriptionId: String, resourceGroupName: String, jobName: String, inputName: String) -> InputsDelete {
return DeleteCommand(subscriptionId: subscriptionId, resourceGroupName: resourceGroupName, jobName: jobName, inputName: inputName)
}
public static func Get(subscriptionId: String, resourceGroupName: String, jobName: String, inputName: String) -> InputsGet {
return GetCommand(subscriptionId: subscriptionId, resourceGroupName: resourceGroupName, jobName: jobName, inputName: inputName)
}
public static func ListByStreamingJob(subscriptionId: String, resourceGroupName: String, jobName: String) -> InputsListByStreamingJob {
return ListByStreamingJobCommand(subscriptionId: subscriptionId, resourceGroupName: resourceGroupName, jobName: jobName)
}
public static func Test(subscriptionId: String, resourceGroupName: String, jobName: String, inputName: String) -> InputsTest {
return TestCommand(subscriptionId: subscriptionId, resourceGroupName: resourceGroupName, jobName: jobName, inputName: inputName)
}
public static func Update(subscriptionId: String, resourceGroupName: String, jobName: String, inputName: String, input: InputProtocol) -> InputsUpdate {
return UpdateCommand(subscriptionId: subscriptionId, resourceGroupName: resourceGroupName, jobName: jobName, inputName: inputName, input: input)
}
}
}
| [
-1
] |
e465cda2565043fa77e5927fa8c5316f78b3ce2c | 6957bdb3af294360b118398df31b262a63f9f2ab | /Package.swift | 106338159869ae15c07f3ccd8fc2c114b2cdad97 | [
"MIT"
] | permissive | mcfarlander/VaporPlayground | 3805f0262c1124e78e437bb81d7ecafb78e2d46b | ff3e161dc84c6b76d0e085e314bcc24a4f0ed69c | refs/heads/master | 2020-04-29T06:06:39.550882 | 2019-06-29T21:10:34 | 2019-06-29T21:10:34 | 175,905,512 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,244 | swift | // swift-tools-version:4.0
import PackageDescription
let package = Package(
name: "Book",
dependencies: [
// 💧 A server-side Swift web framework.
.package(url: "https://github.com/vapor/vapor.git", from: "3.0.0"),
// 🔵 Swift ORM (queries, models, relations, etc) built on postgres.
.package(url: "https://github.com/vapor/fluent-postgresql.git", from: "1.0.0"),
// 👤 Authentication and Authorization framework for Fluent.
.package(url: "https://github.com/vapor/auth.git", from: "2.0.0"),
/// 💻 APIs for creating interactive CLI tools.
.package(url: "https://github.com/vapor/console.git", from: "3.0.0"),
/// See https://github.com/vapor-community/swiftybeaver-provider
.package(url: "https://github.com/vapor-community/swiftybeaver-provider.git", from: "3.0.0"),
.package(url: "https://github.com/vapor/leaf.git", from: "3.0.0"),
],
targets: [
.target(name: "App", dependencies: ["FluentPostgreSQL", "Vapor", "Authentication", "Command", "Logging", "SwiftyBeaverProvider", "Leaf"]),
.target(name: "Run", dependencies: ["App"]),
.testTarget(name: "AppTests", dependencies: ["App"])
]
)
| [
-1
] |
3512d75cdda728117b4951f1e51083de5099ea87 | 6feddeb66d4bed5305114071ca262f0a0fdb2aa4 | /MapViewController.swift | 30f779ba346221cd777fd1a4987dcff71dc4d620 | [] | no_license | AmpedTechnologies/SoundBody | 9a29e39daa394659c82a70b42444cf4cc4a4a294 | b64fd660a6247ca3fea2733485b865ee0c36455f | refs/heads/master | 2020-04-10T02:22:37.011413 | 2018-12-28T23:26:52 | 2018-12-28T23:26:52 | 160,742,930 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 9,628 | swift | //
// MapViewController.swift
// Amped Recovery App
//
// Created by Gregg Weaver on 3/22/18.
// Copyright © 2018 Amped. All rights reserved.
//
import UIKit
import MapKit
import CoreLocation
import Firebase
import FirebaseDatabase
class MapViewController: UIViewController, MKMapViewDelegate, CLLocationManagerDelegate {
var ref: DatabaseReference!
@IBOutlet weak var facDetailTitle: UILabel!
@IBOutlet weak var facilityImage: UIImageView!
@IBOutlet weak var facilityAttOne: UILabel!
@IBOutlet weak var facilityAttTwo: UILabel!
@IBOutlet weak var facilityAttThree: UILabel!
@IBOutlet weak var facilityAttFour: UILabel!
@IBOutlet weak var useFacilityButton: UIButton!
@IBOutlet weak var facilityOfferLabel: UILabel!
var locManager: CLLocationManager = CLLocationManager()
@IBOutlet weak var facilityLocations: MKMapView!
let ann = MKPointAnnotation()
var titleOutput = ""
var timeSelected = ""
var name: String?
var location: CLLocationCoordinate2D?
class Facility: NSObject, MKAnnotation {
let title: String?
let locationName: String
let facilityType: String
let attributeOne: String
let attributeTwo: String
let attributeThree: String
let attributeFour: String
let Image: UIImage
let coordinate: CLLocationCoordinate2D
init(title: String, locationName: String, facilityType: String, attributeOne: String, attributeTwo: String, attributeThree: String, attributeFour: String, image: UIImage, coordinate: CLLocationCoordinate2D) {
self.title = title
self.locationName = locationName
self.facilityType = facilityType
self.attributeOne = attributeOne
self.attributeTwo = attributeTwo
self.attributeThree = attributeThree
self.attributeFour = attributeFour
self.Image = image
self.coordinate = coordinate
super.init()
}
}
var facilityArray: [Facility] = []
let cryoWaveManBeachCA = Facility(title: "CryoWave",
locationName: "CryoWave Manhattan Beach",
facilityType: "Cryotherapy",
attributeOne: "Whole Body Cyrotherapy",
attributeTwo: "Localized Cryotherapy",
attributeThree: "Normatec", attributeFour: "",
image: #imageLiteral(resourceName: "CryoWaveMB"),
coordinate: CLLocationCoordinate2D(latitude: 33.892765, longitude: -118.39643699999999))
let beachCitiesCryo = Facility(title: "Beach Cities Cryo",
locationName: "Cryo Torrance",
facilityType: "Cryotherapy",
attributeOne: "Whole Body Cyrotherapy",
attributeTwo: "Infared Sauna",
attributeThree: "Normatec", attributeFour: "Massage",
image: #imageLiteral(resourceName: "BCC"),
coordinate: CLLocationCoordinate2D(latitude: 33.8049565, longitude: -118.3487755))
let floatLab = Facility(title: "Float Lab",
locationName: "Venice",
facilityType: "Floatation",
attributeOne: "Float Tank",
attributeTwo: "Vibration Therapy",
attributeThree: "", attributeFour: "",
image: #imageLiteral(resourceName: "floatLab"),
coordinate: CLLocationCoordinate2D(latitude: 33.991099, longitude: -118.477097))
let beachCitiesOtho = Facility(title: "Beach Cities Orthopedics",
locationName: "Manhattan Beach",
facilityType: "PT",
attributeOne: "Massage",
attributeTwo: "Graston",
attributeThree: "", attributeFour: "",
image: #imageLiteral(resourceName: "BCO"),
coordinate: CLLocationCoordinate2D(latitude: 33.8759718, longitude: -118.3956055))
let AMPSMR = Facility(title: "Amp Sports Medicine & Recovery",
locationName: "Califonia",
facilityType: "PT",
attributeOne: "Therapist",
attributeTwo: "Graston",
attributeThree: "Normatec", attributeFour: "DMS",
image: #imageLiteral(resourceName: "AMPSMR"),
coordinate: CLLocationCoordinate2D(latitude: 33.6424442, longitude: -117.5739344))
func mapView(_ mapView: MKMapView, didSelect view: MKAnnotationView)
{
if let findFacility = view.annotation?.title
{
showFacilityDetails(facilityTitle: findFacility!)
}
}
func showFacilityDetails(facilityTitle: String){
let a = facilityArray.index(where: { $0.title == facilityTitle })
titleOutput = facilityArray[a!].title!
let imageOutput = facilityArray[a!].Image
let attOne = facilityArray[a!].attributeOne
let attTwo = facilityArray[a!].attributeTwo
let attThree = facilityArray[a!].attributeThree
let attFour = facilityArray[a!].attributeFour
facilityImage.image = imageOutput
facDetailTitle.text = titleOutput
facilityAttOne.text = attOne
facilityAttTwo.text = attTwo
facilityAttThree.text = attThree
facilityAttFour.text = attFour
useFacilityButton.isHidden = false
facilityOfferLabel.isHidden = false
}
@IBAction func useFacilityButtonAction(_ sender: Any) {
}
// Function to pull information from database
func showFacility(facilityName: String, completionHandler:@escaping (CLLocationCoordinate2D)-> Void) {
ref.child("facilities").child(facilityName).observeSingleEvent(of: .value, with: { (snapshot) in
let long = snapshot.value(forKey: "long") as? Double
let lat = snapshot.value(forKey: "lat") as? Double
let location = CLLocationCoordinate2DMake(lat!, long!)
completionHandler(location)
})
}
func facilityName(completionHandler:@escaping (String)-> Void) {
ref.child("facilities").child("AMPSMR").observeSingleEvent(of: .value, with: { (snapshot) in
let name = snapshot.value(forKey: "name") as? String
completionHandler(name!)
})
}
override func viewDidLoad() {
super.viewDidLoad()
locManager.requestWhenInUseAuthorization()
locManager.delegate = self
ref = Database.database().reference()
// For use when the app is open
//locationManager.requestWhenInUseAuthorization()
// If location services is enabled get the users location
if CLLocationManager.locationServicesEnabled() {
locManager.delegate = self
locManager.desiredAccuracy = kCLLocationAccuracyBest // You can change the locaiton accuary here.
locManager.startUpdatingLocation()
}
let lat = locManager.location?.coordinate.latitude
let long = locManager.location?.coordinate.longitude
print(lat)
if lat == nil {
let initialLocation = CLLocationCoordinate2DMake(38.68591858, -99.05480122)
let regionRadius: CLLocationDistance = 4000000
let coordinateRegion = MKCoordinateRegionMakeWithDistance(initialLocation, regionRadius, regionRadius)
facilityLocations.setRegion(coordinateRegion, animated: true)
} else {
let initialLocation = CLLocationCoordinate2DMake(lat!, long!)
let regionRadius: CLLocationDistance = 12000
let coordinateRegion = MKCoordinateRegionMakeWithDistance(initialLocation, regionRadius, regionRadius)
facilityLocations.setRegion(coordinateRegion, animated: true)
}
facilityLocations.showsUserLocation = true
facilityArray.append(cryoWaveManBeachCA)
facilityArray.append(beachCitiesCryo)
facilityArray.append(beachCitiesOtho)
facilityArray.append(floatLab)
facilityArray.append(AMPSMR)
facilityLocations.addAnnotation(cryoWaveManBeachCA)
facilityLocations.addAnnotation(beachCitiesCryo)
facilityLocations.addAnnotation(beachCitiesOtho)
facilityLocations.addAnnotation(floatLab)
facilityLocations.addAnnotation(AMPSMR)
self.useFacilityButton.layer.borderWidth = 2
self.useFacilityButton.layer.borderColor = UIColor.cyan.cgColor
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
/*if let FacilitySliders = segue.destination as? FacilitySliders {FacilitySliders.facility = titleOutput;
FacilitySliders.timeSelected = timeSelected;
}*/
}
}
| [
-1
] |
ce70a7bcf028b772757f5167e3b39b7d6098943e | fba8170aba6302c0b15cc423cd0292aa66ad3338 | /RS-Game-Catalogue/ViewController/Detail/DetailViewController.swift | de6ffa3c19a1a24e51254a14d8cf17635a1f992c | [] | no_license | sseno/RS-Game-Catalogue | bb26913fbaf06d1a74c67e830c51c57e214b3906 | d4094e578c35f2099b590e4c5caa03ed7eb6fa90 | refs/heads/master | 2022-12-02T17:26:34.872914 | 2020-08-22T15:01:10 | 2020-08-22T15:01:10 | 276,451,289 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,888 | swift | //
// DetailViewController.swift
// RS-Game-Catalogue
//
// Created by Rohmat Suseno on 05/07/20.
// Copyright © 2020 github.com/sseno. All rights reserved.
//
import UIKit
import LBTATools
import SDWebImage
class DetailViewController: UIViewController {
private lazy var tableView: UITableView = {
let tableView = UITableView()
tableView.delegate = self
tableView.dataSource = self
tableView.separatorStyle = .none
tableView.allowsSelection = false
tableView.rowHeight = 44.0
tableView.register(DetailTableCell.self, forCellReuseIdentifier: Constants.ReuseIdentifier.detailTableCell)
tableView.isHidden = true
return tableView
}()
var gameID = 327999 // 0
var gameName = ""
var data: GameDetailResponse?
override func viewDidLoad() {
super.viewDidLoad()
extendedLayoutIncludesOpaqueBars = true
setupUI()
setupNavBar()
getGameDetail()
}
private func setupUI() {
self.view.backgroundColor = .systemBackground
self.view.addSubview(tableView)
tableView.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
tableView.leadingAnchor.constraint(equalTo: self.view.leadingAnchor),
tableView.trailingAnchor.constraint(equalTo: self.view.trailingAnchor),
tableView.topAnchor.constraint(equalTo: self.view.topAnchor),
tableView.bottomAnchor.constraint(equalTo: self.view.bottomAnchor),
])
}
private func setupNavBar() {
self.navigationItem.rightBarButtonItem = UIBarButtonItem.menuButton(self, action: #selector(shareButtonTapped(_:)), image: UIImage(named: "square.and.arrow.up"), width: 30)
}
func getGameDetail() {
showLoadingIndicator(true)
ApiManager.shared.getGameDetail(by: gameID) { [weak self] result in
guard let self = self else { return }
self.showLoadingIndicator(false)
switch result {
case .success(let games):
self.updateUI(with: games)
case .failure(let error):
self.showAlertOnMainThread(message: error.rawValue)
}
}
}
private func updateUI(with data: GameDetailResponse) {
DispatchQueue.main.async {
self.data = data
self.tableView.isHidden = false
self.tableView.reloadData()
}
}
// MARK: - Actions
@objc func shareButtonTapped(_ sender: UIBarButtonItem) {
if let websiteURL = self.data?.website, websiteURL != "" {
let items = [URL(string: websiteURL)!]
let ac = UIActivityViewController(activityItems: items, applicationActivities: nil)
present(ac, animated: true)
} else {
showAlertOnMainThread(message: "URL is not available.", title: "Uh-oh!")
}
}
}
// MARK: - UITableViewDelegate
extension DetailViewController: UITableViewDelegate {
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return UITableView.automaticDimension
}
}
// MARK: - UITableViewDataSource, UITableViewDelegate
extension DetailViewController: UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: Constants.ReuseIdentifier.detailTableCell, for: indexPath) as! DetailTableCell
cell.delegate = self
if let data = self.data {
cell.setData(data)
}
return cell
}
}
// MARK: - DetailTableCellDelegate
extension DetailViewController: DetailTableCellDelegate {
func arrowRightTapped() {
let vc = MoreDetailViewController()
if let data = self.data {
vc.title = data.name
vc.updateUI(with: data)
self.navigationController?.pushViewController(vc, animated: true)
}
}
}
#if DEBUG
import SwiftUI
struct DetailViewController_Previews: PreviewProvider {
static var previews: some View {
Group {
DetailContentView().previewDevice(.init(stringLiteral: "iPhone 8"))
.environment(\.colorScheme, .light)
DetailContentView().previewDevice(.init(stringLiteral: "iPhone X"))
.environment(\.colorScheme, .dark)
}
}
struct DetailContentView: UIViewControllerRepresentable {
func makeUIViewController(context: Context) -> DetailViewController {
return DetailViewController()
}
func updateUIViewController(_ uiViewController: DetailViewController, context: Context) {
//
}
}
}
#endif
| [
-1
] |
97d80883ff17b8ed1274dde059c63d4f8774c3cc | 23b701e5fed0ff39600b7142c3636a19bedb1bfa | /animation101/SceneDelegate.swift | 14669694b8064b9d83f368c2fc01e4cb9035138f | [] | no_license | zoa0945/animation101 | 4185d622001e606616becd91c2dce4ee6198c769 | 2fdf1b8638801fa8d96710569a1a3f9cc4714ff6 | refs/heads/master | 2023-08-27T01:29:20.725354 | 2021-11-01T10:37:49 | 2021-11-01T10:37:49 | 423,425,963 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,288 | swift | //
// SceneDelegate.swift
// animation101
//
// Created by Mac on 2021/10/28.
//
import UIKit
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
guard let _ = (scene as? UIWindowScene) else { return }
}
func sceneDidDisconnect(_ scene: UIScene) {
// Called as the scene is being released by the system.
// This occurs shortly after the scene enters the background, or when its session is discarded.
// Release any resources associated with this scene that can be re-created the next time the scene connects.
// The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead).
}
func sceneDidBecomeActive(_ scene: UIScene) {
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
}
func sceneWillResignActive(_ scene: UIScene) {
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).
}
func sceneWillEnterForeground(_ scene: UIScene) {
// Called as the scene transitions from the background to the foreground.
// Use this method to undo the changes made on entering the background.
}
func sceneDidEnterBackground(_ scene: UIScene) {
// Called as the scene transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
}
}
| [
393221,
163849,
393228,
393231,
393251,
352294,
344103,
393260,
393269,
213049,
376890,
385082,
393277,
376906,
327757,
254032,
368728,
180314,
254045,
180322,
376932,
286833,
286845,
286851,
417925,
262284,
360598,
286880,
377003,
377013,
164029,
327872,
180418,
377030,
377037,
377047,
418008,
418012,
377063,
327915,
205037,
393457,
393461,
393466,
418044,
385281,
336129,
262405,
180491,
164107,
336140,
262417,
368913,
262423,
377118,
377121,
262437,
254253,
336181,
262455,
393539,
262473,
344404,
213333,
418135,
270687,
262497,
418145,
262501,
213354,
246124,
262508,
262512,
213374,
385420,
262551,
262553,
385441,
385444,
262567,
385452,
262574,
393649,
385460,
262587,
344512,
262593,
360917,
369119,
328178,
328180,
328183,
328190,
254463,
328193,
164362,
328207,
410129,
393748,
377372,
188959,
385571,
377384,
197160,
33322,
352822,
270905,
197178,
418364,
188990,
369224,
385610,
270922,
352844,
385617,
352865,
262761,
352875,
344694,
352888,
336513,
377473,
385671,
148106,
377485,
352919,
98969,
344745,
361130,
336556,
385714,
434868,
164535,
336568,
328379,
164539,
328387,
352969,
385743,
385749,
139998,
189154,
369382,
361196,
418555,
344832,
336644,
344837,
344843,
328462,
361231,
394002,
336660,
418581,
418586,
434971,
369436,
262943,
369439,
418591,
418594,
336676,
418600,
418606,
369464,
361274,
328516,
336709,
328520,
336712,
361289,
328523,
336715,
361300,
213848,
426842,
361307,
197469,
361310,
254813,
361318,
344936,
361323,
361335,
328574,
369544,
361361,
222129,
345036,
115661,
386004,
345046,
386012,
386019,
328690,
435188,
328703,
328710,
418822,
328715,
377867,
361490,
386070,
271382,
336922,
345119,
377888,
345134,
345139,
361525,
386102,
361537,
377931,
189525,
156762,
402523,
361568,
148580,
345200,
361591,
386168,
410746,
361594,
214150,
345224,
386187,
345247,
361645,
345268,
402615,
361657,
337093,
402636,
328925,
165086,
165092,
222438,
386286,
328942,
386292,
206084,
328967,
345377,
353572,
345380,
345383,
263464,
337207,
345400,
378170,
369979,
337224,
337230,
337235,
263509,
353634,
337252,
402792,
271731,
378232,
337278,
271746,
181639,
353674,
181644,
361869,
181650,
181655,
230810,
181671,
181674,
181679,
181682,
337330,
181687,
370105,
181691,
181697,
361922,
337350,
181704,
337366,
271841,
329192,
361961,
329195,
116211,
337399,
402943,
337416,
329227,
419341,
419345,
329234,
419351,
345626,
419357,
345631,
370208,
419360,
394787,
419363,
370214,
419369,
394796,
419377,
419386,
206397,
214594,
419401,
419404,
353868,
419408,
214611,
419412,
403040,
345702,
222831,
370298,
353920,
403073,
403076,
345737,
198282,
403085,
403092,
345750,
419484,
345758,
345763,
419492,
419498,
419502,
370351,
419507,
337588,
419510,
419513,
419518,
337601,
403139,
337607,
419528,
419531,
419536,
272083,
394967,
419545,
345819,
419548,
419551,
345829,
419560,
337643,
419564,
337647,
370416,
337671,
362249,
362252,
395022,
362256,
321300,
345888,
362274,
378664,
354107,
345916,
354112,
370504,
329545,
345932,
370510,
354132,
337751,
247639,
370520,
313181,
182110,
354143,
354157,
345965,
345968,
345971,
345975,
403321,
1914,
354173,
247692,
395148,
337809,
247701,
329625,
436127,
436133,
247720,
337834,
362414,
337845,
190393,
346059,
346064,
247760,
346069,
419810,
329699,
354275,
190440,
354314,
346140,
436290,
378956,
395340,
436307,
338005,
100454,
329833,
329853,
329857,
329868,
411806,
329886,
346273,
362661,
100525,
387250,
379067,
387261,
256193,
395467,
256214,
411862,
411865,
411869,
411874,
379108,
411877,
387303,
346344,
395496,
338154,
387307,
346350,
338161,
436474,
321787,
379135,
411905,
411917,
379154,
395539,
387350,
387353,
338201,
182559,
338212,
395567,
248112,
362823,
436556,
321880,
362844,
379234,
354674,
321911,
420237,
379279,
354728,
338353,
338382,
272849,
248279,
256474,
182755,
338404,
338411,
330225,
248309,
248332,
330254,
199189,
420377,
330268,
191012,
330320,
199250,
191069,
346722,
248427,
191085,
338544,
191093,
346743,
346769,
150184,
174775,
248505,
174778,
363198,
223936,
355025,
273109,
355029,
264919,
256735,
338661,
264942,
363252,
338680,
264965,
338701,
256787,
363294,
199455,
396067,
346917,
396070,
215854,
355123,
355141,
355144,
338764,
355151,
330581,
330585,
387929,
355167,
265056,
265059,
355176,
355180,
355185,
412600,
207809,
379849,
347082,
396246,
330711,
248794,
248799,
347106,
437219,
257009,
265208,
265215,
199681,
338951,
330761,
330769,
330775,
248863,
158759,
396329,
347178,
404526,
396337,
330803,
396340,
339002,
388155,
339010,
347208,
248905,
330827,
248915,
183384,
339037,
412765,
257121,
322660,
265321,
248952,
420985,
330886,
330890,
347288,
248986,
44199,
380071,
339118,
249018,
339133,
126148,
322763,
330959,
330966,
265433,
265438,
388320,
363757,
388348,
339199,
396552,
175376,
175397,
273709,
372016,
437553,
347442,
199989,
175416,
396601,
208189,
437567,
175425,
437571,
126279,
437576,
437584,
331089,
437588,
331094,
396634,
175451,
437596,
429408,
175458,
175461,
175464,
265581,
331124,
175478,
249210,
175484,
249215,
175487,
249219,
175491,
249225,
249228,
249235,
175514,
175517,
396703,
396706,
175523,
355749,
396723,
388543,
380353,
216518,
380364,
339406,
372177,
339414,
413143,
249303,
339418,
339421,
249310,
339425,
249313,
339429,
339435,
249329,
69114,
372229,
208399,
380433,
175637,
405017,
134689,
339504,
265779,
421442,
413251,
265796,
265806,
224854,
224858,
339553,
257636,
224871,
372328,
257647,
372338,
224885,
224888,
224891,
224895,
372354,
421509,
126597,
224905,
11919,
224911,
224914,
126611,
224917,
224920,
126618,
208539,
224923,
224927,
224930,
224933,
257705,
224939,
224943,
257713,
224949,
257717,
257721,
224954,
257725,
224960,
257733,
224966,
224970,
257740,
224976,
257745,
339664,
257748,
224982,
257752,
224987,
257762,
224996,
225000,
225013,
257788,
225021,
339711,
257791,
225027,
257796,
257802,
339722,
257805,
225039,
257808,
249617,
225044,
167701,
372500,
257815,
225049,
257820,
225054,
184096,
257825,
225059,
339748,
225068,
257837,
413485,
225071,
225074,
257843,
225077,
257846,
225080,
397113,
225083,
397116,
257853,
225088,
225094,
225097,
257869,
257872,
225105,
397140,
225109,
225113,
257881,
257884,
257887,
225120,
257891,
413539,
225128,
257897,
339818,
225138,
339827,
257909,
225142,
372598,
257914,
257917,
225150,
257922,
380803,
225156,
339845,
257927,
225166,
397201,
225171,
380823,
225176,
225183,
372698,
372704,
372707,
356336,
380919,
372739,
405534,
266295,
266298,
217158,
421961,
200786,
356440,
217180,
430181,
266351,
356467,
266365,
192640,
266375,
381069,
225425,
250003,
225430,
250008,
356507,
250012,
225439,
135328,
225442,
438434,
192674,
225445,
438438,
225448,
438441,
225451,
258223,
225456,
430257,
225459,
225462,
225468,
389309,
225472,
372931,
225476,
430275,
389322,
225485,
225488,
225491,
266454,
225494,
225497,
225500,
225503,
225506,
356580,
225511,
217319,
225515,
225519,
381177,
397572,
389381,
356638,
356641,
356644,
356647,
266537,
356650,
389417,
356656,
332081,
307507,
340276,
356662,
397623,
332091,
225599,
201030,
348489,
332107,
151884,
430422,
348503,
332118,
250201,
250203,
250211,
340328,
250217,
348523,
348528,
332153,
356734,
389503,
332158,
438657,
332162,
389507,
348548,
356741,
250239,
332175,
160152,
373146,
340380,
373149,
70048,
356783,
373169,
266688,
324032,
201158,
340452,
127473,
217590,
340473,
324095,
324100,
324103,
324112,
340501,
324118,
324122,
340512,
332325,
324134,
381483,
356908,
324141,
324143,
356917,
324150,
324156,
168509,
348734,
324161,
324165,
356935,
381513,
348745,
324171,
324174,
324177,
389724,
332381,
373344,
340580,
348777,
381546,
119432,
340628,
184983,
373399,
258723,
332460,
389806,
332464,
332473,
381626,
332484,
332487,
332494,
357070,
357074,
332512,
332521,
340724,
332534,
155647,
373499,
348926,
389927,
348979,
152371,
340792,
398141,
357202,
389971,
357208,
389979,
430940,
357212,
357215,
439138,
201580,
201583,
349041,
340850,
381815,
430967,
324473,
398202,
119675,
324476,
430973,
340859,
340863,
324479,
324482,
373635,
324485,
324488,
185226,
381834,
324493,
324496,
324499,
430996,
324502,
324511,
422817,
324514,
201638,
398246,
373672,
324525,
5040,
111539,
324534,
5047,
324539,
324542,
398280,
349129,
340940,
340942,
209874,
340958,
431073,
398307,
340964,
209896,
201712,
209904,
349173,
381947,
201724,
431100,
349181,
431107,
349203,
209944,
209948,
250915,
250917,
169002,
357419,
209966,
209969,
209973,
209976,
209980,
209988,
209991,
209996,
431180,
341072,
349268,
177238,
250968,
210011,
373853,
341094,
210026,
210028,
210032,
349296,
210037,
210042,
210045,
349309,
152704,
160896,
349313,
210053,
210056,
349320,
373905,
259217,
210068,
210072,
210078,
210081,
210085,
210089,
210096,
210100,
324792,
210108,
357571,
210116,
210128,
210132,
333016,
210139,
210144,
218355,
218361,
275709,
128254,
275713,
242947,
275717,
275723,
333075,
349460,
333079,
251161,
349486,
349492,
415034,
210261,
365912,
259423,
374113,
251236,
374118,
333164,
234867,
390518,
357756,
374161,
112021,
349591,
333222,
259516,
415168,
366035,
415187,
366039,
415192,
415194,
415197,
415200,
333285,
415208,
366057,
366064,
415217,
415225,
423424,
415258,
415264,
366118,
415271,
382503,
349739,
144940,
415279,
415282,
415286,
210488,
415291,
415295,
333396,
333400,
366173,
423529,
423533,
210547,
415354,
333440,
267910,
267929,
333512,
259789,
366301,
333535,
153311,
366308,
366312,
431852,
399086,
366319,
210673,
366322,
399092,
366326,
333566,
268042,
210700,
366349,
210707,
399129,
333595,
210720,
358192,
366384,
366388,
210740,
358201,
325441,
366403,
325447,
341831,
341835,
341839,
341844,
415574,
358235,
341852,
350046,
399200,
399208,
358256,
268144,
358260,
341877,
399222,
325494,
333690,
325505,
333699,
399244,
333709,
333725,
333737,
382891,
382898,
350153,
358348,
333777,
219094,
399318,
358372,
350190,
350194,
333819,
350204,
350207,
325633,
325637,
350214,
268299,
333838,
350225,
350232,
333851,
350238,
350241,
374819,
350245,
350249,
350252,
178221,
350257,
350260,
350272,
243782,
350281,
350286,
374865,
342113,
252021,
342134,
374904,
268435,
333998,
334012,
260299,
350411,
350417,
350423,
211161,
350426,
350449,
358645,
350459,
350462,
350465,
350469,
268553,
350477,
268560,
350481,
432406,
350487,
325915,
350491,
325918,
350494,
325920,
350500,
350505,
358701,
391469,
350510,
358705,
358714,
358717,
383307,
358738,
334162,
383331,
383334,
391531,
383342,
334204,
268669,
194942,
391564,
366991,
334224,
268702,
342431,
375209,
375220,
334263,
326087,
358857,
195041,
334312,
104940,
375279,
350724,
186898,
342546,
350740,
342551,
334359,
342555,
334364,
416294,
350762,
252463,
358962,
334386,
334397,
358973,
252483,
219719,
399957,
334425,
326240,
375401,
334466,
334469,
391813,
162446,
326291,
342680,
342685,
260767,
342711,
244410,
260798,
260802,
350918,
154318,
342737,
391895,
154329,
416476,
64231,
113389,
342769,
203508,
375541,
342777,
391938,
391949,
375569,
326417,
375572,
375575,
375580,
162592,
334633,
326444,
383794,
326452,
326455,
375613,
244542,
260925,
375616,
326463,
326468,
342857,
326474,
326479,
326486,
416599,
342875,
244572,
326494,
433001,
400238,
326511,
211826,
211832,
392061,
351102,
359296,
252801,
260993,
351105,
400260,
211846,
342921,
342931,
400279,
252823,
392092,
400286,
252838,
359335,
211885,
400307,
351169,
359362,
351172,
170950,
359367,
326599,
187335,
359383,
359389,
383968,
343018,
359411,
261109,
261112,
244728,
383999,
261130,
261148,
359452,
211999,
261155,
261160,
261166,
359471,
375868,
343132,
384099,
384102,
384108,
367724,
187503,
343155,
384115,
212095,
384136,
384140,
384144,
351382,
384152,
384158,
384161,
351399,
384169,
367795,
244917,
384182,
367801,
384189,
351424,
384192,
343232,
367817,
244938,
384202,
253132,
326858,
384209,
146644,
351450,
384225,
359650,
343272,
351467,
359660,
384247,
351480,
384250,
351483,
351492,
343307,
384270,
261391,
359695,
253202,
261395,
384276,
384284,
245021,
384290,
253218,
245032,
171304,
384299,
351535,
376111,
245042,
326970,
384324,
343366,
212296,
212304,
367966,
343394,
367981,
343410,
155000,
327035,
245121,
245128,
253321,
155021,
384398,
245137,
245143,
245146,
245149,
343453,
245152,
245155,
155045,
245158,
40358,
245163,
114093,
327090,
343478,
359867,
384444,
146878,
327108,
327112,
384457,
359887,
359891,
368093,
155103,
343535,
343540,
368120,
343545,
409092,
359948,
359951,
245295,
359984,
400977,
400982,
179803,
155241,
245358,
155255,
155274,
368289,
245410,
425652,
425663,
155328,
245463,
155352,
155356,
212700,
155364,
245477,
155372,
245487,
212723,
409336,
155394,
155404,
245528,
155423,
360224,
155439,
204592,
155444,
155448,
417596,
384829,
384831,
360262,
155463,
155477,
376665,
155484,
261982,
425823,
376672,
155488,
155492,
327532,
261997,
376686,
262000,
262003,
327542,
147319,
262006,
262009,
425846,
262012,
155517,
155523,
155526,
360327,
376715,
155532,
262028,
262031,
262034,
262037,
262040,
262043,
155550,
253854,
262046,
262049,
262052,
327590,
155560,
155563,
155566,
327613,
393152,
311244,
393170,
155604,
155620,
253924,
155622,
327655,
253927,
360432,
393204,
360439,
253944,
393209,
393215
] |
078b2b0e90f0ded799db9d96094e4b4bc7fdf177 | e8a58dd394c63bced6970916d943a2b26b4af19f | /SwiftModules/Extensions/Foundation/HashableExtensions.swift | 0b608cdee41610b9b264cb3d5fdd9504836906b7 | [
"MIT"
] | permissive | aichiko0225/SwiftModules | a7a4b9f81e1005bedacf6456b46964c82581bb9b | 2bdda2cee041239a7fa83ebfc6e0b738e965d719 | refs/heads/master | 2023-05-22T16:35:30.723363 | 2020-12-03T03:44:59 | 2020-12-03T03:44:59 | 288,594,536 | 7 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 279 | swift | //
// HashableExtensions.swift
// SwiftExtensions
//
// Created by Rugen Heidbuchel on 01/08/2018.
// Copyright © 2018 Goktug Yilmaz. All rights reserved.
//
import Foundation
extension Hashable {
var hashString: String {
return String(self.hashValue)
}
}
| [
-1
] |
d199a3e663911d5d599d22871e9bf8538a28b7ae | 76ba64a67a5f650df23850aaa2349bf0f2a371fc | /poker/Sources/Poker/Poker.swift | a28fcdc793fa1921318c8e31f326646c3d7a7b84 | [] | no_license | 23inhouse/exercism | 4649a5ce384e3959df728c4122a28a69de8e830a | b5327b7e51af9bf1b849da805781abddbc1cc03d | refs/heads/master | 2020-05-24T11:42:40.043001 | 2019-06-08T12:40:25 | 2019-06-08T12:56:19 | 187,253,961 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,792 | swift | //Solution goes in Sources
// MARK: Poker
struct Poker {
static func bestHand(_ hands: [String]) -> String {
let pokerHands = hands.map({ PokerHand($0)! })
guard let best = BestHand.check(pokerHands) else {
assert(false, "Error: No winner")
}
return String(describing: best.hand)
}
}
struct BestHand {
typealias PokerHandLogic = (PokerHand) -> ([Card])
static let logics: [PokerHandLogic] = [royalFlush, straightFlush, fourOfAKind, fullHouse, flush, straight, threeOfAKind, twoPair, pair, highCard]
static let royalFlush: PokerHandLogic = { hand in
let cards = straightFlush(hand)
guard cards.count == 5 else { return [] }
guard cards[0].rank == .ace else { return [] }
return cards
}
static let straightFlush: PokerHandLogic = { hand in
let cards = straight(hand)
guard cards.count == 5, flush(hand).count == 5 else { return [] }
return cards
}
static let fourOfAKind: PokerHandLogic = { hand in
var cards = grouped(hand)
guard cards.count == 4 && cards.first!.rank == cards.last!.rank else { return [] }
for card in hand.sorted().filter({ !cards.contains($0) }) {
cards.append(card)
}
return cards
}
static let fullHouse: PokerHandLogic = { hand in
var cards = grouped(hand)
guard cards.count == 5 else { return cards }
if cards[0].rank != cards[2].rank {
cards.reverse()
}
return cards
}
static let flush: PokerHandLogic = { hand in
return hand.sorted().filter { card in card.suit == hand.cards[0].suit }
}
static let straight: PokerHandLogic = { hand in
var cards = [Card]()
for card in hand.sorted().reversed() {
if cards.isEmpty || cards.last!.rank.index() == card.rank.index() - 1 {
cards.append(card)
}
if cards.count == 4 && cards.last!.rank == .five && card.rank == .ace {
cards.insert(card, at: 0)
}
}
return cards
}
static let threeOfAKind: PokerHandLogic = { hand in
var cards = grouped(hand)
guard cards.count == 3 else { return [] }
for card in hand.sorted().filter({ !cards.contains($0) }) {
cards.append(card)
}
return cards
}
static let twoPair: PokerHandLogic = { hand in
var cards = grouped(hand)
guard cards.count == 4 && cards.first!.rank != cards.last!.rank else { return [] }
for card in hand.sorted().filter({ !cards.contains($0) }) {
cards.append(card)
}
return cards
}
static let pair: PokerHandLogic = { hand in
var cards = grouped(hand)
guard cards.count == 2 else { return [] }
for card in hand.sorted().filter({ !cards.contains($0) }) {
cards.append(card)
}
return cards
}
static let highCard: PokerHandLogic = { hand in
return hand.cards.sorted()
}
static func check(_ hands: [PokerHand]) -> BestHand? {
return hands.map({ BestHand($0) }).sorted().last
}
static func grouped(_ hand: PokerHand) -> [Card] {
var cards = [Card]()
for card in hand {
for other in hand {
guard card != other else { continue }
guard !cards.contains(card) else { continue }
if card.rank == other.rank {
cards.append(card)
}
}
}
return cards.sorted()
}
let hand: PokerHand
let cards: [Card]
let score: Int
init(_ hand: PokerHand) {
var score = 0
var cards = [Card]()
for (i, logic) in BestHand.logics.enumerated() {
cards = logic(hand)
if cards.count == 5 {
score = BestHand.logics.count - i
break
}
}
self.hand = hand
self.cards = cards
self.score = score
}
}
extension BestHand: Comparable {
static func == (lhs: BestHand, rhs: BestHand) -> Bool {
return lhs.score == rhs.score && lhs.highCard() == rhs.highCard()
}
static func < (lhs: BestHand, rhs: BestHand) -> Bool {
// print("\(lhs.hand) < \(rhs.hand) == \(lhs.score) < \(rhs.score) || \(lhs.highCard()) < \(rhs.highCard()) || \(lhs.secondHighCard(rhs)) < \(rhs.secondHighCard(lhs)) || \(lhs.cards.first!.suit.index()) < \(rhs.cards.first!.suit.index())")
guard lhs.score != rhs.score else {
guard lhs.highCard() != rhs.highCard() else {
guard lhs.secondHighCard(rhs) != rhs.secondHighCard(lhs) else {
return lhs.cards.first!.suit < rhs.cards.first!.suit
}
return lhs.secondHighCard(rhs) < rhs.secondHighCard(lhs)
}
return lhs.highCard() < rhs.highCard()
}
return lhs.score < rhs.score
}
func highCard() -> Rank {
return cards[0].rank
}
func secondHighCard(_ other: BestHand) -> Rank {
let highCards = hand.filter({ !other.hand.ranks().contains($0.rank) })
guard let highestCard = highCards.sorted().last else { return .two }
return highestCard.rank
}
}
| [
-1
] |
d906d06f6022c14b1a3f50d461edddb04fa0c2be | 12bc142109e79e82925961e5f4e8e3d1fe58f486 | /Magic 8 Ball/Magic 8 BallTests/Magic_8_BallTests.swift | 32c7bd72f61968e51ffa373b0d9eb7b135504aa9 | [] | no_license | emmanuelolivo1002/Magic-8-Ball | 4ad4bc5cec314732230cdeb006ec5e312e853f81 | 6525d4aedcb3b75df5ed6c59be342bccd179ad3d | refs/heads/master | 2021-05-10T23:56:39.733122 | 2018-01-21T00:54:28 | 2018-01-21T00:54:28 | 118,291,249 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 992 | swift | //
// Magic_8_BallTests.swift
// Magic 8 BallTests
//
// Created by Emmanuel Olivo on 20/01/18.
// Copyright © 2018 ConDosEmes. All rights reserved.
//
import XCTest
@testable import Magic_8_Ball
class Magic_8_BallTests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measure {
// Put the code you want to measure the time of here.
}
}
}
| [
360462,
229413,
204840,
344107,
155694,
229424,
229430,
163896,
180280,
376894,
286788,
352326,
311372,
196691,
385116,
237663,
254048,
319591,
278634,
221290,
204916,
131191,
131198,
311438,
278677,
196760,
426138,
278691,
377009,
278708,
131256,
278714,
295098,
139479,
229597,
311519,
205035,
286958,
327929,
344313,
147717,
368905,
278797,
254226,
319763,
368916,
262421,
377114,
278816,
237856,
237857,
311597,
98610,
180535,
336183,
278842,
287041,
287043,
139589,
319813,
344401,
377169,
368981,
155990,
278869,
368984,
106847,
98657,
270701,
270706,
246136,
139640,
311681,
311685,
106888,
385417,
385422,
213403,
246178,
385454,
311727,
377264,
278970,
319930,
311738,
33211,
336320,
311745,
254406,
188871,
278989,
278993,
278999,
328152,
369116,
188894,
287198,
279008,
279013,
279018,
319981,
319987,
279029,
254456,
377338,
279039,
377343,
254465,
287241,
279050,
139792,
303636,
279062,
393751,
279065,
377376,
180771,
377386,
197167,
385588,
279094,
115270,
385615,
426576,
369235,
295519,
139872,
66150,
279146,
295536,
139892,
287352,
344696,
279164,
189057,
311941,
336518,
311945,
369289,
344715,
279177,
311949,
287374,
377489,
311954,
352917,
230040,
271000,
377497,
303771,
377500,
205471,
344738,
139939,
287404,
295599,
205487,
303793,
336564,
230072,
287417,
287422,
377539,
287433,
287439,
164560,
385747,
279252,
361176,
418520,
287452,
295652,
279269,
246503,
369385,
230125,
312047,
279280,
312052,
230134,
172792,
344827,
221948,
205568,
295682,
197386,
434957,
295697,
426774,
197399,
426775,
197411,
279336,
262954,
295724,
197422,
353070,
164656,
303920,
262962,
295729,
197431,
230199,
336702,
295744,
279362,
353109,
377686,
230234,
189275,
435039,
295776,
303972,
385893,
279397,
230248,
246641,
246643,
295798,
246648,
279417,
361337,
254850,
369538,
287622,
58253,
295824,
189348,
279464,
140204,
377772,
304051,
230332,
189374,
377790,
353215,
213957,
213960,
345033,
279498,
386006,
304087,
418776,
50143,
123881,
320493,
287731,
271350,
295927,
304122,
328700,
328706,
410627,
320516,
295942,
386056,
353290,
377869,
238610,
418837,
140310,
197657,
369701,
238639,
312373,
238651,
377926,
238664,
296019,
304222,
230499,
279660,
173166,
377972,
337017,
377983,
279685,
402565,
222343,
386189,
296086,
238743,
296092,
238765,
279728,
238769,
402613,
230588,
279747,
353479,
402634,
279760,
189652,
279765,
189653,
419029,
148696,
296153,
279774,
304351,
304356,
222440,
279785,
328940,
279792,
386294,
386301,
320770,
386306,
312587,
328971,
353551,
173334,
320796,
222494,
353584,
345396,
386359,
378172,
279875,
312648,
337225,
304456,
230729,
296270,
238927,
353616,
378209,
386412,
230765,
296307,
116084,
337281,
148867,
296329,
296335,
9619,
370071,
173491,
304564,
279989,
353719,
361927,
296392,
280010,
280013,
239068,
280032,
271843,
280041,
329197,
329200,
296433,
280055,
288249,
296448,
230921,
329225,
296461,
304656,
329232,
370197,
402985,
394794,
312880,
288309,
312889,
288318,
280130,
288327,
239198,
157281,
99938,
312940,
222832,
288378,
337534,
337535,
263809,
239237,
288392,
239250,
419478,
206504,
321199,
337591,
280251,
280257,
280267,
403148,
9936,
313041,
9937,
370388,
272085,
345814,
280278,
280280,
18138,
67292,
345821,
321247,
321249,
345833,
345834,
288491,
280300,
239341,
67315,
173814,
313081,
288512,
288516,
280327,
280329,
321302,
345879,
321310,
255776,
362283,
378668,
296755,
280372,
321337,
280380,
345919,
436031,
403267,
280392,
345929,
304977,
18262,
362327,
280410,
345951,
362337,
345955,
296806,
288620,
280430,
214895,
313199,
362352,
313203,
182144,
305026,
329622,
337815,
214937,
214938,
436131,
436137,
362417,
362431,
280514,
280519,
214984,
362443,
329695,
436191,
313319,
296941,
436205,
329712,
43014,
354316,
313357,
239650,
354343,
354345,
223274,
346162,
288828,
436285,
288833,
288834,
436292,
403525,
313416,
436301,
354385,
338001,
338003,
223316,
280661,
329814,
354393,
280675,
280677,
43110,
313447,
321637,
436329,
288879,
223350,
280694,
288889,
215164,
313469,
215166,
280712,
215178,
346271,
436383,
362659,
239793,
182456,
280762,
223419,
379071,
280768,
149703,
280778,
346314,
321745,
280795,
387296,
280802,
379106,
346346,
321772,
436470,
149760,
411906,
313608,
272658,
338218,
321840,
379186,
321860,
280902,
289110,
215385,
354655,
321894,
313713,
354676,
199029,
436608,
362881,
248194,
240002,
436611,
240016,
108944,
190871,
149916,
420253,
141728,
289189,
108972,
272813,
338356,
436661,
281040,
289232,
256477,
281072,
174593,
420369,
207393,
289332,
174648,
338489,
338490,
281166,
281171,
297560,
436832,
436834,
313966,
281199,
420463,
346737,
313971,
346740,
420471,
330379,
117396,
346772,
264856,
289434,
346779,
166582,
314040,
158394,
363211,
363230,
264928,
330474,
289518,
125684,
199414,
191235,
322316,
117517,
322319,
166676,
207640,
281377,
289576,
191283,
273207,
289598,
281408,
322395,
330609,
207732,
158593,
224145,
355217,
256922,
289690,
289698,
420773,
289703,
363438,
347055,
289727,
273344,
330689,
363458,
379844,
19399,
248796,
347103,
289774,
183279,
347123,
240630,
257024,
330754,
134150,
322570,
330763,
322582,
248872,
322612,
314448,
339030,
281697,
281700,
257125,
273515,
207979,
404593,
363641,
363644,
150657,
248961,
330888,
363669,
339100,
380061,
339102,
199839,
429214,
306338,
265379,
249002,
306346,
3246,
421048,
208058,
265412,
290000,
298208,
298212,
298213,
290022,
330984,
298221,
298228,
216315,
208124,
388349,
437505,
322824,
257305,
339234,
372009,
412971,
306494,
216386,
224586,
331090,
314710,
372054,
159066,
314720,
306542,
380271,
208244,
249204,
290173,
306559,
224640,
314751,
298374,
314758,
314760,
142729,
388487,
314766,
306579,
224661,
282007,
290207,
314783,
314789,
282022,
314791,
282024,
396711,
396712,
314798,
380337,
380338,
150965,
380357,
339398,
306631,
306639,
413137,
429542,
282096,
306673,
306677,
191990,
290300,
282114,
372227,
306692,
306693,
323080,
323087,
282129,
175639,
282136,
388632,
396827,
282141,
134686,
347694,
290358,
265798,
282183,
265804,
396882,
290390,
306776,
44635,
396895,
323172,
282213,
323178,
224883,
314998,
323196,
175741,
339584,
282245,
290443,
323217,
282271,
282273,
282276,
298661,
290471,
282280,
298667,
224946,
110268,
224958,
282303,
323263,
274115,
282312,
306890,
282318,
241361,
282327,
298712,
298720,
12010,
282348,
282355,
282358,
323331,
323332,
339715,
216839,
339720,
282378,
372496,
323346,
282391,
339745,
257830,
421672,
282409,
200498,
315202,
307011,
307025,
413521,
216918,
307031,
241495,
282480,
241528,
315264,
339841,
282504,
315273,
315274,
110480,
184208,
372626,
380821,
282519,
298909,
118685,
298920,
200627,
323507,
290745,
290746,
274371,
151497,
372701,
298980,
380908,
282612,
315432,
233517,
102445,
176175,
241716,
225351,
315465,
315476,
307289,
315487,
356447,
315497,
315498,
438377,
233589,
233590,
266357,
422019,
241808,
323729,
381073,
233636,
184484,
299174,
233642,
405687,
299198,
258239,
389313,
299203,
299209,
372941,
282831,
266449,
176362,
307435,
438511,
381172,
184575,
381208,
151839,
233762,
217380,
282919,
332083,
332085,
332089,
315706,
307517,
438596,
332101,
323913,
348492,
323920,
348500,
168281,
332123,
323935,
332127,
242023,
160110,
242033,
291192,
340357,
225670,
242058,
373134,
291224,
242078,
61857,
315810,
61859,
315811,
381347,
340398,
299441,
283064,
127427,
127428,
324039,
373197,
176601,
160225,
291311,
291333,
340490,
283153,
258581,
291358,
283182,
234036,
315960,
348732,
242237,
70209,
348742,
70215,
348749,
381517,
332378,
201308,
111208,
184940,
373358,
389745,
209530,
291454,
373375,
152195,
348806,
152203,
316049,
111253,
316053,
111258,
111259,
176808,
299699,
299700,
422596,
422599,
291530,
225995,
242386,
422617,
422626,
299746,
234217,
299759,
299770,
299776,
242433,
291585,
430849,
291592,
62220,
422673,
430865,
291604,
422680,
283419,
234277,
283430,
152365,
422703,
422709,
152374,
160571,
430910,
160575,
160580,
381773,
201551,
242529,
349026,
357218,
177001,
201577,
308076,
242541,
209783,
209785,
177019,
185211,
308092,
398206,
291712,
381829,
316298,
308112,
349072,
234386,
324507,
390045,
185250,
283558,
185254,
373687,
373706,
316364,
324586,
349175,
201720,
127992,
357379,
234500,
234514,
308243,
316437,
357414,
300084,
308287,
218186,
234577,
341073,
439384,
234587,
300135,
300136,
316520,
357486,
144496,
300150,
300151,
291959,
160891,
300158,
349316,
349318,
373903,
169104,
177296,
308372,
185493,
119962,
300187,
300188,
300201,
300202,
373945,
283840,
259268,
283852,
283853,
259280,
316627,
333011,
234733,
292085,
234742,
292091,
128251,
439562,
292107,
414990,
251153,
177428,
349462,
382258,
300343,
382269,
300359,
234827,
177484,
406861,
259406,
234831,
283991,
357719,
374109,
292195,
333160,
284014,
316787,
111993,
357762,
112017,
234898,
259475,
275859,
357786,
251298,
333220,
374191,
292283,
292292,
300487,
300489,
284107,
210390,
210391,
210393,
144867,
251378,
308723,
300535,
300536,
300542,
259599,
316946,
308756,
398869,
374296,
374299,
308764,
431649,
169518,
431663,
194110,
349763,
218696,
292425,
128587,
333388,
300630,
128599,
333408,
300644,
317032,
415338,
243307,
54893,
325231,
325245,
235135,
194180,
415375,
333470,
153251,
300714,
210603,
415420,
333503,
259781,
333517,
333520,
325346,
153319,
325352,
284401,
325371,
194304,
300811,
243472,
366360,
284442,
325404,
399147,
431916,
300848,
259899,
325439,
153415,
341836,
415567,
325457,
317269,
341847,
284507,
350044,
128862,
284512,
284514,
276327,
292712,
423789,
292720,
325492,
276341,
300918,
341879,
317304,
333688,
194429,
112509,
55167,
325503,
333701,
243591,
325518,
333722,
350109,
300963,
292771,
415655,
284587,
292782,
243637,
284619,
301008,
153554,
194515,
292836,
292837,
317415,
325619,
432116,
292858,
415741,
333828,
358410,
399373,
317467,
145435,
227370,
325674,
309295,
129076,
243767,
358456,
309345,
227428,
194666,
260207,
432240,
284788,
333940,
292988,
292992,
194691,
227460,
415881,
104587,
235662,
284826,
333991,
284842,
227513,
227548,
194782,
301279,
317664,
243962,
375039,
309503,
194820,
325905,
325912,
309529,
227616,
211235,
432421,
211238,
358703,
358709,
227654,
325968,
6481,
366930,
6489,
383332,
383336,
285040,
317820,
211326,
317831,
227725,
252308,
293274,
121245,
285090,
342450,
293303,
293310,
416197,
129483,
342476,
326100,
358882,
342498,
334309,
391655,
432618,
375276,
301571,
342536,
416286,
375333,
244269,
375343,
236081,
23092,
375351,
244281,
301638,
309830,
293448,
55881,
416341,
309846,
416351,
268899,
39530,
301689,
244347,
326287,
375440,
334481,
318106,
318107,
342682,
285361,
342706,
318130,
293556,
383667,
285373,
39614,
154316,
334547,
96984,
375526,
342762,
342763,
293612,
129773,
154359,
228088,
432893,
162561,
383754,
310036,
285466,
326429,
293664,
326433,
400166,
293672,
318250,
318252,
301871,
375609,
285497,
293693,
252741,
318278,
293711,
244568,
244570,
301918,
293730,
342887,
400239,
228215,
400252,
359298,
359299,
260996,
113542,
228233,
228234,
392074,
56208,
293781,
318364,
310176,
310178,
310182,
293800,
236461,
293806,
326581,
326587,
326601,
359381,
433115,
343005,
326635,
187374,
383983,
318461,
293886,
293893,
433165,
384016,
433174,
252958,
203830,
359478,
277597,
113760,
392290,
253029,
285798,
228458,
15471,
351344,
285814,
285820,
392318,
187521,
384131,
302216,
326804,
187544,
351390,
253099,
253100,
318639,
367799,
113850,
294074,
302274,
367810,
244940,
195808,
310497,
228588,
302325,
228600,
228609,
261377,
253216,
130338,
261425,
351537,
286013,
294218,
146762,
294219,
318805,
425304,
294243,
163175,
327024,
327025,
318848,
179587,
253317,
384393,
368011,
318864,
318868,
318875,
310692,
245161,
286129,
286132,
228795,
425405,
302531,
425418,
310732,
64975,
228827,
286172,
187878,
286202,
359930,
286205,
302590,
294400,
253451,
359950,
146964,
253463,
286244,
245287,
245292,
196164,
56902,
228943,
286288,
179801,
196187,
343647,
310889,
204397,
138863,
188016,
294529,
286343,
229001,
310923,
188048,
425626,
229020,
302754,
40613,
40614,
40615,
229029,
286388,
286391,
384695,
327358,
286399,
212685,
384720,
302802,
278233,
278234,
294622,
278240,
212716,
212717,
360177,
229113,
278272,
319233,
311042,
360195,
286494,
294700,
409394,
319292,
360252,
360264,
376669,
245599,
237408,
425825,
425833,
417654,
188292,
294807,
294809,
376732,
294814,
311199,
319392,
294823,
327596,
294843,
188348,
98239,
237504,
294850,
384964,
344013,
212942,
24532,
294886,
311281,
311282
] |
8fbdb0608ea5472bb0ba342718f19fe186dd40b0 | 9fff98488874ef44761d7714bf2002bfc289f760 | /Enumerations.playground/Contents.swift | 733cfa4e1b152c3a53d209aff8538ba6529bdff6 | [] | no_license | JuyelRana/Hacking-with-swift-by-Paul-Hudson | ec380a9a6b1ea658fd0e39aea5795d0997e9beb0 | ea589217eedb737f12b094dc631c9081867fbef3 | refs/heads/master | 2020-05-22T03:52:56.334008 | 2019-06-16T18:13:09 | 2019-06-16T18:13:09 | 186,220,898 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 811 | swift | import UIKit
enum WeatherType{
case sun
case cloud
case rain
case wind
case snow
}
func getHaterStatus(weather: WeatherType) -> String?{
switch weather {
case .sun:
return nil
case .cloud, .wind:
return "dislike"
case .rain:
return "Hate"
default:
return "Dismiss"
}
}
print(getHaterStatus(weather: .rain)!)
enum WeatherTypeT{
case sun
case cloud
case rain
case wind(speed: Int)
case snow
}
func getHaterStatusT(weather: WeatherTypeT) -> String? {
switch weather {
case .sun:
return nil
case .wind(let speed) where speed < 10:
return "meh"
case .cloud, .wind:
return "dislike"
case .rain, .snow:
return "hate"
}
}
print(getHaterStatus(weather: .wind)!)
| [
-1
] |
bb7119f40fd641c00e4c6952b616bf74a802c970 | 210493a7561d4e769748a1ac1a45d323335a0206 | /CI-CDUITests/CI_CDUITests.swift | 8c3e326f5e4293f1cff61c722d9ce414a43adc5e | [] | no_license | kunaltyagi26/CI-CD | 927e607a9a2f026e00df1c5f2130bf6fb4538b5e | 56b78bcc91a366c78e908e6cf84d356519b58bb5 | refs/heads/main | 2023-07-13T03:07:51.953589 | 2021-08-22T07:29:40 | 2021-08-22T07:29:40 | 380,748,627 | 0 | 0 | null | 2021-07-04T17:27:45 | 2021-06-27T13:37:03 | Swift | UTF-8 | Swift | false | false | 1,407 | swift | //
// CI_CDUITests.swift
// CI-CDUITests
//
// Created by Kunal Tyagi on 04/07/21.
//
import XCTest
class CI_CDUITests: XCTestCase {
override func setUpWithError() throws {
// Put setup code here. This method is called before the invocation of each test method in the class.
// In UI tests it is usually best to stop immediately when a failure occurs.
continueAfterFailure = false
// In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
}
override func tearDownWithError() throws {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testExample() throws {
// UI tests must launch the application that they test.
let app = XCUIApplication()
app.launch()
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testLaunchPerformance() throws {
if #available(macOS 10.15, iOS 13.0, tvOS 13.0, *) {
// This measures how long it takes to launch your application.
measure(metrics: [XCTApplicationLaunchMetric()]) {
XCUIApplication().launch()
}
}
}
}
| [
360463,
376853,
344106,
253996,
163894,
385078,
319543,
352314,
376892,
32829,
352324,
352327,
385095,
163916,
368717,
196687,
254039,
426074,
368732,
180317,
32871,
352359,
221292,
385135,
376945,
385147,
426124,
196758,
49308,
65698,
49317,
377008,
377010,
377025,
377033,
164043,
417996,
254157,
368849,
368850,
139478,
385240,
254171,
147679,
147680,
205034,
254189,
254193,
344312,
336121,
262403,
147716,
385291,
368908,
180494,
262419,
254228,
368915,
377116,
254250,
418095,
336177,
368949,
180534,
155968,
270663,
319816,
368969,
254285,
180559,
377168,
344402,
368982,
270703,
139641,
385407,
385409,
106893,
270733,
385423,
385433,
213402,
385437,
254373,
385448,
385449,
311723,
115116,
385463,
336319,
336323,
188870,
262619,
377309,
377310,
369121,
369124,
270823,
213486,
360945,
139766,
393719,
254459,
410108,
410109,
262657,
377346,
410126,
393745,
385554,
254487,
410138,
188957,
377374,
385569,
385578,
197166,
393775,
418352,
33339,
352831,
33344,
385603,
385612,
426575,
385620,
369236,
270938,
352885,
352886,
344697,
369285,
385669,
344714,
377487,
426646,
180886,
352921,
377499,
344737,
352938,
418479,
164532,
377531,
377534,
377536,
385737,
385745,
369365,
369366,
385751,
361178,
352989,
352990,
295649,
418529,
385763,
369383,
361194,
344829,
197377,
434956,
418579,
197398,
426777,
344864,
197412,
336678,
189229,
197424,
197428,
336693,
377656,
426809,
197433,
222017,
377669,
197451,
369488,
385878,
385880,
197467,
435038,
385895,
197479,
385901,
197489,
164730,
254851,
369541,
172936,
189327,
377754,
140203,
172971,
377778,
377789,
345034,
418774,
386007,
386016,
123880,
418793,
435185,
222193,
271351,
435195,
328701,
386049,
328705,
418819,
410629,
377863,
189448,
320526,
361487,
435216,
386068,
254997,
336928,
336930,
410665,
345137,
361522,
386108,
410687,
377927,
361547,
205911,
156763,
361570,
214116,
214119,
402538,
173168,
377974,
66684,
377986,
402568,
140426,
337037,
386191,
410772,
222364,
418975,
124073,
402618,
402632,
148687,
402641,
419028,
222441,
386288,
66802,
271607,
386296,
369913,
419066,
369912,
386300,
386304,
320769,
369929,
320795,
115997,
222496,
369964,
353581,
116014,
66863,
312628,
345397,
345398,
386363,
337226,
345418,
353611,
353612,
378186,
353617,
378201,
312688,
337280,
353672,
263561,
304523,
370066,
9618,
411028,
370072,
148900,
361928,
337359,
329168,
329170,
353751,
329181,
320997,
361958,
271850,
271853,
329198,
411119,
116209,
386551,
312830,
271880,
198155,
329231,
370200,
157219,
157220,
394793,
353875,
99937,
345697,
271980,
206447,
403057,
42616,
337533,
370307,
419462,
149127,
149128,
419464,
214667,
345753,
255651,
337590,
370359,
403149,
345813,
370390,
272087,
345817,
337638,
181992,
345832,
345835,
141037,
173828,
395018,
395019,
395026,
124691,
435993,
345882,
321308,
255781,
362281,
378666,
403248,
378673,
345910,
182070,
182071,
436029,
337734,
272207,
272208,
337746,
345942,
362326,
345950,
370526,
362336,
255844,
214894,
362351,
214896,
124795,
182145,
337816,
124826,
329627,
354210,
436130,
436135,
10153,
362411,
370604,
362418,
362442,
346066,
354268,
436189,
403421,
329696,
354273,
403425,
190437,
354279,
436199,
174058,
354283,
247787,
329707,
337899,
247786,
313322,
436209,
124912,
346117,
182277,
403463,
354311,
354312,
354310,
43016,
436235,
419857,
436248,
346153,
124974,
272432,
403507,
378933,
378934,
436283,
403524,
436293,
436304,
329812,
411738,
272477,
395373,
346237,
436372,
362658,
125108,
133313,
395458,
338118,
436429,
346319,
321744,
379102,
387299,
18661,
379110,
125166,
149743,
379120,
436466,
125170,
411892,
436471,
395511,
436480,
125184,
272644,
125192,
338187,
338188,
125197,
395536,
125200,
338196,
272661,
379157,
125204,
125215,
125216,
338217,
125225,
125236,
362809,
379193,
395591,
272730,
436570,
215395,
362864,
354672,
272755,
354678,
248188,
313726,
436609,
240003,
395653,
436613,
395660,
264591,
420241,
436644,
272815,
436659,
338359,
436677,
256476,
420326,
166403,
322057,
420374,
322077,
330291,
191065,
436831,
420461,
313970,
346739,
346741,
420473,
166533,
346771,
363155,
264855,
363161,
436897,
355006,
363228,
436957,
436960,
264929,
338658,
346859,
330476,
35584,
133889,
346889,
264971,
322320,
207639,
363295,
355117,
191285,
355129,
273209,
273211,
355136,
355138,
420680,
355147,
355148,
355153,
387927,
363353,
363354,
322396,
420702,
363361,
363362,
412516,
355173,
355174,
207724,
355182,
207728,
420722,
330627,
387977,
396171,
355216,
224146,
224149,
256918,
256919,
256920,
256934,
273336,
273341,
330688,
379845,
363462,
273353,
207839,
347104,
412653,
257007,
248815,
347122,
437245,
257023,
125953,
396292,
330759,
347150,
330766,
330789,
248871,
412725,
257093,
404550,
314437,
339031,
257126,
404582,
396395,
265323,
404589,
273523,
363643,
248960,
150656,
363658,
224400,
347286,
265366,
429209,
339101,
429216,
339106,
265381,
380069,
421050,
339131,
265410,
183492,
339167,
421102,
363769,
52473,
52476,
412926,
437504,
380178,
429332,
126229,
412963,
257323,
273713,
208179,
159033,
347451,
216387,
257353,
257354,
109899,
437585,
331091,
150868,
372064,
429410,
437602,
388458,
265579,
314734,
314740,
314742,
421240,
314745,
388488,
314776,
396697,
396709,
380335,
355761,
421302,
134586,
380348,
380350,
216511,
216510,
200136,
273865,
339403,
372172,
413138,
437726,
429540,
3557,
3559,
191980,
191991,
216575,
372226,
208397,
323088,
413202,
388630,
175640,
216610,
372261,
347693,
323120,
396850,
200245,
323126,
134715,
421437,
396865,
413255,
265800,
273992,
421452,
265809,
396885,
265816,
396889,
396896,
323171,
388712,
388713,
339579,
396927,
224907,
405140,
274071,
208547,
208548,
405157,
388775,
364202,
421556,
224951,
224952,
323262,
323265,
241360,
241366,
224985,
159462,
372458,
397040,
12017,
274170,
175874,
249606,
323335,
372497,
421657,
339746,
257831,
167720,
241447,
421680,
274234,
241471,
339782,
315209,
241494,
339799,
274288,
372592,
274296,
339840,
315265,
372625,
118693,
438186,
151492,
380874,
372699,
380910,
380922,
380923,
274432,
372736,
241695,
315431,
430120,
315433,
430127,
405552,
249912,
225347,
176209,
381013,
53334,
200795,
356446,
438374,
176231,
438378,
217194,
422000,
249976,
266361,
422020,
381061,
168070,
168069,
381071,
323730,
430231,
200856,
422044,
192670,
192671,
258213,
323761,
266427,
356550,
372943,
266447,
258263,
356575,
438512,
372979,
381173,
135416,
356603,
266504,
61720,
381210,
315674,
389406,
438575,
332084,
438583,
127292,
438592,
332100,
348499,
250196,
348501,
389465,
332128,
110955,
242027,
160111,
250227,
438653,
340356,
266628,
225684,
373141,
373144,
389534,
397732,
373196,
242138,
184799,
324098,
397841,
258584,
348709,
348710,
397872,
340539,
266812,
348741,
381515,
348748,
430681,
332379,
184938,
373357,
184942,
176751,
389744,
356983,
356984,
209529,
356990,
422529,
373377,
152196,
201348,
356998,
348807,
356999,
316050,
275102,
176805,
340645,
422567,
176810,
160441,
422591,
135888,
242385,
373485,
373486,
21239,
275193,
348921,
430853,
430860,
62222,
430880,
152372,
160569,
430909,
160576,
348999,
275294,
381791,
127840,
357219,
439145,
242540,
242542,
381811,
201590,
398205,
340865,
349066,
316299,
349068,
381840,
390034,
430999,
209820,
381856,
185252,
398244,
422825,
381872,
398268,
349122,
373705,
127945,
340960,
398305,
340967,
398313,
127990,
349176,
201721,
349179,
357380,
398370,
357413,
357420,
21567,
398405,
218187,
250955,
250965,
439391,
250982,
398444,
62574,
357487,
119925,
349304,
349315,
349317,
373902,
177297,
324761,
373937,
373939,
324790,
218301,
259275,
259285,
357594,
414956,
251124,
439550,
439563,
242955,
414989,
349458,
259346,
259347,
382243,
382246,
382257,
382264,
333115,
193853,
251212,
406862,
259408,
316764,
374110,
382329,
357758,
243073,
357763,
112019,
398740,
374189,
251314,
259513,
54719,
259569,
251379,
398844,
210429,
366081,
431646,
349727,
431662,
374327,
210489,
235069,
349764,
128589,
333389,
333394,
349780,
415334,
54895,
366198,
210558,
210559,
415360,
333438,
415369,
431754,
210569,
415376,
259741,
153252,
399014,
210601,
202413,
317102,
415419,
259780,
333508,
267978,
333522,
325345,
333543,
431861,
161539,
366358,
169751,
431901,
341791,
325411,
333609,
399148,
202541,
431918,
153392,
431935,
415555,
325444,
325449,
341837,
415566,
431955,
325460,
317268,
341846,
259937,
382820,
415592,
325491,
341878,
276343,
333687,
350072,
317305,
112510,
325508,
333700,
243590,
350091,
350092,
350102,
350108,
333727,
219046,
128955,
219102,
6116,
432114,
415740,
268286,
415744,
333827,
243720,
399372,
153618,
358418,
178215,
325675,
243763,
358455,
325695,
399433,
333902,
104534,
432241,
374913,
374914,
415883,
333968,
333990,
104633,
260285,
268479,
374984,
334049,
325857,
268515,
383208,
317676,
260337,
260338,
375040,
260355,
375052,
194832,
325904,
334104,
178459,
334121,
358698,
325930,
260396,
358707,
178485,
358710,
268609,
383309,
383327,
391521,
366948,
383338,
432503,
432511,
252309,
39323,
317851,
375211,
334259,
129461,
342454,
358844,
317889,
326083,
416201,
129484,
154061,
432608,
195044,
391654,
432616,
334315,
375281,
334345,
342549,
416288,
342560,
350758,
350759,
358951,
358952,
219694,
219695,
375373,
416334,
416340,
244311,
416353,
260705,
375396,
268901,
244326,
244345,
375438,
326288,
383668,
342714,
39616,
383708,
269036,
432883,
203511,
342775,
383740,
432894,
359166,
375552,
162559,
383755,
326413,
326428,
318247,
342827,
318251,
375610,
342846,
416577,
244569,
375644,
252766,
351078,
342888,
392057,
211835,
269179,
260995,
392071,
424842,
236427,
252812,
400271,
392080,
400282,
7070,
211871,
359332,
359333,
326571,
252848,
326580,
261045,
261046,
326586,
359365,
211913,
326602,
342990,
252878,
433104,
359380,
433112,
433116,
359391,
187372,
343020,
383980,
383994,
171009,
384004,
433166,
384015,
433173,
326684,
252959,
384031,
375848,
261191,
375902,
375903,
392288,
253028,
351343,
187505,
138354,
392317,
343166,
384127,
392320,
253074,
326803,
359574,
351389,
253098,
367791,
367792,
367798,
343230,
367809,
253124,
113863,
351445,
253168,
351475,
351489,
367897,
367898,
245018,
130347,
212282,
359747,
359748,
114022,
253288,
163190,
327030,
384379,
253316,
384391,
253339,
253340,
343457,
245160,
359860,
359861,
343480,
425417,
327122,
425434,
310747,
253431,
359931,
343552,
359949,
253456,
253462,
146976,
245290,
245291,
343606,
163385,
425534,
138817,
147011,
147020,
196184,
179800,
343646,
155238,
204394,
138862,
188021,
425624,
245413,
384693,
376502,
409277,
319176,
409289,
425682,
245471,
155360,
212721,
163575,
319232,
360194,
409355,
155408,
319289,
384826,
409404,
360253,
409416,
376661,
368471,
368486,
384871,
409446,
40809,
368489,
425832,
417648,
417658,
360315,
253828,
327556,
425875,
253851,
376733,
253868,
188349,
212947,
212953,
360416,
253930,
385011
] |
8bf5c9f6b6311321ff17905e3daceedb435f515c | b57d3299251235d4c14e560a7a4092bbdaf3cb37 | /Source/LBXScanNetAnimation.swift | bbcafdd0d594a4e671238cd81edbbb8f04b61623 | [
"MIT"
] | permissive | wangjianqi/swiftScan | 3bfc3e8a59814abe3529172cab2e691c19589d7e | ef66b08a82211d906c36fba7eb21317de57b26e2 | refs/heads/master | 2020-04-19T14:53:38.593540 | 2019-01-30T02:55:48 | 2019-01-30T02:55:48 | 168,257,439 | 0 | 0 | MIT | 2019-01-30T01:21:34 | 2019-01-30T01:21:34 | null | UTF-8 | Swift | false | false | 1,661 | swift | //
// LBXScanNetAnimation.swift
// swiftScan
//
// Created by lbxia on 15/12/9.
// Copyright © 2015年 xialibing. All rights reserved.
//
import UIKit
class LBXScanNetAnimation: UIImageView {
var isAnimationing = false
var animationRect:CGRect = CGRect.zero
static public func instance()-> LBXScanNetAnimation {
return LBXScanNetAnimation()
}
func startAnimatingWithRect(animationRect:CGRect, parentView:UIView, image:UIImage?) {
self.image = image
self.animationRect = animationRect
parentView.addSubview(self)
self.isHidden = false
isAnimationing = true
if (image != nil) {
stepAnimation()
}
}
@objc func stepAnimation() {
if (!isAnimationing) { return }
var frame = animationRect
let hImg = self.image!.size.height * animationRect.size.width / self.image!.size.width;
frame.origin.y -= hImg;
frame.size.height = hImg;
self.frame = frame
self.alpha = 0.0
UIView.animate(withDuration: 1.2, animations: {
self.alpha = 1.0
var frame = self.animationRect;
let hImg = self.image!.size.height * self.animationRect.size.width / self.image!.size.width
frame.origin.y += (frame.size.height - hImg);
frame.size.height = hImg
self.frame = frame
}, completion:{ _ in
self.perform(#selector(LBXScanNetAnimation.stepAnimation), with: nil, afterDelay: 0.3)
})
}
func stopStepAnimating(){
self.isHidden = true
isAnimationing = false
}
}
| [
332818,
332821,
123234,
123237
] |
a28740510ab9afc2e1042f6058b6d7cd5c6e7636 | 059558e5727395af1b8e05953502ae2f0fcd3637 | /CollegeBuilderApp/AppDelegate.swift | f5ba4289c610d747b2e0fdc5a29d1ead2c30dd31 | [] | no_license | sstephanos/CollegeBuilder | 210e28085fbe3cee786e5a9a3180050d0341baa4 | 81ad5f4337ade6cd38d5d12cc5a61840f57c84ee | refs/heads/master | 2021-01-17T19:23:54.188090 | 2016-07-28T02:52:54 | 2016-07-28T02:52:54 | 64,217,832 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,151 | swift | //
// AppDelegate.swift
// CollegeBuilderApp
//
// Created by Samone on 7/25/16.
// Copyright © 2016 Simon Stephanos. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
func applicationDidEnterBackground(application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(application: UIApplication) {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
| [
229380,
229383,
229385,
278539,
229388,
294924,
278542,
229391,
327695,
278545,
229394,
278548,
229397,
229399,
229402,
278556,
229405,
352284,
278559,
278564,
229415,
229417,
327722,
237613,
360496,
229426,
237618,
229428,
286774,
229432,
286776,
286778,
319544,
204856,
286791,
237640,
278605,
286797,
311375,
163920,
196692,
319573,
311383,
278623,
278626,
319590,
311400,
278635,
303212,
278639,
131192,
278648,
237693,
327814,
131209,
303241,
417930,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
286916,
286922,
286924,
286926,
286928,
131281,
278743,
278747,
295133,
155872,
319716,
278760,
237807,
303345,
286962,
229622,
327930,
278781,
278783,
278785,
237826,
278792,
286987,
319757,
311569,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
155966,
319809,
319810,
278849,
319814,
311623,
319818,
311628,
287054,
319822,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
319879,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
278980,
278983,
319945,
278986,
278990,
278994,
311767,
279003,
279006,
188895,
279010,
287202,
279015,
172520,
279020,
279023,
311791,
172529,
279027,
319989,
164343,
180727,
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,
279082,
279084,
172591,
172598,
279095,
172607,
172609,
172612,
377413,
172614,
172618,
303690,
33357,
279124,
172634,
262752,
172644,
311911,
189034,
295533,
172655,
172656,
189039,
295538,
189040,
172660,
189044,
287349,
352880,
287355,
287360,
295553,
287365,
311942,
303751,
295557,
352905,
279178,
287371,
311946,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
164509,
303773,
295583,
172702,
230045,
287394,
287390,
303780,
172705,
287398,
172707,
279208,
287400,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
328381,
287423,
328384,
279231,
287427,
107208,
279241,
172748,
287436,
287440,
295633,
172755,
303827,
279255,
279258,
303835,
213724,
189149,
303838,
287450,
279267,
295654,
279272,
230128,
312048,
312050,
230131,
205564,
303871,
230146,
328453,
295685,
230154,
33548,
312077,
295695,
295701,
369433,
230169,
295707,
328476,
295710,
230175,
303914,
279340,
279353,
230202,
312124,
222018,
295755,
377676,
148302,
287569,
279383,
303959,
230237,
279390,
230241,
279394,
303976,
336744,
303985,
328563,
303987,
303991,
303997,
295806,
295808,
304005,
213895,
320391,
304007,
304009,
304011,
304013,
279438,
213902,
295822,
189329,
295825,
304019,
279445,
58262,
279452,
279461,
279462,
304042,
213931,
230327,
304055,
287675,
304063,
238528,
304065,
213954,
189378,
156612,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
295945,
295949,
197645,
230413,
320528,
140312,
295961,
238620,
304164,
189479,
304170,
238641,
238652,
238655,
230465,
238658,
336964,
296004,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
205931,
296044,
279661,
205934,
164973,
312432,
279669,
337018,
189562,
279679,
279683,
222340,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
238766,
165038,
230576,
238770,
304311,
230592,
279750,
312518,
230600,
230607,
148690,
320727,
279769,
304348,
279777,
304354,
296163,
320740,
279781,
304360,
320748,
279788,
279790,
304370,
296189,
320771,
312585,
296202,
296205,
230674,
320786,
230677,
296213,
296215,
320792,
230681,
230679,
214294,
304416,
230689,
173350,
312622,
296243,
312630,
222522,
222525,
296253,
312639,
296255,
296259,
378181,
230727,
238919,
320840,
296264,
296267,
296271,
222545,
230739,
312663,
337244,
222556,
230752,
312676,
230760,
173418,
410987,
230763,
230768,
296305,
312692,
230773,
279929,
304506,
304505,
181626,
181631,
312711,
312712,
296331,
288140,
288144,
230800,
337306,
288160,
173472,
288162,
288164,
279975,
304555,
370092,
279983,
288176,
279985,
312755,
296373,
279991,
312759,
288185,
337335,
222652,
312766,
173507,
296389,
222665,
230860,
280014,
312783,
288208,
230865,
288210,
370130,
288212,
280021,
288214,
222676,
239064,
288217,
329177,
280027,
288220,
288218,
239070,
288224,
280034,
288226,
280036,
288229,
280038,
288230,
288232,
370146,
288234,
288236,
288238,
288240,
291754,
288242,
296435,
288244,
288250,
402942,
148990,
296446,
206336,
296450,
230916,
230919,
304651,
370187,
304653,
230940,
222752,
108066,
296486,
296488,
157229,
230961,
288320,
288325,
124489,
280145,
288338,
280149,
280152,
288344,
239194,
280158,
403039,
370272,
312938,
280183,
280185,
280188,
280191,
280194,
116354,
280208,
280211,
288408,
280218,
280222,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
313027,
280260,
206536,
280264,
206539,
206541,
206543,
280276,
321239,
280283,
313052,
288478,
313055,
321252,
313066,
280302,
288494,
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,
288576,
345921,
280388,
304968,
280393,
280402,
313176,
42842,
280419,
321381,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280464,
124817,
280468,
239510,
280473,
124827,
247709,
214944,
280487,
313258,
321458,
296883,
124853,
10170,
296890,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
239586,
313320,
231404,
124913,
165876,
321528,
239612,
313340,
288764,
239617,
313347,
288773,
313358,
321560,
305176,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
124980,
288824,
288826,
321595,
378941,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
280671,
223327,
149599,
321634,
149601,
149603,
313451,
223341,
280687,
313458,
280691,
313464,
329850,
321659,
288895,
321670,
215175,
141455,
141459,
313498,
100520,
288936,
288940,
280755,
288947,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
313548,
321740,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
157930,
280811,
280817,
125171,
157940,
280819,
182517,
280823,
280825,
280827,
280830,
280831,
280833,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
280888,
280891,
289087,
280897,
280900,
239944,
305480,
280906,
239947,
305485,
305489,
280919,
354653,
313700,
280937,
313705,
280940,
190832,
280946,
223606,
313720,
280956,
239997,
280959,
313731,
199051,
240011,
289166,
240017,
297363,
190868,
297365,
240021,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
305594,
289210,
281024,
289218,
289221,
289227,
281045,
281047,
215526,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
240132,
223749,
281095,
338440,
150025,
223752,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
281135,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
199262,
338532,
281190,
199273,
281196,
158317,
313973,
281210,
297594,
158347,
133776,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
314029,
314033,
240309,
314047,
314051,
199364,
297671,
199367,
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,
207737,
183172,
240519,
322440,
338823,
314249,
183184,
289687,
240535,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
281567,
289762,
322534,
297961,
183277,
281581,
322550,
175134,
322599,
322610,
314421,
281654,
314427,
207937,
314433,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
281708,
281711,
289912,
248995,
306341,
306347,
306354,
142531,
199877,
289991,
306377,
289997,
363742,
363745,
298216,
330988,
216303,
322801,
388350,
363802,
199976,
199978,
314671,
298292,
298294,
216376,
298306,
380226,
281923,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
290171,
314747,
306555,
290174,
224641,
281987,
298372,
314756,
281990,
224647,
298377,
314763,
224657,
306581,
314779,
314785,
282025,
314793,
282027,
241068,
241070,
241072,
282034,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
282101,
241142,
191992,
290298,
151036,
290302,
282111,
290305,
192008,
323084,
282127,
290321,
282130,
282133,
290325,
241175,
290328,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
282186,
224849,
282195,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
257658,
315016,
282249,
290445,
324757,
282261,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
282295,
282300,
323260,
323266,
282310,
323273,
282319,
306897,
241362,
282328,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
241450,
282410,
306988,
306991,
315184,
315190,
241464,
159545,
282425,
298811,
307009,
413506,
307012,
315211,
307027,
315221,
282454,
315223,
241496,
241498,
307035,
307040,
282465,
241509,
110438,
298860,
110445,
282478,
315249,
110450,
315251,
282481,
315253,
315255,
339838,
282499,
315267,
315269,
241544,
282505,
241546,
241548,
298896,
298898,
282514,
44948,
298901,
241556,
282520,
241560,
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,
241661,
299006,
282623,
315396,
241669,
315397,
282632,
282639,
282645,
241693,
241701,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
307278,
307287,
315482,
217179,
315483,
192605,
200801,
299105,
217188,
299109,
307303,
315495,
356457,
45163,
307307,
315502,
192624,
307314,
323700,
299126,
233591,
307329,
307338,
233613,
241813,
307352,
299164,
184479,
299167,
184481,
184486,
307370,
307372,
307374,
307376,
323763,
176311,
299191,
307385,
307386,
258235,
176316,
307388,
307390,
184503,
299200,
307394,
307396,
184518,
307399,
323784,
307409,
307411,
176343,
299225,
233701,
307432,
282881,
282893,
291089,
282906,
291104,
233766,
307508,
315701,
307510,
332086,
307512,
151864,
307515,
282942,
307518,
151874,
282947,
323917,
110926,
282957,
233808,
323921,
315733,
323926,
233815,
315739,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
283033,
291226,
242075,
315801,
291231,
283042,
291238,
291241,
127403,
127405,
291247,
127407,
299440,
299444,
127413,
283062,
291254,
127417,
291260,
283069,
127421,
127424,
299457,
127431,
283080,
176592,
315856,
315860,
176597,
127447,
283095,
299481,
176605,
242143,
291299,
127463,
242152,
291305,
127466,
176620,
127474,
291314,
291317,
135672,
233979,
291323,
291330,
283142,
127497,
233994,
135689,
233998,
234003,
234006,
152087,
127511,
283161,
242202,
234010,
135707,
242206,
135710,
242208,
291361,
291378,
234038,
152118,
234041,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
291456,
135808,
373383,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
135839,
299680,
225954,
299684,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
225998,
299726,
226002,
226005,
119509,
226008,
201444,
299750,
283368,
234219,
283372,
226037,
283382,
234231,
316151,
234236,
226045,
234239,
242431,
209665,
234242,
299778,
242436,
226053,
234246,
226056,
234248,
291593,
242443,
234252,
242445,
234254,
291601,
234258,
242450,
242452,
234261,
348950,
201496,
234264,
234266,
234269,
283421,
234272,
234274,
152355,
234278,
299814,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
283452,
160572,
234302,
234307,
242499,
234309,
292433,
234313,
316233,
316235,
234316,
283468,
242511,
234319,
234321,
234324,
185173,
201557,
234329,
234333,
308063,
234336,
234338,
242530,
349027,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
226171,
291711,
234368,
234370,
201603,
234373,
226182,
234375,
226185,
308105,
234379,
234384,
234388,
234390,
324504,
234393,
209818,
308123,
324508,
226200,
234398,
234396,
291742,
234401,
291747,
291748,
234405,
291750,
234407,
324518,
324520,
234410,
324522,
226220,
291756,
234414,
324527,
291760,
234417,
201650,
324531,
234422,
226230,
275384,
324536,
234428,
291773,
234431,
242623,
324544,
324546,
226239,
324548,
226245,
234437,
234439,
234434,
234443,
234446,
275406,
193486,
234449,
316370,
193488,
234452,
234455,
234459,
234461,
234467,
234470,
168935,
5096,
324585,
234475,
234478,
316400,
234481,
316403,
234484,
234485,
324599,
234487,
234490,
234493,
234496,
316416,
234501,
275462,
308231,
234504,
234507,
234510,
234515,
300054,
234519,
316439,
234520,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
144430,
234543,
234546,
275508,
234549,
300085,
300088,
234553,
234556,
234558,
316479,
234561,
316483,
234563,
308291,
234568,
234570,
316491,
300108,
234572,
234574,
300115,
234580,
234581,
242777,
234585,
275545,
234590,
234593,
234595,
300133,
234597,
234601,
300139,
234605,
160879,
234607,
275569,
234610,
300148,
234614,
398455,
144506,
234618,
275579,
234620,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
275594,
234636,
177293,
234640,
275602,
234643,
226453,
275606,
234647,
275608,
308373,
234650,
234648,
308379,
234653,
324766,
119967,
283805,
234657,
300189,
324768,
242852,
234661,
283813,
300197,
234664,
275626,
234667,
316596,
308414,
234687,
300226,
308418,
226500,
234692,
300229,
308420,
283844,
283850,
300234,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
161003,
300267,
300270,
300272,
120053,
300278,
316663,
275703,
300284,
275710,
300287,
300289,
292097,
300292,
300294,
275719,
300299,
177419,
283917,
300301,
242957,
177424,
275725,
349464,
283939,
259367,
283951,
292143,
300344,
226617,
243003,
283963,
226628,
283973,
300357,
283983,
316758,
357722,
316766,
292192,
316768,
218464,
292197,
316774,
284010,
136562,
324978,
275834,
275836,
275840,
316803,
316806,
316811,
316814,
226703,
300433,
234899,
226709,
357783,
316824,
316826,
144796,
300448,
144807,
144810,
144812,
284076,
144814,
144820,
284084,
284087,
292279,
144826,
144828,
144830,
144832,
144835,
284099,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
226787,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
226802,
316917,
308727,
292343,
300537,
316947,
308757,
284191,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
284213,
284215,
194103,
284218,
226877,
284223,
284226,
243268,
292421,
226886,
284231,
128584,
284228,
284234,
276043,
317004,
366155,
284238,
226895,
284241,
194130,
284243,
276052,
284245,
276053,
284247,
317015,
284249,
243290,
284251,
300628,
284253,
235097,
284255,
300638,
284258,
292452,
292454,
284263,
284265,
292458,
284267,
292461,
284272,
284274,
276086,
284278,
292470,
292473,
284283,
276093,
284286,
276095,
284288,
292481,
284290,
325250,
284292,
276098,
292479,
292485,
284297,
317066,
284299,
317068,
276109,
284301,
284303,
276114,
284306,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
276137,
284329,
284331,
317098,
284333,
284335,
276144,
284337,
284339,
300726,
284343,
284346,
284350,
276160,
358080,
284354,
358083,
276166,
284358,
358089,
276170,
284362,
276175,
284368,
276177,
284370,
317138,
284372,
358098,
284377,
276187,
284379,
284381,
284384,
284386,
358114,
358116,
276197,
317158,
358119,
284392,
325353,
284394,
358122,
284397,
358126,
276206,
358128,
284399,
358133,
358135,
276216,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
300819,
317207,
284440,
186139,
300828,
300830,
276255,
325408,
284449,
300834,
300832,
317221,
227109,
358183,
276268,
300845,
194351,
243504,
300850,
284469,
276280,
325436,
276291,
366406,
276295,
153417,
276308,
284502,
317271,
276315,
292700,
284511,
227175,
292715,
300912,
284529,
292721,
300915,
292729,
317306,
284540,
292734,
325512,
276365,
284564,
358292,
284566,
350106,
284572,
276386,
284579,
276388,
358312,
284585,
317353,
276395,
292784,
358326,
161718,
276410,
276411,
358330,
276418,
301009,
301011,
301013,
292823,
301015,
301017,
358360,
292828,
276446,
153568,
276448,
276452,
276455,
292839,
292843,
276460,
276464,
178161,
227314,
276466,
276472,
317435,
276476,
276479,
276482,
276485,
317446,
276490,
292876,
276496,
317456,
317458,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
276528,
243762,
309298,
325685,
325689,
235579,
276539,
235581,
325692,
178238,
276544,
284739,
292934,
243785,
276553,
350293,
350295,
194649,
227418,
309337,
350302,
227423,
194654,
178273,
194657,
227426,
194660,
276579,
227430,
276583,
309346,
309348,
309350,
309352,
309354,
350308,
276590,
350313,
350316,
350321,
284786,
276595,
227440,
301167,
350325,
350328,
292985,
301178,
292989,
292993,
301185,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
276638,
350366,
284837,
350375,
350379,
350381,
350383,
129200,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
309450,
301258,
276685,
276689,
309462,
301272,
309468,
309471,
301283,
317672,
276713,
317674,
325867,
227571,
309491,
309494,
243960,
276735,
227583,
227587,
276739,
276742,
227593,
227596,
325910,
309530,
342298,
276766,
211232,
317729,
276775,
325937,
276789,
325943,
211260,
260421,
276809,
285002,
276811,
235853,
235858,
276829,
276833,
391523,
276836,
276843,
293227,
276848,
293232,
186744,
211324,
227709,
285061,
317833,
178572,
285070,
178575,
285077,
227738,
317853,
276896,
317858,
342434,
285093,
317864,
285098,
276907,
235955,
276917,
293304,
293307,
293314,
309707,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
227810,
293346,
276964,
293352,
236013,
293364,
301562,
317951,
309764,
301575,
121352,
236043,
342541,
113167,
317971,
309779,
309781,
277011,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
277054,
129603,
318020,
301636,
301639,
301643,
277071,
285265,
399955,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
121458,
277106,
170618,
170619,
309885,
309888,
277122,
227975,
277128,
285320,
301706,
318092,
326285,
318094,
334476,
277136,
277139,
227992,
285340,
318108,
227998,
318110,
137889,
383658,
285357,
318128,
277170,
342707,
154292,
277173,
293555,
318132,
285368,
277177,
277181,
277187,
277191,
277194,
277196,
277201,
137946,
113378,
228069,
277223,
342760,
285417,
56043,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
285453,
228113,
285459,
277273,
293659,
326430,
228128,
293666,
285474,
228135,
318248,
277291,
293677,
318253,
285489,
293685,
285494,
301880,
301884,
310080,
293696,
277314,
277317,
277322,
277329,
301911,
277337,
301913,
301921,
400236,
236397,
162671,
310134,
15224,
236408,
277368,
416639,
416640,
113538,
416648,
39817,
187274,
277385,
301972,
424853,
277405,
277411,
310179,
293798,
293802,
236460,
277426,
293811,
293820,
203715,
276586,
293849,
293861,
228327,
228328,
228330,
318442,
228332,
277486,
326638,
318450,
293876,
293877,
285686,
302073,
285690,
121850,
302075,
244731,
293882,
293887,
277504,
277507,
277511,
277519,
293908,
277526,
293917,
293939,
277561,
277564,
310336,
293956,
277573,
228422,
310344,
277577,
293960,
277583,
203857,
310355,
293971,
310359,
236632,
277594,
138332,
277598,
285792,
277601,
203872,
310374,
203879,
277608,
310376,
228460,
318573,
203886,
187509,
285815,
285817,
367737,
285821,
302205,
285824,
392326,
285831,
253064,
302218,
285835,
384148,
162964,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
277671,
302248,
64682,
277678,
228526,
294063,
294065,
302258,
277687,
294072,
318651,
294076,
277695,
318657,
244930,
302275,
130244,
302277,
228550,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
302296,
384222,
310498,
285927,
318698,
302315,
195822,
228592,
294132,
138485,
228601,
228606,
64768,
310531,
285958,
228617,
138505,
318742,
277798,
130345,
113964,
285997,
285999,
113969,
318773,
318776,
286010,
417086,
286016,
294211,
302403,
384328,
294221,
326991,
294223,
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,
64966,
245191,
163272,
302534,
310727,
292968,
302541,
302543,
310737,
228825,
163290,
310749,
310755,
187880,
310764,
286188,
310772,
40440,
212472,
40443,
286203,
40448,
228864,
286214,
228871,
302603,
65038,
302614,
286233,
302617,
302621,
146977,
187939,
294435,
286246,
294439,
286248,
278057,
294440,
294443,
40486,
294445,
40488,
310831,
40499,
40502,
212538,
40507,
40511,
228933,
40521,
286283,
40525,
40527,
212560,
228944,
400976,
147032,
40537,
40539,
278109,
40541,
40550,
286312,
286313,
40554,
40552,
310892,
40557,
294521,
343679,
278150,
310925,
286354,
278163,
122517,
278168,
327333,
229030,
278188,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
294601,
302793,
343757,
212690,
278227,
286420,
319187,
229076,
286425,
319194,
278235,
278238,
229086,
294625,
294634,
302838,
319226,
286460,
171774,
278274,
302852,
278277,
302854,
294664,
311048,
352008,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
278320,
319280,
319290,
229192,
302925,
188247,
237409,
294776,
294785,
327554,
40851,
294811,
319390,
294817,
319394,
40865,
311209,
180142,
294831,
188340,
40886,
294844,
294847,
393177,
294876,
294879,
294883,
311279,
278513,
237555,
278516,
311283,
278519,
237562
] |
95b1f4e07ac3a53fe75bc7ce6ce3512cfd220bbb | 64473f39f02e4ff47d999e6cdae8b0e0af1283e0 | /11-time-based-operators/RxSwiftPlayground/RxSwift.playground/Pages/window.xcplaygroundpage/Contents.swift | a1a4bcee907c745b97ba4b6d1b3d94d07362125b | [] | no_license | glebwell/RxSwift | 604a2db811b39b7735c262d115629ad535b4d0a8 | a6ee412010655f1cea248d4818bc8c2f01d2dcc1 | refs/heads/master | 2021-04-30T12:26:58.506911 | 2018-04-15T16:51:11 | 2018-04-15T16:51:11 | 121,274,757 | 3 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,363 | swift | //: Please build the scheme 'RxSwiftPlayground' first
import UIKit
import RxSwift
import RxCocoa
let elementsPerSecond = 1
let windowTimeSpan: RxTimeInterval = 5
let windowMaxCount = 5
let sourceObservable = PublishSubject<String>()
let sourceTimeline = TimelineView<String>.make()
let stack = UIStackView.makeVertical([
UILabel.makeTitle("window"),
UILabel.make("Emitted elements (\(elementsPerSecond) per sec.):"),
sourceTimeline,
UILabel.make("Windowed elements (at most \(windowMaxCount) every \(windowTimeSpan) seconds):")
])
let timer = DispatchSource.timer(interval: 1.0 / Double(elementsPerSecond), queue: .main) {
sourceObservable.onNext("🐱")
}
_ = sourceObservable.subscribe(sourceTimeline)
let windowedObservable = sourceObservable.window(timeSpan: windowTimeSpan, count: windowMaxCount, scheduler: MainScheduler.instance)
let timelineObservable = windowedObservable
.do(onNext: { _ in
let timeline = TimelineView<Int>.make()
stack.insert(timeline, at: 4)
stack.keep(atMost: 8)
})
.map { _ in
stack.arrangedSubviews[4] as! TimelineView<Int>
}
_ = Observable.zip(windowedObservable, timelineObservable) { obs, timeline in
return (obs, timeline)
}
.flatMap { tuple -> Observable<(TimelineView<Int>, String?)> in
let obs = tuple.0
let timeline = tuple.1
return obs
.map { value in (timeline, value) }
.concat(Observable.just((timeline, nil)))
}
.subscribe(onNext: { tuple in
let (timeline, value) = tuple
if let value = value {
timeline.add(.Next(value))
} else {
timeline.add(.Completed(true))
}
})
let hostView = setupHostView()
hostView.addSubview(stack)
// Support code -- DO NOT REMOVE
class TimelineView<E>: TimelineViewBase, ObserverType where E: CustomStringConvertible {
static func make() -> TimelineView<E> {
let view = TimelineView(frame: CGRect(x: 0, y: 0, width: 400, height: 100))
view.setup()
return view
}
public func on(_ event: Event<E>) {
switch event {
case .next(let value):
add(.Next(String(describing: value)))
case .completed:
add(.Completed())
case .error(_):
add(.Error())
}
}
}
/*:
Copyright (c) 2014-2016 Razeware LLC
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
/*:
Copyright (c) 2014-2016 Razeware LLC
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
| [
-1
] |
c43003dc04de13fe538df10a09e69e3ee5903bb6 | 8b90764f895c3fe2eb9bc551db2c514c261a3429 | /Modulator/NRZIDecoder.swift | a63f64d88b97678c31c62bd84622a526a5ea3896 | [
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | aprspi/FreeAPRS | 9206615f5873ccb549d550df3291d588006d4185 | ce84199d6119babc5facea745ba7c668bfbb92d1 | refs/heads/master | 2021-01-17T17:39:36.565877 | 2017-01-09T23:36:55 | 2017-01-09T23:36:55 | 95,525,810 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 526 | swift | //
// NRZIDecoder.swift
// Modulator
//
// Created by James on 10/24/16.
// Copyright © 2016 dimnsionofsound. All rights reserved.
//
import Foundation
class NRZIDecoder {
var lastSample : Bool
init() {
lastSample = true;
}
func decode(input: [Bool]) -> [Bool] {
var output = [Bool](repeating: false, count: input.count)
for i in 0..<input.count {
output[i] = input[i] == lastSample
lastSample = input[i]
}
return output
}
}
| [
-1
] |
5f4ae8f1ec79333625e8023c3b074aa98e5f56e1 | a922e58f06c5cd9e618c31b303979292729ab6f7 | /HackDavis/ViewController.swift | 61c31b6c18abbda1baa7eb69d80a21310e687815 | [] | no_license | MelissaAppel/HackDavis-2021 | 88bf5238999d7dce52de2aa9ec60282993d4fa5c | 0487bcb3b92c3c41c4bd7e59c40091fb731eaeb3 | refs/heads/main | 2023-02-22T15:00:04.412546 | 2021-01-25T21:40:40 | 2021-01-25T21:40:40 | 330,201,551 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 297 | swift | //
// ViewController.swift
// HackDavis
//
// Created by Melissa Appel on 1/16/21.
//
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
func test2() {}
}
| [
254464,
253058,
327555,
398203,
356742,
384145,
391441,
409238,
375576,
384153,
399130,
258589,
254494,
155551,
155424,
187937,
345378,
436128,
254497,
254495,
397091,
351400,
384300,
356652,
380334,
366385,
319284,
383797,
396725,
402616,
397114,
378171,
111292,
384447,
266816,
360903,
359368,
437582,
330960,
146645,
257750,
399958,
402524,
362845,
412766,
399201,
418146,
332513,
257638,
384103,
257641,
257642,
374122,
352876,
376687,
349297,
210674,
320506,
361595
] |
1defe08ab4728c3e601bf13fa7ce34a62c5c568f | 8bc4988e9db7ec4fed1c6f99c9afff93c6cb5444 | /AutoLayoutPractice/ViewController.swift | bdd5f8036821d88e90852d1c3073c7426340fa78 | [] | no_license | lane-faison/AutoLayoutPractice | 8c2cac9099911cf73f84d14a79d4e4405850a7b1 | da0ff7402fbb0d272015fc7f141eb43ab0ab45fa | refs/heads/master | 2020-12-02T11:22:41.457104 | 2017-07-09T17:56:38 | 2017-07-09T17:56:38 | 96,632,962 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 514 | swift | //
// ViewController.swift
// AutoLayoutPractice
//
// Created by Lane Faison on 7/8/17.
// Copyright © 2017 Lane Faison. 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.
}
}
| [
278543,
309264,
286775,
288827,
286796,
278606,
237655,
307288,
200802,
307311,
292990,
278657,
276612,
280710,
303242,
311437,
278675,
278686,
278693,
100521,
307379,
280760,
280770,
227523,
280772,
280775,
276686,
229585,
307410,
280790,
280797,
278752,
280808,
286963,
280821,
286965,
280824,
280826,
280832,
278791,
287005,
287007,
282917,
233767,
282922,
282926,
307516,
289088,
227688,
313706,
299374,
199024,
276849,
278897,
313733,
285087,
289187,
305582,
278968,
293308,
278973,
281078,
233980,
287231,
279041,
279046,
215562,
281107,
279064,
281118,
295460,
289318,
309807,
279096,
234043,
277057,
129604,
301637,
158285,
281202,
277108,
281205,
281218,
281221,
227984,
303760,
117399,
228000,
287399,
277171,
277180,
285377,
226009,
234223,
312049,
226038,
234232,
230147,
226055,
299786,
295711,
228127,
281380,
152356,
283433,
289578,
312107,
293682,
285495,
289596,
283453,
289600,
279360,
293700,
283461,
279380,
295766,
279386,
308064,
162672,
207738,
303998,
183173,
304008,
324491,
304012,
304015,
275358,
277406,
289697,
234402,
283556,
277420,
277422,
297903,
324528,
230323,
277429,
277430,
234423,
277432,
277433,
277434,
291774,
295874,
299973,
234465,
168936,
183278,
277512,
275466,
197677,
304174,
300086,
234551,
300089,
238653,
293961,
300116,
281703,
296042,
164974,
300149,
234619,
226447,
234641,
349332,
226454,
226455,
226456,
226458,
285855,
283839,
277696,
228551,
279751,
279754,
230604,
298189,
302286,
290004,
290006,
189655,
302295,
298202,
298204,
298207,
290016,
363743,
298211,
290020,
228585,
120054,
333048,
312586,
130346,
113972,
234829,
306540,
216433,
290166,
333179,
290175,
275842,
224643,
300432,
310673,
226705,
288165,
279982,
286126,
277935,
282035,
292277,
296374,
130487,
306633,
286158,
280015,
310734,
163289,
280029,
286175,
286189,
282095,
308721,
296436,
292341,
292344,
290299,
286204,
290303,
286234,
284197,
296487,
286249,
296489,
226878,
288321,
226887,
288332,
226896,
212561,
284242,
292435,
300629,
276054,
40545,
284261,
306791,
286314,
284275,
284276,
284277,
294518,
314996,
276087,
292478,
284287,
284289,
284293,
284298,
278157,
280219,
282270,
284323,
282275,
284328,
313007,
284336,
284341,
286390,
300727,
282301,
302788,
282311,
284361,
282320,
284373,
282329,
282338,
284391,
282346,
358127,
288501,
282357,
358139,
282365,
286462,
282368,
358147,
282377,
300817,
282389,
282393,
278298,
329499,
315170,
282403,
315177,
282411,
159541,
282426,
288579,
298830,
307029,
298843,
241499,
200549,
292730,
284580,
284586,
276396,
298951,
165832,
301016,
294889,
298989,
231405,
227315,
237556
] |
3b4a6730270f799229de8f76ce53c4d7653a0466 | 811507f7f0ea38a0888e3282d0e25d059f69771f | /RxMemo/Pods/RxSwift/RxSwift/Observables/SkipWhile.swift | 19c96775725386b27849909df556de8956e28e44 | [
"MIT"
] | permissive | applebuddy/RxMVVMStudy | a5c5848d28aff7f5d60fb5e7dbf264fbc6c9d310 | 343c264ef11a933e44dea256f4cf99e5afec2ecb | refs/heads/master | 2020-09-01T18:17:44.574598 | 2020-08-23T13:01:23 | 2020-08-23T13:01:23 | 219,024,764 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,551 | swift | //
// SkipWhile.swift
// RxSwift
//
// Created by Yury Korolev on 10/9/15.
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//
extension ObservableType {
/**
Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements.
- seealso: [skipWhile operator on reactivex.io](http://reactivex.io/documentation/operators/skipwhile.html)
- parameter predicate: A function to test each element for a condition.
- returns: An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate.
*/
public func skipWhile(_ predicate: @escaping (Element) throws -> Bool) -> Observable<Element> {
return SkipWhile(source: asObservable(), predicate: predicate)
}
}
private final class SkipWhileSink<Observer: ObserverType>: Sink<Observer>, ObserverType {
typealias Element = Observer.Element
typealias Parent = SkipWhile<Element>
fileprivate let _parent: Parent
fileprivate var _running = false
init(parent: Parent, observer: Observer, cancel: Cancelable) {
_parent = parent
super.init(observer: observer, cancel: cancel)
}
func on(_ event: Event<Element>) {
switch event {
case let .next(value):
if !_running {
do {
_running = try !_parent._predicate(value)
} catch let e {
self.forwardOn(.error(e))
self.dispose()
return
}
}
if _running {
forwardOn(.next(value))
}
case .error, .completed:
forwardOn(event)
dispose()
}
}
}
private final class SkipWhile<Element>: Producer<Element> {
typealias Predicate = (Element) throws -> Bool
fileprivate let _source: Observable<Element>
fileprivate let _predicate: Predicate
init(source: Observable<Element>, predicate: @escaping Predicate) {
_source = source
_predicate = predicate
}
override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {
let sink = SkipWhileSink(parent: self, observer: observer, cancel: cancel)
let subscription = _source.subscribe(sink)
return (sink: sink, subscription: subscription)
}
}
| [
124895,
112307,
15639,
124639
] |
462292c3d20ac13030eded9b167fac13cc5976ba | 5c3160b4c7c0f3ff017c0b0a74a00ea3b4b9b1c1 | /Frameworks/UiTestsFoundation/Sources/Utils/ElementVisibilityChecker/ElementVisibilityCheckerImpl.swift | 7d5393d88ee3910710aea59e9a189bb7cfb17d03 | [
"MIT"
] | permissive | avito-tech/Mixbox | 65db96299286dd0b77cd6cca29f252b72d6a8049 | 25e0e91fde1d403479aefc355e434ddff0dbaf0a | refs/heads/master | 2023-07-09T16:50:28.958629 | 2023-07-07T07:42:13 | 2023-07-07T07:42:13 | 142,596,513 | 141 | 30 | MIT | 2022-07-20T10:10:12 | 2018-07-27T15:49:50 | Swift | UTF-8 | Swift | false | false | 4,503 | swift | import MixboxIpcCommon
import MixboxIpc
import MixboxUiKit
import MixboxFoundation
public final class ElementVisibilityCheckerImpl: ElementVisibilityChecker {
private let ipcClient: SynchronousIpcClient
public init(ipcClient: SynchronousIpcClient) {
self.ipcClient = ipcClient
}
// MARK: - ElementVisibilityChecker
public func checkVisibility(
snapshot: ElementSnapshot,
interactionCoordinates: InteractionCoordinates?,
useHundredPercentAccuracy: Bool)
throws
-> ElementVisibilityCheckerResult
{
if let isDefinitelyHidden = snapshot.isDefinitelyHidden.valueIfAvailable, isDefinitelyHidden {
return definitelyHiddenResult()
}
var parentPointer = snapshot.parent
var lastParent = snapshot.parent
while let parent = parentPointer {
lastParent = parent
parentPointer = parent.parent
}
if let topSnapshotFrame = lastParent?.frameRelativeToScreen {
if !topSnapshotFrame.intersects(snapshot.frameRelativeToScreen) {
return definitelyHiddenResult()
}
}
if snapshot.frameRelativeToScreen.mb_hasZeroArea() {
return definitelyHiddenResult()
}
if let elementUniqueIdentifier = snapshot.uniqueIdentifier.valueIfAvailable {
return try callIpcClient(
elementUniqueIdentifier: elementUniqueIdentifier,
interactionCoordinates: interactionCoordinates,
useHundredPercentAccuracy: useHundredPercentAccuracy
)
} else {
// Visibility check is not available for this element (e.g.: not a view or it is an element in
// a third-party app / without MixboxInAppServices). Because we can't tell if the element is
// hidden, we can say that it is visible, and it is the only case when we return this result,
// it has to be at least one case.
return canBeVisibleResult()
}
}
public func checkVisibility(
elementUniqueIdentifier: String,
interactionCoordinates: InteractionCoordinates?,
useHundredPercentAccuracy: Bool)
throws
-> ElementVisibilityCheckerResult
{
return try callIpcClient(
elementUniqueIdentifier: elementUniqueIdentifier,
interactionCoordinates: interactionCoordinates,
useHundredPercentAccuracy: useHundredPercentAccuracy
)
}
// MARK: - Private
private func definitelyHiddenResult() -> ElementVisibilityCheckerResult {
return ElementVisibilityCheckerResult(
percentageOfVisibleArea: 0,
visibilePointOnScreenClosestToInteractionCoordinates: nil
)
}
private func canBeVisibleResult() -> ElementVisibilityCheckerResult {
return ElementVisibilityCheckerResult(
percentageOfVisibleArea: 1,
visibilePointOnScreenClosestToInteractionCoordinates: nil
)
}
private func callIpcClient(
elementUniqueIdentifier: String,
interactionCoordinates: InteractionCoordinates?,
useHundredPercentAccuracy: Bool)
throws
-> ElementVisibilityCheckerResult
{
let result = try ipcClient.callOrThrow(
method: CheckVisibilityIpcMethod(),
arguments: CheckVisibilityIpcMethod.Arguments(
elementUniqueIdentifier: elementUniqueIdentifier,
interactionCoordinates: interactionCoordinates,
useHundredPercentAccuracy: useHundredPercentAccuracy
)
)
switch result {
case .view(let result):
return ElementVisibilityCheckerResult(
percentageOfVisibleArea: result.percentageOfVisibleArea,
visibilePointOnScreenClosestToInteractionCoordinates: result.visibilePointOnScreenClosestToInteractionCoordinates
)
case .nonView(let result):
return ElementVisibilityCheckerResult(
percentageOfVisibleArea: result.percentageOfVisibleArea,
// TODO (non-view elements): return an information that the element is not a view instead of returnin nil here?
visibilePointOnScreenClosestToInteractionCoordinates: nil
)
case .error(let error):
throw error
}
}
}
| [
-1
] |
93766eb54b3d48ed5e011fd7e9c72b9ecf318f95 | 71e0b6a97fb620720c65328b1272ae420d5dbca0 | /EBOOKAPP/ViewControllers/ViewController.swift | 63db9b65c1649dfb47dac8de254aa6d8b02eb13c | [] | no_license | cemsertkaya/EBook-Firebase-Read-In_App_Purchase | 6a1d781b05e0648a0cc3a3581c0b5435525d9d1a | 191096e8bdce166d3c10f071cc81f83bc26d7cb7 | refs/heads/master | 2023-03-21T05:32:20.363857 | 2021-03-08T21:57:23 | 2021-03-08T21:57:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,404 | swift | //
// ViewController.swift
// EBOOKAPP
//
// Created by Cem Sertkaya on 28.01.2021.
//
import UIKit
import Firebase
class ViewController: UIViewController {
@IBOutlet weak var loginButton: UIButton!
@IBOutlet weak var registerButton: UIButton!
var timer: Timer?
override func viewDidLoad()
{
super.viewDidLoad()
//Button customizations
registerButton.layer.borderWidth = 2
registerButton.layer.borderColor = UIColor.white.cgColor
loginButton.layer.borderWidth = 2
loginButton.layer.borderColor = UIColor.white.cgColor
let status = Reach().connectionStatus()
switch status
{
case .unknown, .offline:
print("Not connected")
makeAlert(titleInput: "Aoo!", messageInput: "There is no internet connection for login please activate your internet connection.")
timer = Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true) { (timer) in
let status = Reach().connectionStatus()
switch status {
case .unknown, .offline:
print("Not connected")
case .online(.wwan), .online(.wiFi):
print("Connected")
let currentUser = Auth.auth().currentUser
print("Core Data User Sayısı")
print(CoreDataUtil.numberOfCoreUser())
if currentUser != nil
{
if CoreDataUtil.getCurrentUser().getIsActive() //if it has been logined
{
self.performSegue(withIdentifier: "toZero", sender: self)
}
else//logout yap
{
do
{
try Auth.auth().signOut()
CoreDataUtil.removeUserFromCoreData()
print("There is auth but stay active is closed.")
}
catch{print("error")}
}
}
else
{
print("There is no auth.")
self.loginButton.isEnabled = true
self.registerButton.isEnabled = true
}
}
}
case .online(.wwan):
print("Connected via WWAN")
case .online(.wiFi):
print("Connected via WiFi")
}
}
override func viewWillDisappear(_ animated: Bool)
{
super.viewWillDisappear(animated)
if timer != nil
{
timer?.invalidate()
timer = nil
}
}
func makeAlert(titleInput:String, messageInput:String)//Error method with parameters
{
let alert = UIAlertController(title: titleInput, message: messageInput, preferredStyle: UIAlertController.Style.alert)
let okButton = UIAlertAction(title: "OK", style: UIAlertAction.Style.default, handler: nil)
alert.addAction(okButton)
self.present(alert, animated:true, completion: nil)
}
@IBAction func loginButtonClicked(_ sender: Any)
{
let status = Reach().connectionStatus()
switch status
{
case .unknown, .offline:
makeAlert(titleInput: "Aooo!", messageInput: "There is no internet connection for login please activate your internet connection.")
case .online(.wwan), .online(.wiFi):
self.performSegue(withIdentifier: "toLogin", sender: self)
}
}
@IBAction func registerButtonClicked(_ sender: Any)
{
let status = Reach().connectionStatus()
switch status
{
case .unknown, .offline:
print("Not connected")
makeAlert(titleInput: "Aooo!", messageInput: "There is no internet connection for register please activate your internet connection.")
case .online(.wwan), .online(.wiFi):
self.performSegue(withIdentifier: "toRegister", sender: self)
}
}
}
| [
-1
] |
a873e94417ee289cacc65fba24411e2dd1b8db7b | 58b05f1f98ea5aa8ff0791238e2756b9b82659ac | /Demo/Demo/TitleView.swift | ec2d7a8b5e6ece27ca47335a04ef8755c6ad9b89 | [
"MIT"
] | permissive | heron-newland/LinkedScroll | 4169c000ef2bfc92dbd9a0da2aa63562e6034fd1 | 9aa32a1b8f8b66144428f77dac011a3cc14226d0 | refs/heads/master | 2021-05-14T13:52:09.028595 | 2018-11-14T08:20:05 | 2018-11-14T08:20:05 | 115,959,198 | 3 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,399 | swift | //
// TitleView.swift
// Demo
//
// Created by bochb on 2017/12/21.
// Copyright © 2017年 com.heron. All rights reserved.
//
import UIKit
class TitleView: HLLTitleView {
lazy var right:UIView = {
let r = UIView()
r.layer.cornerRadius = 5
r.isHidden = true
r.backgroundColor = UIColor.red
return r
}()
var isMarkHidden = true {
didSet{
markView.isHidden = isMarkHidden
}
}
override init(frame: CGRect) {
super.init(frame: frame)
markView = right
addSubview(markView)
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func layoutSubviews() {
super.layoutSubviews()
label.bounds = CGRect(x: 0, y: 0, width: bounds.width * 0.8, height: bounds.height * 0.8)
//不要使用, 这个center是相对于父视图中心坐标,我们要找的点是相对于本视图的中心点坐标
// label.center = center
label.center = CGPoint(x: bounds.width * 0.5, y: bounds.height * 0.5)
markView.frame = CGRect(x: label.frame.maxX - 10, y: label.frame.minY, width: 10, height: 10)
}
override func copy(with zone: NSZone? = nil) -> Any {
let copy = super.copy(with: zone) as! HLLTitleView
return copy
}
}
| [
-1
] |
94e49839ffe729ec322129634086282913207e02 | e79543d4cd72de0efcfa69c6a3cd0d00e9cafba5 | /LocalPods/FOLDin/FOLDin/Classes/Core/FDBarButtonItem.swift | 0dbce58a4b43661ac70330a5ba34cd3dc08c99c7 | [
"MIT"
] | permissive | lxngoddess5321/U17-1 | 7a265171fc4393b6fb2a261659023f2cadc4fba8 | e437aa213d6874fc7f1b7aa6bc31c5a1cbc84a5a | refs/heads/master | 2021-10-25T05:04:27.391561 | 2019-04-01T13:51:40 | 2019-04-01T13:51:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 8,000 | swift | //
// FDBarButtonItem.swift
// FOLDin
//
// Created by Archer on 2018/12/10.
//
import UIKit
@objc protocol FDBarButtonItemDelegate: NSObjectProtocol {
func barButtonItemDidChange(_ item: FDBarButtonItem)
}
/// A wrapper around `UIButton`.
/// NOTE: 如果是customView,那它必须正确实现
/// intrinsicContentSize或者给定frame.size
@objcMembers
public class FDBarButtonItem: NSObject {
/// 在navigationItem.leftBarButtonItems/navigationItem.rightBarButtonItems
/// 的count大于1时,当前barButtonItem相对于前一个的边距.
/// 如果只有leftBarButtonItems/rightBarButtonItems只有一个,那么设置这个属性是没有
/// 用的,可以使用navigationBar.contentInsets来设置
public var margin: CGFloat = 12.0 {
didSet {
if margin != oldValue {
delegate?.barButtonItemDidChange(self)
}
}
}
// default is system font of size 15
// NOTE: priority is low than titleTextAttributes
public var font: UIFont? {
get { return buttonView.titleLabel?.font }
set {
if font != newValue {
buttonView.titleLabel?.font = newValue
delegate?.barButtonItemDidChange(self)
}
}
}
// default is black
// NOTE: priority is low than titleTextAttributes
public var textColor: UIColor? {
get { return buttonView.titleColor(for: .normal) }
set {
if textColor != newValue {
buttonView.setTitleColor(newValue, for: .normal)
delegate?.barButtonItemDidChange(self)
}
}
}
// default is nil
public var title: String? {
get { return buttonView.title(for: .normal) }
set {
if title != newValue {
buttonView.setTitle(newValue, for: .normal)
if let title = newValue {
for (rawValue, attributes) in titleTextAttributes {
buttonView.setAttributedTitle(NSAttributedString(string: title, attributes: attributes),
for: UIControl.State(rawValue: rawValue))
}
}
delegate?.barButtonItemDidChange(self)
}
}
}
// default is nil
public var image: UIImage? {
get { return buttonView.image(for: .normal) }
set {
if image != newValue {
buttonView.setImage(newValue, for: .normal)
delegate?.barButtonItemDidChange(self)
}
}
}
// default is NULL
public var action: Selector?
// default is nil
public weak var target: AnyObject?
// default is nil
public var tintColor: UIColor? {
get { return buttonView.tintColor }
set { buttonView.tintColor = newValue }
}
// default is YES
public var isEnabled: Bool {
get { return buttonView.isEnabled }
set { buttonView.isEnabled = newValue }
}
// default is UIEdgeInsetsZero
public var imageInsets: UIEdgeInsets {
get { return buttonView.imageEdgeInsets }
set {
buttonView.imageEdgeInsets = newValue
delegate?.barButtonItemDidChange(self)
}
}
// default is UIEdgeInsetsZero
public var titleInsets: UIEdgeInsets {
get { return buttonView.titleEdgeInsets }
set {
buttonView.titleEdgeInsets = newValue
delegate?.barButtonItemDidChange(self)
}
}
// default is nil
// NOTE: If you use custom view, you should
// control it all by your self, properties and
// functions in this class are not support customView.
public private(set) var customView: UIView?
public init(title: String? = nil,
image: UIImage? = nil,
target: AnyObject? = nil,
action: Selector? = nil) {
super.init()
self.title = title
self.image = image
self.target = target
self.action = action
}
public convenience init(title: String?,
target: AnyObject? = nil,
action: Selector? = nil) {
self.init(title: title, image: nil, target: target, action: action)
}
public convenience init(image: UIImage?,
target: AnyObject? = nil,
action: Selector? = nil) {
self.init(title: nil, image: image, target: target, action: action)
}
public init(customView: UIView) {
super.init()
self.customView = customView
}
// MARK: Appearance modifiers
/// In general, you should specify a value for the normal state
/// to be used by other states which don't have a custom value set.
public func setBackgroundImage(_ backgroundImage: UIImage?, for state: UIControl.State) {
if state == .normal ||
state == .disabled ||
state == .highlighted {
buttonView.setBackgroundImage(backgroundImage, for: state)
} else {
// Similar to UIKit's implementation
buttonView.setBackgroundImage(backgroundImage, for: .highlighted)
}
}
public func backgroundImage(for state: UIControl.State) -> UIImage? {
if state == .normal ||
state == .disabled ||
state == .highlighted {
return buttonView.backgroundImage(for: state)
} else {
// Similar to UIKit's implementation
return buttonView.backgroundImage(for: .highlighted)
}
}
/// You may specify the font, text color, and shadow properties
/// for the title in the text attributes dictionary, using the keys
/// found in NSAttributedString.h.
private lazy var titleTextAttributes = [UIControl.State.RawValue : [NSAttributedString.Key : Any]]()
public func setTitleTextAttributes(_ attributes: [NSAttributedString.Key : Any]?, for state: UIControl.State) {
if state == .normal ||
state == .disabled ||
state == .highlighted {
titleTextAttributes[state.rawValue] = attributes
if let title = title {
buttonView.setAttributedTitle(NSAttributedString(string: title, attributes: attributes), for: state)
delegate?.barButtonItemDidChange(self)
}
} else {
// Similar to UIKit's implementation
titleTextAttributes[UIControl.State.highlighted.rawValue] = attributes
if let title = title {
buttonView.setAttributedTitle(NSAttributedString(string: title, attributes: attributes), for: .highlighted)
delegate?.barButtonItemDidChange(self)
}
}
}
public func titleTextAttributes(for state: UIControl.State) -> [NSAttributedString.Key : Any]? {
if state == .normal ||
state == .disabled ||
state == .highlighted {
return titleTextAttributes[state.rawValue]
} else {
// Similar to UIKit's implementation
return titleTextAttributes[UIControl.State.highlighted.rawValue]
}
}
/// Internal use only
weak var delegate: FDBarButtonItemDelegate?
lazy var buttonView: UIButton = {
let v = UIButton()
v.setTitleColor(.black, for: .normal)
v.titleLabel?.font = .systemFont(ofSize: 15)
v.addTarget(self, action: #selector(_sendAction(_:)), for: .touchUpInside)
return v
}()
}
extension FDBarButtonItem {
@objc func _sendAction(_ sender: UIButton) {
if let target = target, let action = action {
_ = target.perform(action)
} else {
debugPrint("WRANING: Missing `target` or `action`, please take a look.")
}
}
}
| [
-1
] |
38c2f321fd412553db4b57d51ace6800c8beeae9 | 18542743303a685bd2dbb2c597e5a5c4f870fb58 | /OnTheMap/UdacityAccount.swift | ef44c7b2e69694ac110764d7b66e418cae86f805 | [] | no_license | mkazachkov/OnTheMap | c68ab2c2b2e177a24dffa898da4652357da0749b | a422a072e56d521aea7736789128a5a87747edd6 | refs/heads/main | 2023-01-24T19:22:28.593943 | 2020-12-01T20:39:37 | 2020-12-01T20:39:37 | 303,799,005 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 236 | swift | //
// UdacityAccount.swift
// OnTheMap
//
// Created by Mikhail on 9/27/20.
// Copyright © 2020 112358dev. All rights reserved.
//
import Foundation
struct UdacityAccount: Codable {
let registered: Bool
let key: String
}
| [
-1
] |
48111d806577a7a6567e7b954844deccef1fa8b7 | 7611682bc887a002d8a4ae7df45bc1b5df5c8d66 | /GoodIdeasStudio-InstagramClone/View/SimpleCell.swift | bebe31fb8617c07ef3046a57f7f621b975d99431 | [] | no_license | aa08666/GoodIdeasStudio-InstagramClone | 73f85664fc162ed63f59a6e55ebe0645dc8e06e5 | 696cf239a4d3845de61d02e729e796f8c3c79ab1 | refs/heads/master | 2020-06-08T14:24:55.362174 | 2019-08-04T12:35:53 | 2019-08-04T12:35:53 | 193,243,807 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 504 | swift | //
// SimpleCell.swift
// GoodIdeasStudio-InstagramClone
//
// Created by 林柏呈 on 2019/8/2.
// Copyright © 2019 Jerry. All rights reserved.
//
import UIKit
protocol SimpleCellDelegate {
func selected()
}
class SimpleCell: UICollectionViewCell {
@IBOutlet weak var image: UIImageView!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
func updateCell(_ image: UIImage) {
self.image.image = image
}
}
| [
-1
] |
71f1319c57de11d1ced3b45b47d3206eda027959 | 43dc70f577165f3f423011210b8d0fa31f25ba0b | /Sources/URI/Component.swift | 403a47d5bbbc26336e82e50607aec6280845fd85 | [
"MIT"
] | permissive | my-mail-ru/swift-URI | 8fa156a9b04fd1db0c1d99c5f4fb873a11294d53 | 04e825dd9b8b2d63d67da4a163a4c3c1da97cb04 | refs/heads/master | 2021-06-30T15:31:11.214219 | 2017-09-21T16:45:24 | 2017-09-21T16:45:24 | 104,366,375 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 996 | swift | protocol _URIComponent : CustomStringConvertible {
init(_valid: String, isNormalized: Bool)
}
enum URIComponentStorage<T : _URIComponent> {
case inplace(Substring, isNormalized: Bool)
case outside(T)
var value: T {
mutating get {
switch self {
case .inplace(let substring, let isNormalized):
let value = T.init(_valid: String(substring), isNormalized: isNormalized)
self = .outside(value)
return value
case .outside(let value):
return value
}
}
}
var substring: Substring {
switch self {
case .inplace(let substring, _):
return substring
case .outside(let value):
return Substring(value.description)
}
}
}
enum URICompositeStorage {
case inplace(Substring)
case outside(String)
var substring: Substring {
switch self {
case .inplace(let s): return s
case .outside(let s): return s[...]
}
}
var string: String {
switch self {
case .inplace(let s): return String(s)
case .outside(let s): return s
}
}
}
| [
-1
] |
09d7fa8a73bb32cad8b73f867aae6b562a037b43 | b61ac2cace2446be9bb8fc6ae0a2b915e40ec313 | /Pokemon/AppDelegate.swift | c8fe878e4f2dfaa1a4bab941c7882f0332c2a4e7 | [] | no_license | buo2107/Pokemon | b605e627077005bae32bf645d8985de72fd7992a | 999f7df5ab6bc716056b42d8edb0831f800bd486 | refs/heads/master | 2020-04-10T04:14:04.639437 | 2019-01-03T09:27:30 | 2019-01-03T09:27:30 | 160,792,177 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,178 | swift | //
// AppDelegate.swift
// Prepare
//
// Created by SHIH-YING PAN on 2018/12/5.
// Copyright © 2018 SHIH-YING PAN. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
| [
229380,
229383,
229385,
278539,
294924,
229388,
278542,
229391,
327695,
278545,
229394,
278548,
229397,
229399,
229402,
352284,
229405,
278556,
278559,
229408,
278564,
294950,
229415,
229417,
327722,
237613,
229422,
360496,
229426,
237618,
229428,
311349,
286774,
286776,
319544,
286778,
204856,
229432,
286791,
237640,
286797,
278605,
311375,
163920,
237646,
196692,
319573,
311383,
278623,
278626,
319590,
311400,
278635,
303212,
278639,
131192,
278648,
237693,
303230,
327814,
303241,
131209,
417930,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
131264,
286916,
295110,
286922,
286924,
286926,
319694,
286928,
131281,
278743,
278747,
295133,
155872,
319716,
237807,
303345,
286962,
303347,
131314,
229622,
327930,
278781,
278783,
278785,
237826,
319751,
278792,
286987,
319757,
311569,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
295220,
287032,
155966,
319809,
319810,
278849,
319814,
311623,
319818,
311628,
229709,
319822,
287054,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
319879,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
278980,
98756,
278983,
319945,
278986,
319947,
278990,
278994,
311767,
279003,
279006,
188895,
172512,
287202,
279010,
279015,
172520,
319978,
279020,
172526,
311791,
279023,
172529,
279027,
319989,
172534,
180727,
164343,
279035,
311804,
287230,
279040,
303617,
287234,
279045,
172550,
303623,
172552,
320007,
287238,
279051,
172558,
279055,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
279082,
311850,
279084,
172591,
172598,
279095,
172607,
172609,
172612,
377413,
172614,
213575,
172618,
303690,
33357,
287309,
303696,
279124,
172634,
262752,
172644,
311911,
189034,
295533,
172655,
172656,
352880,
295538,
189039,
172660,
287349,
189040,
189044,
287355,
287360,
295553,
172675,
295557,
311942,
303751,
287365,
352905,
311946,
279178,
287371,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
172702,
287390,
303773,
172705,
287394,
172707,
303780,
164509,
287398,
205479,
279208,
287400,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
328384,
172737,
279231,
287427,
312005,
312006,
107208,
172748,
287436,
107212,
172751,
287440,
295633,
172755,
303827,
279255,
172760,
287450,
303835,
279258,
189149,
303838,
213724,
312035,
279267,
295654,
279272,
230128,
312048,
312050,
230131,
205564,
303871,
230146,
328453,
295685,
230154,
33548,
312077,
295695,
295701,
230169,
369433,
295707,
328476,
295710,
230175,
295720,
303914,
279340,
205613,
279353,
230202,
312124,
328508,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
279390,
230241,
279394,
303976,
336744,
303981,
303985,
303987,
328563,
279413,
303991,
303997,
295806,
295808,
295813,
304005,
320391,
304007,
213895,
304009,
304011,
230284,
304013,
295822,
279438,
213902,
189329,
295825,
304019,
189331,
58262,
304023,
304027,
279452,
410526,
279461,
279462,
304042,
213931,
230327,
304055,
287675,
197564,
230334,
304063,
238528,
304065,
213954,
189378,
156612,
295873,
213963,
197580,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
312321,
295945,
230413,
295949,
197645,
320528,
140312,
295961,
238620,
197663,
304164,
304170,
304175,
238641,
312374,
238652,
238655,
230465,
238658,
336964,
132165,
296004,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
205931,
296044,
279661,
205934,
164973,
312432,
279669,
337018,
189562,
279679,
304258,
279683,
222340,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
238766,
165038,
230576,
238770,
304311,
230592,
312518,
279750,
230600,
230607,
148690,
320727,
279769,
304348,
279777,
304354,
296163,
320740,
279781,
304360,
320748,
279788,
279790,
304370,
296189,
320771,
312585,
296202,
296205,
230674,
320786,
230677,
296213,
296215,
320792,
230681,
230679,
214294,
304416,
230689,
173350,
312622,
296243,
312630,
222522,
296253,
222525,
296255,
312639,
230718,
296259,
378181,
296262,
230727,
238919,
296264,
320840,
296267,
296271,
222545,
230739,
312663,
222556,
337244,
230752,
312676,
230760,
173418,
148843,
410987,
230763,
230768,
296305,
312692,
230773,
304505,
304506,
181626,
279929,
181631,
148865,
312711,
312712,
296331,
288140,
288144,
230800,
304533,
337306,
288154,
288160,
173472,
288162,
288164,
279975,
304555,
370092,
279983,
173488,
288176,
279985,
312755,
296373,
312759,
337335,
288185,
279991,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
288210,
370130,
288212,
222676,
148946,
288214,
239064,
329177,
288217,
280027,
288220,
288218,
239070,
288224,
280034,
288226,
280036,
288229,
280038,
288230,
288232,
370146,
288234,
320998,
288236,
288238,
288240,
288242,
296435,
288244,
288250,
296446,
321022,
402942,
148990,
296450,
206336,
230916,
230919,
214535,
230923,
304651,
304653,
370187,
230940,
222752,
108066,
296486,
296488,
157229,
239152,
230961,
157236,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
288344,
280152,
239194,
280158,
403039,
370272,
181854,
239202,
312938,
280183,
280185,
280188,
280191,
116354,
280194,
280208,
280211,
288408,
280218,
280222,
190118,
198310,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
313027,
280260,
206536,
280264,
206539,
206541,
206543,
313044,
280276,
321239,
280283,
313052,
18140,
288478,
313055,
321252,
313066,
288494,
280302,
280304,
313073,
321266,
419570,
288499,
288502,
280314,
288510,
124671,
67330,
280324,
198405,
288519,
280331,
198416,
280337,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
296767,
288576,
345921,
280388,
337732,
304968,
280393,
280402,
173907,
313171,
313176,
42842,
280419,
321381,
296809,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280464,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
280487,
313258,
321458,
296883,
124853,
214966,
296890,
10170,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
239586,
313320,
231404,
124913,
165876,
321528,
239612,
313340,
288764,
239617,
313347,
288773,
313358,
305176,
321560,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
378941,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
149599,
280671,
149601,
321634,
149603,
223327,
329830,
280681,
313451,
223341,
280687,
149618,
215154,
313458,
280691,
313464,
329850,
321659,
280702,
288895,
321670,
215175,
141446,
288909,
141455,
141459,
280725,
313498,
100520,
288936,
280747,
288940,
288947,
280755,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
313548,
321740,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
157930,
280811,
280817,
125171,
157940,
280819,
182517,
280823,
280825,
280827,
280830,
280831,
280833,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
280888,
280891,
289087,
280897,
280900,
305480,
239944,
280906,
239947,
305485,
305489,
379218,
280919,
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,
281045,
281047,
215526,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
240132,
281095,
223752,
150025,
338440,
330244,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
281135,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
281179,
338528,
338532,
281190,
199273,
281196,
19053,
158317,
313973,
297594,
281210,
158347,
182926,
133776,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
199364,
297671,
158409,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322314,
322318,
281361,
281372,
322341,
215850,
281388,
289593,
281401,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
281442,
174955,
224110,
207733,
207737,
158596,
183172,
338823,
322440,
314249,
240519,
183184,
142226,
289687,
240535,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
281567,
289762,
322534,
297961,
183277,
281581,
322550,
134142,
322563,
314372,
330764,
175134,
322599,
322610,
314421,
281654,
314427,
314433,
207937,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
289912,
248995,
306341,
306344,
306347,
322734,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
126190,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
257334,
216376,
380226,
298306,
224584,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
290171,
314747,
306555,
298365,
290174,
224641,
281987,
298372,
314756,
281990,
224647,
265604,
298377,
314763,
142733,
298381,
314768,
224657,
306581,
314773,
314779,
314785,
314793,
282025,
282027,
241068,
241070,
241072,
282034,
241077,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
290291,
282101,
241142,
191992,
290298,
151036,
290302,
282111,
290305,
175621,
306694,
192008,
323084,
257550,
282127,
290321,
282130,
323090,
290325,
282133,
241175,
290328,
282137,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
28219,
282186,
224849,
282195,
282199,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
324757,
282261,
175770,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
306856,
196133,
282295,
323260,
282300,
323266,
282310,
323273,
282319,
306897,
241362,
306904,
282328,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
241450,
282410,
306988,
306991,
315184,
323376,
315190,
241464,
159545,
282425,
298811,
118593,
307009,
413506,
307012,
241475,
298822,
315211,
282446,
307027,
315221,
323414,
315223,
241496,
241498,
307035,
307040,
110433,
282465,
241509,
110438,
298860,
110445,
282478,
315249,
110450,
315251,
282481,
315253,
315255,
339838,
315267,
282499,
315269,
241544,
282505,
241546,
241548,
298896,
298898,
282514,
241556,
298901,
44948,
241560,
282520,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
36779,
241581,
282542,
241583,
323504,
241586,
282547,
241588,
290739,
241590,
241592,
241598,
290751,
241600,
241605,
151495,
241610,
298975,
241632,
298984,
241640,
241643,
298988,
241646,
241649,
241652,
323574,
290807,
299003,
241661,
299006,
282623,
315396,
241669,
315397,
282632,
282639,
290835,
282645,
241693,
282654,
241701,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
307278,
192596,
176213,
307287,
307290,
217179,
315482,
192605,
315483,
233567,
299105,
200801,
217188,
299109,
307303,
315495,
356457,
45163,
307307,
315502,
192624,
307314,
323700,
299126,
233591,
299136,
307329,
315524,
307338,
233613,
241813,
307352,
299164,
299167,
315552,
184479,
184481,
315557,
184486,
307370,
307372,
184492,
307374,
307376,
299185,
323763,
184503,
176311,
299191,
307386,
258235,
307388,
307385,
307390,
176316,
299200,
184512,
307394,
299204,
307396,
184518,
307399,
323784,
233679,
307409,
307411,
176343,
299225,
233701,
307432,
184572,
282881,
184579,
282893,
323854,
291089,
282906,
291104,
233766,
295583,
176435,
307508,
315701,
332086,
307510,
307512,
168245,
307515,
307518,
282942,
282947,
323917,
110926,
282957,
233808,
323921,
315733,
323926,
233815,
276052,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299388,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
315801,
283033,
242075,
291226,
194654,
61855,
291231,
283042,
291238,
291241,
127403,
127405,
291247,
299440,
127407,
299444,
127413,
283062,
291254,
127417,
291260,
283069,
127421,
127424,
299457,
127429,
127431,
127434,
315856,
176592,
127440,
315860,
176597,
127447,
283095,
299481,
127449,
176605,
242143,
127455,
127457,
291299,
340454,
127463,
242152,
291305,
127466,
176620,
127469,
127474,
291314,
291317,
127480,
135672,
291323,
233979,
127485,
291330,
283142,
127494,
135689,
233994,
127497,
127500,
291341,
233998,
127506,
234003,
234006,
127511,
152087,
283161,
242202,
234010,
135707,
135710,
242206,
242208,
291361,
242220,
291378,
152118,
234038,
234041,
315961,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
135808,
291456,
373383,
299655,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
225948,
135839,
299680,
225954,
299684,
135844,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
119509,
226005,
226008,
299740,
242396,
201444,
299750,
283368,
234219,
283372,
226037,
283382,
316151,
234231,
234236,
226045,
242431,
234239,
209665,
234242,
299778,
242436,
226053,
234246,
226056,
234248,
291593,
242443,
234252,
242445,
234254,
291601,
234258,
242450,
242452,
234261,
348950,
201496,
234264,
234266,
234269,
283421,
234272,
234274,
152355,
299814,
234278,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
160572,
283452,
234302,
234307,
242499,
234309,
316233,
234313,
316235,
234316,
283468,
234319,
242511,
234321,
234324,
185173,
201557,
234329,
234333,
308063,
234336,
242530,
349027,
234338,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
226171,
234364,
291711,
234368,
291714,
234370,
291716,
234373,
316294,
201603,
226182,
308105,
234375,
226185,
234379,
324490,
234384,
234388,
234390,
324504,
234393,
209818,
308123,
324508,
234396,
291742,
226200,
234398,
234401,
291747,
291748,
234405,
291750,
234407,
324520,
324518,
324522,
234410,
291756,
291754,
226220,
324527,
291760,
234417,
201650,
324531,
234414,
234422,
226230,
324536,
275384,
234428,
291773,
242623,
324544,
234431,
234434,
324546,
324548,
234437,
226245,
234439,
226239,
234443,
291788,
234446,
275406,
193486,
234449,
316370,
193488,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234475,
234478,
316400,
234481,
316403,
234484,
234485,
234487,
324599,
234490,
234493,
316416,
234496,
308226,
234501,
275462,
308231,
234504,
234507,
234510,
234515,
300054,
316439,
234520,
234519,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
144430,
234543,
234546,
275508,
300085,
234549,
300088,
234553,
234556,
234558,
316479,
234561,
316483,
160835,
234563,
308291,
234568,
234570,
316491,
234572,
300108,
234574,
300115,
234580,
234581,
242777,
234585,
275545,
234590,
234593,
234595,
234597,
300133,
234601,
300139,
234605,
160879,
234607,
275569,
234610,
316530,
300148,
234614,
398455,
144506,
234618,
234620,
275579,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
308373,
226453,
234647,
275606,
275608,
234650,
308379,
234648,
300189,
324766,
119967,
234653,
324768,
283805,
234657,
242852,
300197,
234661,
283813,
234664,
275626,
234667,
316596,
308414,
234687,
300223,
300226,
308418,
234692,
300229,
308420,
308422,
283844,
226500,
300234,
283850,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
300267,
161003,
300270,
300272,
120053,
300278,
275703,
316663,
300284,
275710,
300287,
292097,
300289,
161027,
300292,
300294,
275719,
234760,
177419,
300299,
242957,
300301,
283917,
177424,
275725,
349464,
283939,
259367,
292143,
283951,
300344,
226617,
243003,
283963,
226628,
300357,
283973,
177482,
283983,
316758,
357722,
316766,
316768,
292192,
218464,
292197,
316774,
243046,
218473,
284010,
136562,
324978,
275834,
333178,
275836,
275840,
316803,
316806,
226696,
316811,
226699,
316814,
226703,
300433,
234899,
300436,
226709,
357783,
316824,
316826,
144796,
300448,
144807,
144810,
144812,
284076,
144814,
227426,
144820,
374196,
284084,
292279,
284087,
144826,
144828,
144830,
144832,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
226787,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
292338,
226802,
316917,
292343,
308727,
300537,
316933,
316947,
308757,
308762,
284191,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
194101,
284213,
316983,
194103,
284215,
308790,
284218,
226877,
292414,
284223,
284226,
284228,
292421,
226886,
284231,
128584,
243268,
284234,
366155,
317004,
276043,
284238,
226895,
284241,
194130,
284243,
300628,
284245,
292433,
284247,
317015,
235097,
243290,
276053,
284249,
284251,
300638,
284253,
284255,
243293,
284258,
292452,
292454,
284263,
177766,
284265,
292458,
284267,
292461,
284272,
284274,
284278,
292470,
276086,
292473,
284283,
276093,
284286,
292479,
284288,
292481,
284290,
325250,
284292,
292485,
325251,
276095,
276098,
284297,
317066,
284299,
317068,
284301,
276109,
284303,
284306,
276114,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
284329,
317098,
284331,
276137,
284333,
284335,
276144,
284337,
284339,
300726,
284343,
284346,
284350,
358080,
276160,
284354,
358083,
284358,
276166,
358089,
284362,
276170,
284365,
276175,
284368,
276177,
284370,
358098,
284372,
317138,
284377,
276187,
284379,
284381,
284384,
358114,
284386,
358116,
276197,
317158,
358119,
284392,
325353,
358122,
284394,
284397,
358126,
284399,
358128,
276206,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
300819,
317207,
284440,
300828,
300830,
276255,
300832,
325408,
300834,
317221,
227109,
358183,
186151,
276268,
300845,
243504,
300850,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
300872,
292681,
153417,
358224,
284499,
276308,
284502,
317271,
178006,
276315,
292700,
317279,
284511,
227175,
292715,
300912,
292721,
284529,
300915,
284533,
292729,
317306,
284540,
292734,
325512,
169868,
276365,
317332,
358292,
284564,
284566,
350106,
284572,
276386,
284579,
276388,
358312,
317353,
284585,
276395,
292776,
292784,
276402,
358326,
161718,
358330,
276410,
276411,
276418,
276425,
301009,
301011,
301013,
292823,
358360,
301017,
301015,
292828,
276446,
153568,
276448,
276452,
292839,
276455,
292843,
276460,
292845,
276464,
178161,
227314,
276466,
325624,
276472,
317435,
276476,
276479,
276482,
276485,
317446,
276490,
292876,
317456,
276496,
317458,
178195,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
276528,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
276544,
284739,
325700,
243779,
292934,
243785,
276553,
350293,
350295,
309337,
194649,
227418,
350299,
350302,
227423,
350304,
178273,
309346,
194657,
194660,
350308,
309350,
309348,
292968,
309352,
309354,
301163,
350313,
350316,
227430,
301167,
276583,
350321,
276590,
284786,
276595,
350325,
252022,
227440,
350328,
292985,
301178,
350332,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
350366,
276638,
284837,
153765,
350375,
350379,
350381,
350383,
129200,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
301258,
309450,
276685,
309455,
276689,
309462,
301272,
276699,
194780,
309468,
309471,
301283,
317672,
317674,
325867,
243948,
194801,
309491,
227571,
309494,
243960,
276735,
227583,
227587,
276739,
211204,
276742,
227593,
227596,
325910,
309530,
342298,
211232,
317729,
276775,
211241,
325937,
325943,
211260,
260421,
276809,
285002,
276811,
235853,
276816,
235858,
276829,
276833,
391523,
276836,
293227,
276843,
293232,
276848,
186744,
211324,
227709,
285061,
317833,
178572,
285070,
285077,
178583,
227738,
317853,
276896,
317858,
342434,
285093,
317864,
285098,
276907,
235955,
276917,
293304,
293307,
293314,
309707,
293325,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
227810,
293346,
276964,
293352,
236013,
293364,
301562,
293370,
317951,
309764,
301575,
121352,
293387,
236043,
342541,
317963,
113167,
55822,
309779,
317971,
309781,
277011,
55837,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
285236,
23094,
277054,
244288,
219714,
129603,
301636,
318020,
301639,
301643,
277071,
285265,
399955,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
309871,
121458,
277106,
170618,
170619,
309885,
309888,
277122,
227975,
277128,
285320,
301706,
318092,
326285,
334476,
318094,
277136,
277139,
227992,
334488,
318108,
285340,
318110,
227998,
137889,
383658,
285357,
318128,
277170,
293555,
318132,
342707,
154292,
277173,
285368,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
137946,
113378,
203491,
228069,
277223,
342760,
285417,
56041,
56043,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
228113,
285459,
277273,
293659,
326430,
228128,
285474,
293666,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
285494,
301880,
285499,
301884,
310080,
293696,
277317,
277322,
293706,
277329,
162643,
310100,
301911,
301913,
277337,
301921,
400236,
236397,
162671,
326514,
310134,
236408,
15224,
277368,
416639,
416640,
113538,
310147,
416648,
39817,
187274,
277385,
301972,
424853,
277405,
277411,
310179,
293798,
293802,
236460,
277426,
276579,
293811,
293817,
293820,
203715,
326603,
276586,
293849,
293861,
228327,
228328,
318442,
228330,
228332,
326638,
277486,
318450,
293876,
293877,
285686,
302073,
121850,
293882,
302075,
285690,
244731,
293887,
277504,
277507,
277511,
293899,
277519,
293908,
302105,
293917,
293939,
318516,
277561,
277564,
310336,
7232,
293956,
277573,
228422,
293960,
310344,
277577,
277583,
203857,
293971,
310355,
310359,
236632,
277594,
138332,
277598,
203872,
277601,
285792,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
367737,
285817,
302205,
285821,
392326,
285831,
253064,
294026,
302218,
285835,
162964,
384148,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
302241,
285862,
277671,
302248,
64682,
277678,
294063,
294065,
302258,
277687,
294072,
318651,
294076,
277695,
318657,
244930,
302275,
130244,
302277,
228550,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
310486,
302296,
384222,
310498,
285927,
318698,
302315,
195822,
228592,
294132,
138485,
228601,
204026,
228606,
204031,
64768,
310531,
285958,
138505,
228617,
318742,
204067,
277798,
130345,
277801,
113964,
285997,
277804,
285999,
277807,
113969,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
417086,
277822,
286016,
302403,
294211,
384328,
277832,
277836,
294221,
294223,
326991,
277839,
277842,
277847,
277850,
179547,
277853,
146784,
277857,
302436,
277860,
294246,
327015,
310632,
327017,
351594,
277864,
277869,
277872,
351607,
310648,
277880,
310651,
277884,
277888,
310657,
351619,
294276,
310659,
327046,
277892,
253320,
310665,
318858,
277894,
277898,
277903,
310672,
351633,
277905,
277908,
277917,
310689,
277921,
130468,
228776,
277928,
277932,
310703,
277937,
310710,
130486,
310712,
277944,
310715,
277947,
302526,
228799,
277950,
277953,
302534,
310727,
245191,
64966,
163272,
277959,
277963,
302541,
277966,
302543,
310737,
277971,
228825,
163290,
277978,
310749,
277981,
277984,
310755,
277989,
277991,
187880,
277995,
310764,
286188,
278000,
228851,
310772,
278003,
278006,
40440,
212472,
278009,
40443,
286203,
310780,
40448,
228864,
286214,
228871,
302603,
65038,
302614,
302617,
286233,
302621,
286240,
146977,
187939,
40484,
294435,
40486,
286246,
294440,
40488,
294439,
294443,
40491,
294445,
278057,
310831,
245288,
286248,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
327240,
40521,
286283,
40525,
40527,
212560,
400976,
228944,
40533,
147032,
40537,
40539,
40541,
278109,
40544,
40548,
40550,
40552,
286312,
40554,
286313,
310892,
40557,
40560,
188022,
122488,
294521,
343679,
294537,
310925,
286354,
278163,
302740,
122517,
278168,
179870,
327333,
229030,
212648,
278188,
302764,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
294601,
302793,
343757,
212690,
319187,
286420,
278227,
229076,
286425,
319194,
278235,
278238,
229086,
286432,
294625,
294634,
302838,
319226,
286460,
278274,
302852,
278277,
302854,
294664,
311048,
352008,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
319280,
278320,
319290,
229192,
302925,
188247,
280021,
188252,
237409,
229233,
294776,
360317,
294785,
327554,
40840,
40851,
294803,
188312,
294811,
237470,
319390,
40865,
319394,
294817,
294821,
311209,
180142,
343983,
294831,
188340,
40886,
319419,
294844,
294847,
237508,
393177,
294876,
294879,
294883,
294890,
311279,
278513,
237555,
311283,
278516,
278519,
237562
] |
541a6e5b565428b99b9d3fb874d85ae1c30800bf | 17d06f84571e637f3080c07d9f019fe1cd21bfe2 | /Africa/Africa/View/InsetGalleryView.swift | cb2e07446fa09c3352e0f3bf149226bdb91cb571 | [] | no_license | ZdenkoKrio/Africa-iOS-application | 27aadf1b1111fbfc40137f2f63ba98e384833c70 | 914715e0b3878950e155c00b3617ccf9a0bd09e9 | refs/heads/main | 2023-07-07T00:35:01.432186 | 2021-07-26T17:42:45 | 2021-07-26T17:42:45 | 387,536,282 | 0 | 0 | null | 2021-07-26T17:41:27 | 2021-07-19T16:57:29 | Swift | UTF-8 | Swift | false | false | 965 | swift | //
// InsetGalleryView.swift
// Africa
//
// Created by Zdenko Čepan on 21/07/2021.
//
import SwiftUI
struct InsetGalleryView: View {
// MARK: Properties
let animal: Animal
// MARK: Body
var body: some View {
ScrollView(.horizontal, showsIndicators: false) {
HStack(alignment: .center, spacing: 15) {
ForEach(animal.gallery, id: \.self) { item in
Image(item)
.resizable()
.scaledToFit()
.frame(height: 200)
.cornerRadius(12)
} // LOOP
} // HSTACK
} // SCROLL
}
}
struct InsetGalleryView_Previews: PreviewProvider {
static let animals: [Animal] = Bundle.main.decode("animals.json")
static var previews: some View {
InsetGalleryView(animal: animals[4])
.previewLayout(.sizeThatFits)
.padding()
}
}
| [
358512,
358483,
358584
] |
9c8b23c3df8eb16b87e5fcd407e5ba414a049891 | 0a4a322398b8de5d5a0f01560ba86fa1a2566d73 | /DependencyInversion.playground/Contents.swift | 2e3a98b910d4436decf912b97635fc74663669ce | [] | no_license | khetiSubrat/SwiftPlayGround | d4c8923f3d9fe7caa02bced76e9ce9296e4352b4 | 151e7213b32bb8dfe1e5103a8ffc003190885060 | refs/heads/master | 2022-12-21T23:18:07.400461 | 2020-09-24T14:38:08 | 2020-09-24T14:38:08 | 291,735,758 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,051 | swift | import UIKit
var str = "Hello, playground"
/*class SomeClass {
var child:SomeotherClass
init(child:SomeotherClass ) {
self.child = child
}
}
class SomeotherClass {
var name: String
init(name: String) {
self.name = name
}
}
let someotherClass = SomeotherClass(name: "Subrat")
let someClass = SomeClass(child: someotherClass)
print(someClass)*/
// MARK: DIP
protocol Nameable {
var name: String { get }
}
class SomeClass {
var child:SomeotherClass
init(child:SomeotherClass ) {
self.child = child
}
}
class SomeotherClass: Nameable {
var name: String
init(name: String) {
self.name = name
}
}
class SomeotherClassMock: Nameable {
var name: String
init(name: String) {
self.name = name
}
}
let nameable = SomeotherClass(name: "Subrat")
let someClass = SomeClass(child: nameable)
print(someClass)
let nameable1 = SomeotherClassMock(name: "Subrat")
let someClass1 = SomeClass(child: nameable)
print(someClass1)
| [
-1
] |
9c31df066d8705962ae9df169311bde5a23a2472 | 9cf866d1a68ba51cc8f83da1943943f67b84e568 | /CodeAddict/Extensions/UIViewExtension.swift | 7450057f8e3de99980b7be055aa3ee09d8938a1b | [] | no_license | mikizelichowski/GitHubAPI | aaa2db67326cde5f8cf0a12059902addb2f261c4 | 11d2fe56dc3dc32c6d74cf541c7fa41ee4194cb4 | refs/heads/master | 2023-01-28T00:00:21.660313 | 2020-12-11T22:07:48 | 2020-12-11T22:07:48 | 320,695,864 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,408 | swift | //
// UIViewExtension.swift
// CodeAddict
//
// Created by Mikolaj Zelichowski on 09/12/2020.
//
import UIKit
extension UIView {
func anchor(top: NSLayoutYAxisAnchor? = nil,
left: NSLayoutXAxisAnchor? = nil,
bottom: NSLayoutYAxisAnchor? = nil,
right: NSLayoutXAxisAnchor? = nil,
paddingTop: CGFloat = 0,
paddingLeft: CGFloat = 0,
paddingBottom: CGFloat = 0,
paddingRight: CGFloat = 0,
width: CGFloat? = nil,
height: CGFloat? = nil) {
translatesAutoresizingMaskIntoConstraints = false
if let top = top {
topAnchor.constraint(equalTo: top, constant: paddingTop).isActive = true
}
if let left = left {
leftAnchor.constraint(equalTo: left, constant: paddingLeft).isActive = true
}
if let bottom = bottom {
bottomAnchor.constraint(equalTo: bottom, constant: -paddingBottom).isActive = true
}
if let right = right {
rightAnchor.constraint(equalTo: right, constant: -paddingRight).isActive = true
}
}
func centerY(inView view: UIView,
leftAnchor: NSLayoutXAxisAnchor? = nil,
paddingLeft: CGFloat = 0,
constant: CGFloat = 0) {
translatesAutoresizingMaskIntoConstraints = false
centerYAnchor.constraint(equalTo: view.centerYAnchor, constant: constant).isActive = true
if let left = leftAnchor {
anchor(left: left, paddingLeft: paddingLeft)
}
}
func fillSuperView() {
translatesAutoresizingMaskIntoConstraints = false
guard let view = superview else { return }
NSLayoutConstraint.activate([
topAnchor.constraint(equalTo: view.topAnchor),
leftAnchor.constraint(equalTo: view.leftAnchor),
bottomAnchor.constraint(equalTo: view.bottomAnchor),
rightAnchor.constraint(equalTo: view.rightAnchor)
])
}
func setDimensions(height: CGFloat, width: CGFloat) {
translatesAutoresizingMaskIntoConstraints = false
heightAnchor.constraint(equalToConstant: height).isActive = true
widthAnchor.constraint(equalToConstant: width).isActive = true
}
}
| [
-1
] |
41ec302942c79f67eaeb1164104560695842a20a | a23d5d0fb6939abbbd97f3842e6807834bdf3077 | /prod/zdios2/zdios202/view/ShapeLibrary.swift | 858ab0211342754f15ae60ff4c5a2e8221f75cb7 | [] | no_license | rfwl/test | 38f7242b820f258413fd5c7d43d2b70d5183d56a | 2dc6db97aaf6b9b1d5755c67835c448b414ae983 | refs/heads/master | 2021-01-10T05:11:15.688390 | 2017-12-25T22:58:40 | 2017-12-25T22:58:40 | 52,955,912 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 20,059 | swift | //
// ShapeLibrary.swift
// zdios202
//
// Created by Wanlou Feng on 2/10/17.
// Copyright © 2017 Wanlou Feng. All rights reserved.
//
import Foundation
import UIKit
class ShapeLibrary {
//======================================================================
static func drawShape(_ shape:String, bounds: CGRect, color: UIColor) {
if shape.caseInsensitiveCompare("Backspace") == ComparisonResult.orderedSame {
drawBackspace(bounds, color: color)
} else if shape.caseInsensitiveCompare("Next") == ComparisonResult.orderedSame {
drawGlobe(bounds, color: color)
}
}
static func drawBackspace(_ bounds: CGRect, color: UIColor) {
let factors = getFactors(CGSize(width:44, height:32), toRect: bounds)
let xScalingFactor = factors.xScalingFactor
let yScalingFactor = factors.yScalingFactor
let lineWidthScalingFactor = factors.lineWidthScalingFactor
centerShape(fromSize: CGSize(width:44 * xScalingFactor, height:32 * yScalingFactor), toRect: bounds)
//// Color Declarations
let color = color
let color2 = UIColor.gray
//// Bezier Drawing
let bezierPath = UIBezierPath()
bezierPath.move(to: CGPoint(x: 16 * xScalingFactor, y: 32 * yScalingFactor))
bezierPath.addLine(to: CGPoint(x: 38 * xScalingFactor, y: 32 * yScalingFactor))
bezierPath.addCurve(to: CGPoint(x: 44 * xScalingFactor, y: 26 * yScalingFactor),
controlPoint1: CGPoint(x: 38 * xScalingFactor, y: 32 * yScalingFactor),
controlPoint2: CGPoint(x: 44 * xScalingFactor, y: 32 * yScalingFactor))
bezierPath.addCurve(to: CGPoint(x: 44 * xScalingFactor, y: 6 * yScalingFactor),
controlPoint1: CGPoint(x: 44 * xScalingFactor, y: 22 * yScalingFactor),
controlPoint2: CGPoint(x: 44 * xScalingFactor, y: 6 * yScalingFactor))
bezierPath.addCurve(to: CGPoint(x: 36 * xScalingFactor, y: 0 * yScalingFactor),
controlPoint1: CGPoint(x: 44 * xScalingFactor, y: 6 * yScalingFactor),
controlPoint2: CGPoint(x: 44 * xScalingFactor, y: 0 * yScalingFactor))
bezierPath.addCurve(to: CGPoint(x: 16 * xScalingFactor, y: 0 * yScalingFactor),
controlPoint1: CGPoint(x: 32 * xScalingFactor, y: 0 * yScalingFactor),
controlPoint2: CGPoint(x: 16 * xScalingFactor, y: 0 * yScalingFactor))
bezierPath.addLine(to: CGPoint(x: 0 * xScalingFactor, y: 18 * yScalingFactor))
bezierPath.addLine(to: CGPoint(x: 16 * xScalingFactor, y: 32 * yScalingFactor))
bezierPath.close()
color.setFill()
bezierPath.fill()
//// Bezier 2 Drawing
let bezier2Path = UIBezierPath()
bezier2Path.move(to: CGPoint(x: 20 * xScalingFactor, y: 10 * yScalingFactor))
bezier2Path.addLine(to: CGPoint(x: 34 * xScalingFactor, y: 22 * yScalingFactor))
bezier2Path.addLine(to: CGPoint(x: 20 * xScalingFactor, y: 10 * yScalingFactor))
bezier2Path.close()
UIColor.gray.setFill()
bezier2Path.fill()
color2.setStroke()
bezier2Path.lineWidth = 2.5 * lineWidthScalingFactor
bezier2Path.stroke()
//// Bezier 3 Drawing
let bezier3Path = UIBezierPath()
bezier3Path.move(to: CGPoint(x: 20 * xScalingFactor, y: 22 * yScalingFactor))
bezier3Path.addLine(to: CGPoint(x: 34 * xScalingFactor, y: 10 * yScalingFactor))
bezier3Path.addLine(to: CGPoint(x: 20 * xScalingFactor, y: 22 * yScalingFactor))
bezier3Path.close()
UIColor.red.setFill()
bezier3Path.fill()
color2.setStroke()
bezier3Path.lineWidth = 2.5 * lineWidthScalingFactor
bezier3Path.stroke()
endCenter()
} //end of func
static func drawGlobe(_ bounds: CGRect, color: UIColor) {
let factors = getFactors(CGSize(width: 41, height: 40), toRect: bounds)
let xScalingFactor = factors.xScalingFactor
let yScalingFactor = factors.yScalingFactor
let lineWidthScalingFactor = factors.lineWidthScalingFactor
centerShape(fromSize: CGSize(width: 41 * xScalingFactor, height: 40 * yScalingFactor), toRect: bounds)
//// Color Declarations
let color = color
//// Oval Drawing
let ovalPath = UIBezierPath(ovalIn: CGRect(x: 0 * xScalingFactor, y: 0 * yScalingFactor, width: 40 * xScalingFactor, height: 40 * yScalingFactor))
color.setStroke()
ovalPath.lineWidth = 1 * lineWidthScalingFactor
ovalPath.stroke()
//// Bezier Drawing
let bezierPath = UIBezierPath()
bezierPath.move(to: CGPoint(x: 20 * xScalingFactor, y: -0 * yScalingFactor))
bezierPath.addLine(to: CGPoint(x: 20 * xScalingFactor, y: 40 * yScalingFactor))
bezierPath.addLine(to: CGPoint(x: 20 * xScalingFactor, y: -0 * yScalingFactor))
bezierPath.close()
color.setStroke()
bezierPath.lineWidth = 1 * lineWidthScalingFactor
bezierPath.stroke()
//// Bezier 2 Drawing
let bezier2Path = UIBezierPath()
bezier2Path.move(to: CGPoint(x: 0.5 * xScalingFactor, y: 19.5 * yScalingFactor))
bezier2Path.addLine(to: CGPoint(x: 39.5 * xScalingFactor, y: 19.5 * yScalingFactor))
bezier2Path.addLine(to: CGPoint(x: 0.5 * xScalingFactor, y: 19.5 * yScalingFactor))
bezier2Path.close()
color.setStroke()
bezier2Path.lineWidth = 1 * lineWidthScalingFactor
bezier2Path.stroke()
//// Bezier 3 Drawing
let bezier3Path = UIBezierPath()
bezier3Path.move(to: CGPoint(x: 21.63 * xScalingFactor, y: 0.42 * yScalingFactor))
bezier3Path.addCurve(to: CGPoint(x: 21.63 * xScalingFactor, y: 39.6 * yScalingFactor),
controlPoint1: CGPoint(x: 21.63 * xScalingFactor, y: 0.42 * yScalingFactor),
controlPoint2: CGPoint(x: 41 * xScalingFactor, y: 19 * yScalingFactor))
bezier3Path.lineCapStyle = .round
color.setStroke()
bezier3Path.lineWidth = 1 * lineWidthScalingFactor
bezier3Path.stroke()
//// Bezier 4 Drawing
let bezier4Path = UIBezierPath()
bezier4Path.move(to: CGPoint(x: 17.76 * xScalingFactor, y: 0.74 * yScalingFactor))
bezier4Path.addCurve(to: CGPoint(x: 18.72 * xScalingFactor, y: 39.6 * yScalingFactor),
controlPoint1: CGPoint(x: 17.76 * xScalingFactor, y: 0.74 * yScalingFactor),
controlPoint2: CGPoint(x: -2.5 * xScalingFactor, y: 19.04 * yScalingFactor))
bezier4Path.lineCapStyle = .round
color.setStroke()
bezier4Path.lineWidth = 1 * lineWidthScalingFactor
bezier4Path.stroke()
//// Bezier 5 Drawing
let bezier5Path = UIBezierPath()
bezier5Path.move(to: CGPoint(x: 6 * xScalingFactor, y: 7 * yScalingFactor))
bezier5Path.addCurve(to: CGPoint(x: 34 * xScalingFactor, y: 7 * yScalingFactor),
controlPoint1: CGPoint(x: 6 * xScalingFactor, y: 7 * yScalingFactor),
controlPoint2: CGPoint(x: 19 * xScalingFactor, y: 21 * yScalingFactor))
bezier5Path.lineCapStyle = .round
color.setStroke()
bezier5Path.lineWidth = 1 * lineWidthScalingFactor
bezier5Path.stroke()
//// Bezier 6 Drawing
let bezier6Path = UIBezierPath()
bezier6Path.move(to: CGPoint(x: 6 * xScalingFactor, y: 33 * yScalingFactor))
bezier6Path.addCurve(to: CGPoint(x: 34 * xScalingFactor, y: 33 * yScalingFactor),
controlPoint1: CGPoint(x: 6 * xScalingFactor, y: 33 * yScalingFactor),
controlPoint2: CGPoint(x: 19 * xScalingFactor, y: 22 * yScalingFactor))
bezier6Path.lineCapStyle = .round
color.setStroke()
bezier6Path.lineWidth = 1 * lineWidthScalingFactor
bezier6Path.stroke()
endCenter()
} // end of func
//====================================================================================
// Helper
static func getFactors(_ fromSize: CGSize, toRect: CGRect) -> (xScalingFactor: CGFloat, yScalingFactor: CGFloat, lineWidthScalingFactor: CGFloat, fillIsHorizontal: Bool, offset: CGFloat) {
let xSize = { () -> CGFloat in
let scaledSize = (fromSize.width / CGFloat(2))
if scaledSize > toRect.width {
return (toRect.width / scaledSize) / CGFloat(2)
}
else {
return CGFloat(0.5)
}
}()
let ySize = { () -> CGFloat in
let scaledSize = (fromSize.height / CGFloat(2))
if scaledSize > toRect.height {
return (toRect.height / scaledSize) / CGFloat(2)
}
else {
return CGFloat(0.5)
}
}()
let actualSize = min(xSize, ySize)
return (actualSize, actualSize, actualSize, false, 0)
} //end of func
static func centerShape(fromSize: CGSize, toRect: CGRect) {
let xOffset = (toRect.width - fromSize.width) / CGFloat(2)
let yOffset = (toRect.height - fromSize.height) / CGFloat(2)
let ctx = UIGraphicsGetCurrentContext()
ctx?.saveGState()
ctx?.translateBy(x: xOffset, y: yOffset)
} //end of func
static func endCenter() {
let ctx = UIGraphicsGetCurrentContext()
ctx?.restoreGState()
} //end of func
} // end of class
/*
// TODO: these shapes were traced and as such are erratic and inaccurate; should redo as SVG or PDF
///////////////////
// SHAPE OBJECTS //
///////////////////
class BackspaceShape: Shape {
override func drawCall(_ color: UIColor) {
drawBackspace(self.bounds, color: color)
}
}
class ShiftShape: Shape {
var withLock: Bool = false {
didSet {
self.overflowCanvas.setNeedsDisplay()
}
}
override func drawCall(_ color: UIColor) {
drawShift(self.bounds, color: color, withRect: self.withLock)
}
}
class GlobeShape: Shape {
override func drawCall(_ color: UIColor) {
drawGlobe(self.bounds, color: color)
}
}
class Shape: UIView {
var color: UIColor? {
didSet {
if let _ = self.color {
self.overflowCanvas.setNeedsDisplay()
}
}
}
// in case shapes draw out of bounds, we still want them to show
var overflowCanvas: OverflowCanvas!
convenience init() {
self.init(frame: CGRect.zero)
}
override required init(frame: CGRect) {
super.init(frame: frame)
self.isOpaque = false
self.clipsToBounds = false
self.overflowCanvas = OverflowCanvas(shape: self)
self.addSubview(self.overflowCanvas)
}
required init(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
var oldBounds: CGRect?
override func layoutSubviews() {
if self.bounds.width == 0 || self.bounds.height == 0 {
return
}
if oldBounds != nil && self.bounds.equalTo(oldBounds!) {
return
}
oldBounds = self.bounds
super.layoutSubviews()
let overflowCanvasSizeRatio = CGFloat(1.25)
let overflowCanvasSize = CGSize(width: self.bounds.width * overflowCanvasSizeRatio, height: self.bounds.height * overflowCanvasSizeRatio)
self.overflowCanvas.frame = CGRect(
x: CGFloat((self.bounds.width - overflowCanvasSize.width) / 2.0),
y: CGFloat((self.bounds.height - overflowCanvasSize.height) / 2.0),
width: overflowCanvasSize.width,
height: overflowCanvasSize.height)
self.overflowCanvas.setNeedsDisplay()
}
func drawCall(_ color: UIColor) { /* override me! */ }
class OverflowCanvas: UIView {
unowned var shape: Shape
init(shape: Shape) {
self.shape = shape
super.init(frame: CGRect.zero)
self.isOpaque = false
}
required init(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func draw(_ rect: CGRect) {
let ctx = UIGraphicsGetCurrentContext()
CGColorSpaceCreateDeviceRGB()
ctx?.saveGState() //CGContextSaveGState(ctx?)
let xOffset = (self.bounds.width - self.shape.bounds.width) / CGFloat(2)
let yOffset = (self.bounds.height - self.shape.bounds.height) / CGFloat(2)
ctx?.translateBy(x: xOffset, y: yOffset) //CGContextTranslateCTM(ctx?, xOffset, yOffset)
self.shape.drawCall(shape.color != nil ? shape.color! : UIColor.black)
ctx?.restoreGState() //CGContextRestoreGState(ctx?)
}
}
}
func drawLine(from fromPoint: CGPoint, to toPoint: CGPoint) {
UIGraphicsBeginImageContextWithOptions(view.bounds.size, false, 0)
imageView.image?.draw(in: view.bounds)
let context = UIGraphicsGetCurrentContext()
context?.move(to: fromPoint)
context?.addLine(to: toPoint)
context?.setLineCap(CGLineCap.round)
context?.setLineWidth(brushWidth)
context?.setStrokeColor(red: red, green: green, blue: blue, alpha: 1.0)
context?.setBlendMode(CGBlendMode.normal)
context?.strokePath()
imageView.image = UIGraphicsGetImageFromCurrentImageContext()
imageView.alpha = opacity
UIGraphicsEndImageContext()
}
/////////////////////
// SHAPE FUNCTIONS //
/////////////////////
*/
/*
func drawShift(_ bounds: CGRect, color: UIColor, withRect: Bool) {
let factors = getFactors(CGSize(width: 38, height: (withRect ? 34 + 4 : 32)), toRect: bounds)
let xScalingFactor = factors.xScalingFactor
let yScalingFactor = factors.yScalingFactor - factors.lineWidthScalingFactor
centerShape(CGSizeMake(38 * xScalingFactor, (withRect ? 34 + 4 : 32) * yScalingFactor), toRect: bounds)
//// Color Declarations
let color2 = color
//// Bezier Drawing
let bezierPath = UIBezierPath()
bezierPath.moveToPoint(CGPointMake(28 * xScalingFactor, 18 * yScalingFactor))
bezierPath.addLineToPoint(CGPointMake(38 * xScalingFactor, 18 * yScalingFactor))
bezierPath.addLineToPoint(CGPointMake(38 * xScalingFactor, 18 * yScalingFactor))
bezierPath.addLineToPoint(CGPointMake(19 * xScalingFactor, 0 * yScalingFactor))
bezierPath.addLineToPoint(CGPointMake(0 * xScalingFactor, 18 * yScalingFactor))
bezierPath.addLineToPoint(CGPointMake(0 * xScalingFactor, 18 * yScalingFactor))
bezierPath.addLineToPoint(CGPointMake(10 * xScalingFactor, 18 * yScalingFactor))
bezierPath.addLineToPoint(CGPointMake(10 * xScalingFactor, 28 * yScalingFactor))
bezierPath.addCurveToPoint(CGPointMake(14 * xScalingFactor, 32 * yScalingFactor), controlPoint1: CGPointMake(10 * xScalingFactor, 28 * yScalingFactor), controlPoint2: CGPointMake(10 * xScalingFactor, 32 * yScalingFactor))
bezierPath.addCurveToPoint(CGPointMake(24 * xScalingFactor, 32 * yScalingFactor), controlPoint1: CGPointMake(16 * xScalingFactor, 32 * yScalingFactor), controlPoint2: CGPointMake(24 * xScalingFactor, 32 * yScalingFactor))
bezierPath.addCurveToPoint(CGPointMake(28 * xScalingFactor, 28 * yScalingFactor), controlPoint1: CGPointMake(24 * xScalingFactor, 32 * yScalingFactor), controlPoint2: CGPointMake(28 * xScalingFactor, 32 * yScalingFactor))
bezierPath.addCurveToPoint(CGPointMake(28 * xScalingFactor, 18 * yScalingFactor), controlPoint1: CGPointMake(28 * xScalingFactor, 26 * yScalingFactor), controlPoint2: CGPointMake(28 * xScalingFactor, 18 * yScalingFactor))
bezierPath.closePath()
color2.setFill()
bezierPath.fill()
if withRect {
//// Rectangle Drawing
let rectanglePath = UIBezierPath(rect: CGRectMake(10 * xScalingFactor, 34 * yScalingFactor, 18 * xScalingFactor, 4 * yScalingFactor))
color2.setFill()
rectanglePath.fill()
}
endCenter()
} //end of func
func drawGlobe(_ bounds: CGRect, color: UIColor) {
let factors = getFactors(CGSizeMake(41, 40), toRect: bounds)
let xScalingFactor = factors.xScalingFactor
let yScalingFactor = factors.yScalingFactor
let lineWidthScalingFactor = factors.lineWidthScalingFactor
centerShape(CGSizeMake(41 * xScalingFactor, 40 * yScalingFactor), toRect: bounds)
//// Color Declarations
let color = color
//// Oval Drawing
let ovalPath = UIBezierPath(ovalInRect: CGRectMake(0 * xScalingFactor, 0 * yScalingFactor, 40 * xScalingFactor, 40 * yScalingFactor))
color.setStroke()
ovalPath.lineWidth = 1 * lineWidthScalingFactor
ovalPath.stroke()
//// Bezier Drawing
let bezierPath = UIBezierPath()
bezierPath.moveToPoint(CGPointMake(20 * xScalingFactor, -0 * yScalingFactor))
bezierPath.addLineToPoint(CGPointMake(20 * xScalingFactor, 40 * yScalingFactor))
bezierPath.addLineToPoint(CGPointMake(20 * xScalingFactor, -0 * yScalingFactor))
bezierPath.closePath()
color.setStroke()
bezierPath.lineWidth = 1 * lineWidthScalingFactor
bezierPath.stroke()
//// Bezier 2 Drawing
let bezier2Path = UIBezierPath()
bezier2Path.moveToPoint(CGPointMake(0.5 * xScalingFactor, 19.5 * yScalingFactor))
bezier2Path.addLineToPoint(CGPointMake(39.5 * xScalingFactor, 19.5 * yScalingFactor))
bezier2Path.addLineToPoint(CGPointMake(0.5 * xScalingFactor, 19.5 * yScalingFactor))
bezier2Path.closePath()
color.setStroke()
bezier2Path.lineWidth = 1 * lineWidthScalingFactor
bezier2Path.stroke()
//// Bezier 3 Drawing
let bezier3Path = UIBezierPath()
bezier3Path.moveToPoint(CGPointMake(21.63 * xScalingFactor, 0.42 * yScalingFactor))
bezier3Path.addCurveToPoint(CGPointMake(21.63 * xScalingFactor, 39.6 * yScalingFactor), controlPoint1: CGPointMake(21.63 * xScalingFactor, 0.42 * yScalingFactor), controlPoint2: CGPointMake(41 * xScalingFactor, 19 * yScalingFactor))
bezier3Path.lineCapStyle = .round
color.setStroke()
bezier3Path.lineWidth = 1 * lineWidthScalingFactor
bezier3Path.stroke()
//// Bezier 4 Drawing
let bezier4Path = UIBezierPath()
bezier4Path.moveToPoint(CGPointMake(17.76 * xScalingFactor, 0.74 * yScalingFactor))
bezier4Path.addCurveToPoint(CGPointMake(18.72 * xScalingFactor, 39.6 * yScalingFactor), controlPoint1: CGPointMake(17.76 * xScalingFactor, 0.74 * yScalingFactor), controlPoint2: CGPointMake(-2.5 * xScalingFactor, 19.04 * yScalingFactor))
bezier4Path.lineCapStyle = .round
color.setStroke()
bezier4Path.lineWidth = 1 * lineWidthScalingFactor
bezier4Path.stroke()
//// Bezier 5 Drawing
let bezier5Path = UIBezierPath()
bezier5Path.moveToPoint(CGPointMake(6 * xScalingFactor, 7 * yScalingFactor))
bezier5Path.addCurveToPoint(CGPointMake(34 * xScalingFactor, 7 * yScalingFactor), controlPoint1: CGPointMake(6 * xScalingFactor, 7 * yScalingFactor), controlPoint2: CGPointMake(19 * xScalingFactor, 21 * yScalingFactor))
bezier5Path.lineCapStyle = .round
color.setStroke()
bezier5Path.lineWidth = 1 * lineWidthScalingFactor
bezier5Path.stroke()
//// Bezier 6 Drawing
let bezier6Path = UIBezierPath()
bezier6Path.moveToPoint(CGPointMake(6 * xScalingFactor, 33 * yScalingFactor))
bezier6Path.addCurveToPoint(CGPointMake(34 * xScalingFactor, 33 * yScalingFactor), controlPoint1: CGPointMake(6 * xScalingFactor, 33 * yScalingFactor), controlPoint2: CGPointMake(19 * xScalingFactor, 22 * yScalingFactor))
bezier6Path.lineCapStyle = .round
color.setStroke()
bezier6Path.lineWidth = 1 * lineWidthScalingFactor
bezier6Path.stroke()
endCenter()
} // end of func
*/
| [
-1
] |
9b2201971e27ca1cff216c32227dbfeb6705124d | a2363e36b38dad63a20c0f8e07fc313ac45449db | /ManyFiles/G/G56.swift | 4f4bfac83d562fdef073187396d7c209c8d014ba | [] | no_license | chkpnt/ManyFiles | 5099224d1354e82212392364dba3963ba2898b1a | 0d2f93408099b0078d055e90e26347432ae228e9 | refs/heads/master | 2021-05-11T01:18:22.123331 | 2018-01-21T18:55:34 | 2018-01-21T18:55:34 | 118,326,560 | 0 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 116 | swift | import Foundation
class G56 {
func someMethod() -> Int {
return Int(arc4random_uniform(100))
}
}
| [
-1
] |
851e2b0795ea1f030a275387cfd2a09c2ec8643b | 307a7573d3d4a670f340d8324afda395800bf966 | /MovieApp/Modal/MoviesModal/Results.swift | ed734d597c689b550b13febac789f4a68a1a96bc | [] | no_license | MoElnaggar14/FilmPioneer | 084a93f13b66336c1fae8ec4feb0b98f2594a03d | d4ba8212b74e951a0275ce1745f42a1cecc7f4a3 | refs/heads/master | 2020-05-24T12:49:42.099440 | 2019-05-17T05:31:42 | 2019-05-17T05:31:42 | 187,276,596 | 0 | 0 | null | 2019-05-17T20:19:01 | 2019-05-17T20:19:00 | null | UTF-8 | Swift | false | false | 5,345 | swift | //
// Results.swift
// Model file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport
import Foundation
class Results : NSObject, NSCoding{
var adult : Bool!
var backdropPath : String!
var genreIds : [Int]!
var id : Int!
var originalLanguage : String!
var originalTitle : String!
var overview : String!
var popularity : Float!
var posterPath : String!
var releaseDate : String!
var title : String!
var video : Bool!
var voteAverage : Double!
var voteCount : Int!
/**
* Instantiate the instance using the passed dictionary values to set the properties values
*/
init(fromDictionary dictionary: [String:Any]){
adult = dictionary["adult"] as? Bool
backdropPath = "https://image.tmdb.org/t/p/w185/\(dictionary["backdrop_path"] as? String ?? "")"
if dictionary["backdrop"] as? String != nil {
backdropPath = (dictionary["backdrop"] as! String)
}
genreIds = dictionary["genre_ids"] as? [Int]
id = dictionary["id"] as? Int
originalLanguage = dictionary["original_language"] as? String
originalTitle = dictionary["original_title"] as? String
overview = dictionary["overview"] as? String
popularity = dictionary["popularity"] as? Float
posterPath = "https://image.tmdb.org/t/p/w185/\(dictionary["poster_path"] as? String ?? "")"
if dictionary["poster"] as? String != nil {
posterPath = (dictionary["poster"] as! String)
}
releaseDate = dictionary["release_date"] as? String
title = dictionary["title"] as? String
video = dictionary["video"] as? Bool
voteAverage = Double(round(((dictionary["vote_average"] as? Double) ?? 0) * 10)/10)
voteCount = dictionary["vote_count"] as? Int
}
/**
* Returns all the available property values in the form of [String:Any] object where the key is the approperiate json key and the value is the value of the corresponding property
*/
func toDictionary() -> [String:Any]
{
var dictionary = [String:Any]()
if adult != nil{
dictionary["adult"] = adult
}
if backdropPath != nil{
dictionary["backdrop_path"] = backdropPath
}
if genreIds != nil{
dictionary["genre_ids"] = genreIds
}
if id != nil{
dictionary["id"] = id
}
if originalLanguage != nil{
dictionary["original_language"] = originalLanguage
}
if originalTitle != nil{
dictionary["original_title"] = originalTitle
}
if overview != nil{
dictionary["overview"] = overview
}
if popularity != nil{
dictionary["popularity"] = popularity
}
if posterPath != nil{
dictionary["poster_path"] = posterPath
}
if releaseDate != nil{
dictionary["release_date"] = releaseDate
}
if title != nil{
dictionary["title"] = title
}
if video != nil{
dictionary["video"] = video
}
if voteAverage != nil{
dictionary["vote_average"] = voteAverage
}
if voteCount != nil{
dictionary["vote_count"] = voteCount
}
return dictionary
}
/**
* NSCoding required initializer.
* Fills the data from the passed decoder
*/
@objc required init(coder aDecoder: NSCoder)
{
adult = aDecoder.decodeObject(forKey: "adult") as? Bool
backdropPath = aDecoder.decodeObject(forKey: "backdrop_path") as? String
genreIds = aDecoder.decodeObject(forKey: "genre_ids") as? [Int]
id = aDecoder.decodeObject(forKey: "id") as? Int
originalLanguage = aDecoder.decodeObject(forKey: "original_language") as? String
originalTitle = aDecoder.decodeObject(forKey: "original_title") as? String
overview = aDecoder.decodeObject(forKey: "overview") as? String
popularity = aDecoder.decodeObject(forKey: "popularity") as? Float
posterPath = aDecoder.decodeObject(forKey: "poster_path") as? String
releaseDate = aDecoder.decodeObject(forKey: "release_date") as? String
title = aDecoder.decodeObject(forKey: "title") as? String
video = aDecoder.decodeObject(forKey: "video") as? Bool
voteAverage = aDecoder.decodeObject(forKey: "vote_average") as? Double
voteCount = aDecoder.decodeObject(forKey: "vote_count") as? Int
}
/**
* NSCoding required method.
* Encodes mode properties into the decoder
*/
@objc func encode(with aCoder: NSCoder)
{
if adult != nil{
aCoder.encode(adult, forKey: "adult")
}
if backdropPath != nil{
aCoder.encode(backdropPath, forKey: "backdrop_path")
}
if genreIds != nil{
aCoder.encode(genreIds, forKey: "genre_ids")
}
if id != nil{
aCoder.encode(id, forKey: "id")
}
if originalLanguage != nil{
aCoder.encode(originalLanguage, forKey: "original_language")
}
if originalTitle != nil{
aCoder.encode(originalTitle, forKey: "original_title")
}
if overview != nil{
aCoder.encode(overview, forKey: "overview")
}
if popularity != nil{
aCoder.encode(popularity, forKey: "popularity")
}
if posterPath != nil{
aCoder.encode(posterPath, forKey: "poster_path")
}
if releaseDate != nil{
aCoder.encode(releaseDate, forKey: "release_date")
}
if title != nil{
aCoder.encode(title, forKey: "title")
}
if video != nil{
aCoder.encode(video, forKey: "video")
}
if voteAverage != nil{
aCoder.encode(voteAverage, forKey: "vote_average")
}
if voteCount != nil{
aCoder.encode(voteCount, forKey: "vote_count")
}
}
}
| [
-1
] |
37060acc8189e93b46245950308001d8acc94a04 | c4c7ff8d37853282a196cd211a3509483d6f8b37 | /Wake Up Bitch/Wake Up Bitch/utilities.swift | 9e3a1bc0aa8b867856b044b8ce3a6f352f33353d | [] | no_license | DavidWChen/waketfup | 05fded98896c5c4c48fa3860be68927c3f10901e | 08edddc40f394fd206cd6993434d065edd8db768 | refs/heads/master | 2021-01-18T19:32:13.875542 | 2017-04-02T10:00:51 | 2017-04-02T10:00:51 | 86,899,394 | 0 | 0 | null | 2017-04-01T08:49:29 | 2017-04-01T08:49:29 | null | UTF-8 | Swift | false | false | 329 | swift | //
// utilities.swift
// Wake Up Bitch
//
// Created by Kevin Kou on 4/1/17.
// Copyright © 2017 Kevin Kou. All rights reserved.
//
import Foundation
struct alarm {
var day: Int
var time: NSDate
var tone: Int
init(d: Int, t: NSDate, r: Int) {
day = d
time = t
tone = r
}
}
| [
-1
] |
ab1ff674af875a65e567965c0b3d4daa28db4be3 | c081f4135b081a2fbf7346f9545e2cab30164bc7 | /Source/UIImageEffects.swift | 16a913dceecbf93eddf37330fda9ecda719daebf | [] | no_license | lihuiyao1986/SwiftUIImageEffects | a382f53219d0d489bdf5c402e97f976f4bcc68dd | 317107951c1bdb9570ecb6e59a8d2de1ba623c7b | refs/heads/master | 2021-01-21T07:10:34.141516 | 2016-03-30T08:32:28 | 2016-03-30T08:32:28 | 55,757,163 | 1 | 0 | null | 2016-04-08T06:51:44 | 2016-04-08T06:51:44 | null | UTF-8 | Swift | false | false | 13,501 | swift | /*
File: UIImage+ImageEffects.m
Abstract: This is a category of UIImage that adds methods to apply blur and tint effects to an image. This is the code you’ll want to look out to find out how to use vImage to efficiently calculate a blur.
Version: 1.0
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
"Apple Software"), to use, reproduce, modify and redistribute the Apple
Software, with or without modifications, in source and/or binary forms;
provided that if you redistribute the Apple Software in its entirety and
without modifications, you must retain this notice and the following
text and disclaimers in all such redistributions of the Apple Software.
Neither the name, trademarks, service marks or logos of Apple Inc. may
be used to endorse or promote products derived from the Apple Software
without specific prior written permission from Apple. Except as
expressly stated in this notice, no other rights or licenses, express or
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Copyright (C) 2013 Apple Inc. All Rights Reserved.
Copyright © 2013 Apple Inc. All rights reserved.
WWDC 2013 License
NOTE: This Apple Software was supplied by Apple as part of a WWDC 2013
Session. Please refer to the applicable WWDC 2013 Session for further
information.
IMPORTANT: This Apple software is supplied to you by Apple Inc.
("Apple") in consideration of your agreement to the following terms, and
your use, installation, modification or redistribution of this Apple
software constitutes acceptance of these terms. If you do not agree with
these terms, please do not use, install, modify or redistribute this
Apple software.
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a non-exclusive license, under
Apple's copyrights in this original Apple software (the "Apple
Software"), to use, reproduce, modify and redistribute the Apple
Software, with or without modifications, in source and/or binary forms;
provided that if you redistribute the Apple Software in its entirety and
without modifications, you must retain this notice and the following
text and disclaimers in all such redistributions of the Apple Software.
Neither the name, trademarks, service marks or logos of Apple Inc. may
be used to endorse or promote products derived from the Apple Software
without specific prior written permission from Apple. Except as
expressly stated in this notice, no other rights or licenses, express or
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES
NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE
IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
EA1002
5/3/2013
*/
//
// UIImage.swift
// Today
//
// Created by Alexey Globchastyy on 15/09/14.
// Copyright (c) 2014 Alexey Globchastyy. All rights reserved.
//
import UIKit
import Accelerate
public extension UIImage {
public func applyLightEffect() -> UIImage? {
return applyBlurWithRadius(30, tintColor: UIColor(white: 1.0, alpha: 0.3), saturationDeltaFactor: 1.8)
}
public func applyExtraLightEffect() -> UIImage? {
return applyBlurWithRadius(20, tintColor: UIColor(white: 0.97, alpha: 0.82), saturationDeltaFactor: 1.8)
}
public func applyDarkEffect() -> UIImage? {
return applyBlurWithRadius(20, tintColor: UIColor(white: 0.11, alpha: 0.73), saturationDeltaFactor: 1.8)
}
public func applyTintEffectWithColor(tintColor: UIColor) -> UIImage? {
let effectColorAlpha: CGFloat = 0.6
var effectColor = tintColor
let componentCount = CGColorGetNumberOfComponents(tintColor.CGColor)
if componentCount == 2 {
var b: CGFloat = 0
if tintColor.getWhite(&b, alpha: nil) {
effectColor = UIColor(white: b, alpha: effectColorAlpha)
}
} else {
var red: CGFloat = 0
var green: CGFloat = 0
var blue: CGFloat = 0
if tintColor.getRed(&red, green: &green, blue: &blue, alpha: nil) {
effectColor = UIColor(red: red, green: green, blue: blue, alpha: effectColorAlpha)
}
}
return applyBlurWithRadius(10, tintColor: effectColor, saturationDeltaFactor: -1.0, maskImage: nil)
}
public func applyBlurWithRadius(blurRadius: CGFloat, tintColor: UIColor?, saturationDeltaFactor: CGFloat, maskImage: UIImage? = nil) -> UIImage? {
// Check pre-conditions.
if (size.width < 1 || size.height < 1) {
print("*** error: invalid size: \(size.width) x \(size.height). Both dimensions must be >= 1: \(self)")
return nil
}
if self.CGImage == nil {
print("*** error: image must be backed by a CGImage: \(self)")
return nil
}
if maskImage != nil && maskImage!.CGImage == nil {
print("*** error: maskImage must be backed by a CGImage: \(maskImage)")
return nil
}
let __FLT_EPSILON__ = CGFloat(FLT_EPSILON)
let screenScale = UIScreen.mainScreen().scale
let imageRect = CGRect(origin: CGPointZero, size: size)
var effectImage = self
let hasBlur = blurRadius > __FLT_EPSILON__
let hasSaturationChange = fabs(saturationDeltaFactor - 1.0) > __FLT_EPSILON__
if hasBlur || hasSaturationChange {
func createEffectBuffer(context: CGContext?) -> vImage_Buffer {
let data = CGBitmapContextGetData(context)
let width = vImagePixelCount(CGBitmapContextGetWidth(context))
let height = vImagePixelCount(CGBitmapContextGetHeight(context))
let rowBytes = CGBitmapContextGetBytesPerRow(context)
return vImage_Buffer(data: data, height: height, width: width, rowBytes: rowBytes)
}
UIGraphicsBeginImageContextWithOptions(size, false, screenScale)
let effectInContext = UIGraphicsGetCurrentContext()
CGContextScaleCTM(effectInContext, 1.0, -1.0)
CGContextTranslateCTM(effectInContext, 0, -size.height)
CGContextDrawImage(effectInContext, imageRect, self.CGImage)
var effectInBuffer = createEffectBuffer(effectInContext)
UIGraphicsBeginImageContextWithOptions(size, false, screenScale)
let effectOutContext = UIGraphicsGetCurrentContext()
var effectOutBuffer = createEffectBuffer(effectOutContext)
if hasBlur {
// A description of how to compute the box kernel width from the Gaussian
// radius (aka standard deviation) appears in the SVG spec:
// http://www.w3.org/TR/SVG/filters.html#feGaussianBlurElement
//
// For larger values of 's' (s >= 2.0), an approximation can be used: Three
// successive box-blurs build a piece-wise quadratic convolution kernel, which
// approximates the Gaussian kernel to within roughly 3%.
//
// let d = floor(s * 3*sqrt(2*pi)/4 + 0.5)
//
// ... if d is odd, use three box-blurs of size 'd', centered on the output pixel.
//
let inputRadius = blurRadius * screenScale
var radius = UInt32(floor(inputRadius * 3.0 * CGFloat(sqrt(2 * M_PI)) / 4 + 0.5))
if radius % 2 != 1 {
radius += 1 // force radius to be odd so that the three box-blur methodology works.
}
let imageEdgeExtendFlags = vImage_Flags(kvImageEdgeExtend)
vImageBoxConvolve_ARGB8888(&effectInBuffer, &effectOutBuffer, nil, 0, 0, radius, radius, nil, imageEdgeExtendFlags)
vImageBoxConvolve_ARGB8888(&effectOutBuffer, &effectInBuffer, nil, 0, 0, radius, radius, nil, imageEdgeExtendFlags)
vImageBoxConvolve_ARGB8888(&effectInBuffer, &effectOutBuffer, nil, 0, 0, radius, radius, nil, imageEdgeExtendFlags)
}
var effectImageBuffersAreSwapped = false
if hasSaturationChange {
let s: CGFloat = saturationDeltaFactor
let floatingPointSaturationMatrix: [CGFloat] = [
0.0722 + 0.9278 * s, 0.0722 - 0.0722 * s, 0.0722 - 0.0722 * s, 0,
0.7152 - 0.7152 * s, 0.7152 + 0.2848 * s, 0.7152 - 0.7152 * s, 0,
0.2126 - 0.2126 * s, 0.2126 - 0.2126 * s, 0.2126 + 0.7873 * s, 0,
0, 0, 0, 1
]
let divisor: CGFloat = 256
let matrixSize = floatingPointSaturationMatrix.count
var saturationMatrix = [Int16](count: matrixSize, repeatedValue: 0)
for i: Int in 0 ..< matrixSize {
saturationMatrix[i] = Int16(round(floatingPointSaturationMatrix[i] * divisor))
}
if hasBlur {
vImageMatrixMultiply_ARGB8888(&effectOutBuffer, &effectInBuffer, saturationMatrix, Int32(divisor), nil, nil, vImage_Flags(kvImageNoFlags))
effectImageBuffersAreSwapped = true
} else {
vImageMatrixMultiply_ARGB8888(&effectInBuffer, &effectOutBuffer, saturationMatrix, Int32(divisor), nil, nil, vImage_Flags(kvImageNoFlags))
}
}
if !effectImageBuffersAreSwapped {
effectImage = UIGraphicsGetImageFromCurrentImageContext()
}
UIGraphicsEndImageContext()
if effectImageBuffersAreSwapped {
effectImage = UIGraphicsGetImageFromCurrentImageContext()
}
UIGraphicsEndImageContext()
}
// Set up output context.
UIGraphicsBeginImageContextWithOptions(size, false, screenScale)
let outputContext = UIGraphicsGetCurrentContext()
CGContextScaleCTM(outputContext, 1.0, -1.0)
CGContextTranslateCTM(outputContext, 0, -size.height)
// Draw base image.
CGContextDrawImage(outputContext, imageRect, self.CGImage)
// Draw effect image.
if hasBlur {
CGContextSaveGState(outputContext)
if let image = maskImage {
CGContextClipToMask(outputContext, imageRect, image.CGImage);
}
CGContextDrawImage(outputContext, imageRect, effectImage.CGImage)
CGContextRestoreGState(outputContext)
}
// Add in color tint.
if let color = tintColor {
CGContextSaveGState(outputContext)
CGContextSetFillColorWithColor(outputContext, color.CGColor)
CGContextFillRect(outputContext, imageRect)
CGContextRestoreGState(outputContext)
}
// Output image is ready.
let outputImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return outputImage
}
}
| [
141387
] |
d2f3100c7229e4f2c9d1d49bb45651c972cb4f7c | 9860776abb3b622b43a75572e520e90a7fdca181 | /NYTimes/Modules/DetailsModule/Implementation/DetailsViewController.swift | 6d2a1b1654a4722c5f46073b8b4641c4d8d00cb7 | [] | no_license | msplapps/NYTimesMostPopular | 25d5494fbbdbc723fd19896b56fb1ab8ff20209f | 45c9fa37d3531027f483f22970b44a5fe1ee82c9 | refs/heads/master | 2020-03-21T07:26:47.558578 | 2018-05-14T07:55:50 | 2018-05-14T07:55:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 6,330 | swift | //
// DetailsViewController.swift
// NYTimes
//
// Created by Zelux on 2018. 04. 30..
// Copyright © 2018. Zelux. All rights reserved.
//
import Foundation
import UIKit
class DetailsViewController: BaseViewController, DetailsViewControllerProtocol {
var article: Article!
var scrollView: UIScrollView!
var stackView: UIStackView!
var articleTypeLabel: UILabel!
var imageView: UIImageView!
var dateLabel: UILabel!
var titleLabel: UILabel!
var detailLabel: UILabel!
var authorLabel: UILabel!
var safariButton: UIButton!
var footerStackView: UIStackView!
var footerLogoImageView: UIImageView!
var copyrightLabel: UILabel!
var detailsInteractor: DetailsInteractorProtocol {
return interactor as! DetailsInteractorProtocol
}
// MARK: ctor
init(withArticle article: Article) {
super.init()
self.article = article
navigationItem.title = "Article details"
navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .action, target: self, action: #selector(actionButtonTapped(sender:)))
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
// MARK: Overrides
override func initSubviews() {
scrollView = UIScrollView()
stackView = UIStackView()
articleTypeLabel = UILabel()
imageView = UIImageView(image: UIImage(named: "PlaceHolderImage_Detail"))
dateLabel = UILabel()
titleLabel = UILabel()
detailLabel = UILabel()
authorLabel = UILabel()
safariButton = UIButton(type: .system)
footerStackView = UIStackView()
footerLogoImageView = UIImageView(image: UIImage(named: "NYT_footer_logo"))
copyrightLabel = UILabel()
}
override func addSubviews() {
view.addSubview(scrollView)
scrollView.addSubview(stackView)
stackView.addArrangedSubview(articleTypeLabel)
stackView.addArrangedSubview(imageView)
stackView.addArrangedSubview(dateLabel)
stackView.addArrangedSubview(titleLabel)
stackView.addArrangedSubview(detailLabel)
stackView.addArrangedSubview(authorLabel)
stackView.addArrangedSubview(safariButton)
stackView.addArrangedSubview(footerStackView)
footerStackView.addArrangedSubview(footerLogoImageView)
footerStackView.addArrangedSubview(copyrightLabel)
}
override func viewDidLoad() {
super.viewDidLoad()
DetailsConfigurator.configureDetailsScreen(viewController: self)
scrollView.alwaysBounceVertical = true
scrollView.translatesAutoresizingMaskIntoConstraints = false
stackView.spacing = 7.0;
stackView.axis = .vertical;
stackView.translatesAutoresizingMaskIntoConstraints = false;
articleTypeLabel.font = UIFont.systemFont(ofSize: 12)
articleTypeLabel.text = article.type?.uppercased()
imageView.contentMode = .scaleAspectFit
if let media = article.media, !media.isEmpty, let metaData = media[0].mediaMetadata, !metaData.isEmpty {
if let imageURL = metaData[0].url, let url = URL(string: imageURL) {
imageView.af_setImage(withURL: url)
}
}
dateLabel.font = UIFont.systemFont(ofSize: 12)
dateLabel.text = article.published_date
dateLabel.textColor = AppConstant.AppDarkGrayColor
titleLabel.numberOfLines = 0
titleLabel.font = UIFont(name: "Cheltenham", size: 20)
titleLabel.text = article.title
detailLabel.numberOfLines = 0
detailLabel.textColor = AppConstant.AppDarkGrayColor
detailLabel.text = article.abstract
detailLabel.font = UIFont(name: "Georgia", size: 14)
if let author = article.byline, !author.isEmpty {
authorLabel.text = author
authorLabel.font = UIFont.systemFont(ofSize: 12)
authorLabel.textColor = AppConstant.AppDarkGrayColor
}
safariButton.titleLabel?.font = UIFont(name: "Georgia", size: 14)
safariButton.setTitle("Click here for full article", for: .normal)
safariButton.addTarget(self, action: #selector(linkToFullArticlePressed(sender:)), for: .touchUpInside)
footerStackView.alignment = .center
footerStackView.axis = .vertical
footerStackView.spacing = 3.0
footerLogoImageView.contentMode = .center
copyrightLabel.textColor = AppConstant.AppDarkGrayColor
copyrightLabel.font = UIFont(name: "Georgia", size: 14)
copyrightLabel.text = "Copyright"
}
override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
if isMovingFromParentViewController {
self.interactor = nil
}
}
// MARK: Constraints
override func updateViewConstraints() {
scrollView.snp.remakeConstraints { (make) in
make.leading.trailing.top.bottom.equalToSuperview()
}
stackView.snp.remakeConstraints { (make) in
make.leading.trailing.top.equalToSuperview().offset(6)
make.bottom.equalToSuperview().offset(-12)
make.centerX.equalToSuperview()
}
imageView.snp.remakeConstraints { (make) in
make.width.equalToSuperview()
}
super.updateViewConstraints()
}
@objc func linkToFullArticlePressed(sender: UIButton) {
if let url = URL(string: article.url!), UIApplication.shared.canOpenURL(url) {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
}
@objc func actionButtonTapped(sender: UIBarButtonItem) {
if let url = article.url {
let activityController = UIActivityViewController(activityItems: [url], applicationActivities: nil)
activityController.popoverPresentationController?.barButtonItem = sender
activityController.popoverPresentationController?.permittedArrowDirections = .up
present(activityController, animated: true, completion: nil)
}
}
}
| [
-1
] |
af51dfde5d042547bab3154f81b55a374c20325f | 2601182fe600612f026d2f5295d7d03d61a15a34 | /MovieDp/Scenarios/Movies/ViewControllers/MovieDetails/MovieDetailsViewController.swift | 47cf9a5cee6280718e0f5252be6e750882da9a71 | [] | no_license | Amr1440/movie_db | 0a35ba75f1c7ccea3dbb3dc865735d60a2159243 | 696d4be984277793e1f063a187496d8d963fe619 | refs/heads/master | 2023-02-21T03:40:13.966493 | 2021-01-20T11:53:41 | 2021-01-20T11:53:41 | 331,007,521 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,879 | swift | //
// MovieDetailsViewController.swift
// MovieDp
//
// Created by Amr Sayed on 1/5/21.
//
import UIKit
import TagListView
import AlamofireImage
class MovieDetailsViewController: BaseViewController {
@IBOutlet weak var movieImage: UIImageView!
@IBOutlet weak var titleLabel: UILabel!
@IBOutlet weak var releaseDate: UILabel!
@IBOutlet weak var tagView: TagListView!
@IBOutlet weak var movieDetailsTextView: UILabel!
var selectedMovie: Movie?
var viewModel: MoviesViewModel?
override func viewDidLoad() {
super.viewDidLoad()
showDefaultLoader()
setupUI()
viewModel?.movieDetailsUpdateSubject.subscribe(onNext: { [weak self] movie in
DispatchQueue.main.async {
self?.hideDefaultLoader()
self?.selectedMovie = movie
self?.setupUI()
}
}).disposed(by: disposeBag)
viewModel?.errorSubject.subscribe(onNext: { [weak self] error in
DispatchQueue.main.async {
self?.hideDefaultLoader()
self?.showErrorMessage(title: "Error", message: error?.message ?? "Something went wrong")
}
}).disposed(by: disposeBag)
viewModel?.fetchMovieDetails(movieId: selectedMovie?.id ?? 0)
}
func setupUI () {
if let url = URL(string: Configurations.ImagesUrl + (selectedMovie?.posterPath ?? "")) {
movieImage.af_setImage(withURL: url)
}
titleLabel.text = selectedMovie?.title
movieDetailsTextView.text = selectedMovie?.overview
releaseDate.text = selectedMovie?.releaseDate
if let geners = selectedMovie?.genres {
let genersNames = geners.map{$0.name ?? ""}
self.tagView.addTags(genersNames)
}
}
}
| [
-1
] |
2c96fc91f4ef694c7b2d235d99f46e18b6d6e0f7 | 301191d781d8f275122c61ef5e8c13ce55b569c4 | /RottenTomato/MovieCollectionCell.swift | 8715d760a590f3241aaf0b1cda8935deef7053d2 | [] | no_license | datdn1/Rotten-Tomatoes | 65c143a7967b530748e0b3b6641b25856c5590bf | aaee8ddb839ee95a2558a3518689ef8bfaf12e72 | refs/heads/master | 2021-01-01T05:51:05.011412 | 2015-09-01T02:59:05 | 2015-09-01T02:59:05 | 41,694,239 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 446 | swift | //
// MovieCollectionCell.swift
// RottenTomato
//
// Created by datdn1 on 8/31/15.
// Copyright (c) 2015 datdn1. All rights reserved.
//
import UIKit
class MovieCollectionCell: UICollectionViewCell
{
@IBOutlet weak var posterImage: UIImageView!
@IBOutlet weak var titleMovie: UILabel!
@IBOutlet weak var mpaaRating: UILabel!
@IBOutlet weak var timeMovie: UILabel!
@IBOutlet weak var audienceScore: UILabel!
}
| [
-1
] |
3e78cee4c66c57db29f08dc638f90d462b60f905 | 8f2db9a95f7e8c20a59c0437425dbce954aec73c | /Sources/AsyncNetwork/Socket/SocketConfig.swift | 687a45bc9b451bd998f4eab8ee9f3ea49208247d | [
"MIT"
] | permissive | kingctan/AsyncNetwork | 8bf3f33b4869a75da2cbb573658dd11a72885908 | 3942870943d64bc9e02d2a1c4ce67efab1e148c3 | refs/heads/master | 2021-02-27T19:58:05.769813 | 2018-06-24T18:00:54 | 2018-06-24T18:00:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,954 | swift | //
// SocketConfig.swift
// AsyncNetwork
//
// Created by Kevin Hoogheem on 3/4/17.
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#if os(Linux)
import Glibc
#else
import Darwin
#endif
public struct SocketConfig {
public var addressFamily: AddressFamily
public let socketType: SocketType
public let protocolType: Protocol
public init(family: AddressFamily, socketType: SocketType, protocolType: Protocol){
self.addressFamily = family
self.socketType = socketType
self.protocolType = protocolType
}
public static func TCP(family: AddressFamily = .unspecified) -> SocketConfig {
return self.init(family: family, socketType: .stream, protocolType: .TCP)
}
public static func UDP(family: AddressFamily = .unspecified) -> SocketConfig {
return self.init(family: family, socketType: .dataGram, protocolType: .UDP)
}
}
| [
40453,
40458,
437258,
40460,
437261,
40466,
40469,
40471,
437273,
40477,
40482,
98344,
98346,
98349,
187442,
144435,
329778,
437302,
144440,
144442,
124987,
144444,
144445,
174139,
189502,
336446,
316993,
336450,
336451,
316996,
437314,
174159,
336465,
336467,
336469,
336470,
336471,
336473,
174170,
437338,
336479,
336481,
111202,
336482,
437349,
185446,
336487,
336488,
185451,
115820,
185453,
312427,
185455,
437356,
437364,
242807,
437384,
125066,
437396,
52887,
189593,
229532,
312476,
52896,
228512,
312480,
312483,
52900,
215205,
215212,
437426,
437428,
241846,
437431,
437433,
242361,
241852,
437440,
38081,
241859,
241860,
437443,
241862,
437445,
241864,
292041,
248524,
437453,
241871,
241873,
437458,
203990,
212694,
241878,
262359,
262361,
204000,
204003,
34531,
192229,
192231,
192232,
34537,
34540,
34541,
241904,
176370,
241907,
176373,
260342,
216829,
241926,
276230,
279818,
276236,
206103,
241944,
313111,
313113,
318238,
241952,
241954,
241955,
187180,
141627,
141629,
141632,
290113,
141634,
279367,
241992,
141641,
141642,
141646,
141652,
187223,
223064,
223069,
141664,
141665,
223076,
128873,
128874,
380266,
141676,
169837,
227180,
223087,
227183,
128881,
228721,
128883,
245102,
190844,
363913,
141711,
60304,
201617,
197018,
197021,
329120,
141220,
23487,
23499,
59349,
222693,
174063,
152560,
174067
] |
0ba4279880ebf64f19856324913334f68fef5efe | 64fd0b43f798e6c32a16ad834af8c5ccd1998e99 | /Favoured/VotePollPageViewController.swift | 604868c1aeb6613f041a3df8646e460b7267eb55 | [] | no_license | wouterdevos/Favoured | 4626191b44ff2c1775de486dea46f64e3943180b | 20b79acede9bd4b53cfec708877c7ddc68e9a913 | refs/heads/master | 2021-01-21T04:55:38.642039 | 2016-06-15T14:13:50 | 2016-06-15T14:13:50 | 55,850,237 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 11,244 | swift | //
// PollViewController.swift
// Favoured
//
// Created by Wouter de Vos on 2016/05/08.
// Copyright © 2016 Wouter. All rights reserved.
//
import UIKit
class VotePollPageViewController: FavouredViewController, UIPageViewControllerDataSource, UIPageViewControllerDelegate, VotePollViewControllerDelegate {
static let Identifier = "VotePollPageViewController"
let NetworkTimeout: NSTimeInterval = 30
var poll: Poll!
var voteState = VoteState.Disabled
var networkTimer: NSTimer?
var isError = false
var pageViewController: UIPageViewController!
var pollPictureThumbnails:[UIImage?]!
var pollPictures: [UIImage?]!
var votePollViewControllers = [UIViewController]()
// MARK: - Interface builder outlets and actions.
@IBOutlet weak var questionLabel: UILabel!
@IBOutlet weak var thumbnailsStackView: UIStackView!
@IBOutlet weak var pageViewControllerView: UIView!
// MARK: - Lifecycle methods.
override func viewDidLoad() {
super.viewDidLoad()
questionLabel.text = poll.question
initPollPictureButtons()
initPageViewController()
initVoteState()
}
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
addObservers()
}
override func viewWillDisappear(animated: Bool) {
super.viewWillDisappear(animated)
removeObservers()
networkTimer?.invalidate()
}
// MARK: - UIPageViewControllerDataSource and UIPageViewControllerDelegate methods.
func pageViewController(pageViewController: UIPageViewController, viewControllerBeforeViewController viewController: UIViewController) -> UIViewController? {
let votePollViewController = viewController as! VotePollViewController
let pageIndex = votePollViewController.pageIndex - 1
return viewControllerAtIndex(pageIndex)
}
func pageViewController(pageViewController: UIPageViewController, viewControllerAfterViewController viewController: UIViewController) -> UIViewController? {
let votePollViewController = viewController as! VotePollViewController
let pageIndex = votePollViewController.pageIndex + 1
return viewControllerAtIndex(pageIndex)
}
func pageViewController(pageViewController: UIPageViewController, didFinishAnimating finished: Bool, previousViewControllers: [UIViewController], transitionCompleted completed: Bool) {
if completed {
let votePollViewController = pageViewController.viewControllers?[0] as! VotePollViewController
updatePollPictureButtons(votePollViewController.pageIndex)
}
}
// MARK: - VotePollViewControllerDelegate methods.
func voteSelected(pageIndex: Int) {
DataModel.voteOnPoll(poll, pollOptionIndex: pageIndex)
navigationController?.popViewControllerAnimated(true)
}
// MARK: - Initialisation methods.
func initPollPictureButtons() {
pollPictureThumbnails = DataModel.getPollPictures(poll, isThumbnail: true, rowIndex: nil)
startNetworkTimer(pollPictureThumbnails)
for (index, subview) in thumbnailsStackView.arrangedSubviews.enumerate() {
// Check if there is an image for the current poll picture thumbnail
let hasImage = index < pollPictureThumbnails.count
if hasImage {
let pollPictureThumbnail = pollPictureThumbnails[index]
let image = pollPictureThumbnail != nil ? pollPictureThumbnail! : UIImage(named: "PollPicture")!
updatePollPictureButton(subview, image: image, highlighted: index == 0)
} else {
subview.removeFromSuperview()
}
}
}
func initPageViewController() {
pollPictures = DataModel.getPollPictures(poll, isThumbnail: false, rowIndex: 0)
startNetworkTimer(pollPictures)
pageViewController = storyboard?.instantiateViewControllerWithIdentifier("PageViewController") as! UIPageViewController
pageViewController.dataSource = self
pageViewController.delegate = self
pageViewController.setViewControllers([viewControllerAtIndex(0)], direction: .Forward, animated: true, completion: nil)
pageViewController.view.frame = CGRect(x: 0, y: 0, width: pageViewControllerView.frame.width, height: pageViewControllerView.frame.height)
addChildViewController(pageViewController)
pageViewControllerView.addSubview(pageViewController.view)
pageViewController.didMoveToParentViewController(self)
}
func initVoteState() {
if DataModel.getUserId() != poll.userId {
DataModel.getPollOptionIndex(poll)
} else {
updatePollPictureButtonVotes()
}
}
func addObservers() {
defaultCenter.addObserver(self, selector: #selector(photoDownloadCompleted(_:)), name: NotificationNames.PhotoDownloadCompleted, object: nil)
defaultCenter.addObserver(self, selector: #selector(getPollOptionIndexCompleted(_:)), name: NotificationNames.GetPollOptionIndexCompleted, object: nil)
}
func removeObservers() {
defaultCenter.removeObserver(self, name: NotificationNames.PhotoDownloadCompleted, object: nil)
defaultCenter.removeObserver(self, name: NotificationNames.GetPollOptionIndexCompleted, object: nil)
}
// MARK: - REST calls and response methods.
func photoDownloadCompleted(notification: NSNotification) {
guard let userInfo = notification.userInfo else {
print(Error.UserInfoNoData)
return
}
networkTimer?.invalidate()
let photo = userInfo[NotificationData.Photo] as! Photo
let currentVotePollViewController = pageViewController.viewControllers![0] as! VotePollViewController
let pollPictureIndex = getPollPictureIndex(photo)
if photo.isThumbnail {
pollPictureThumbnails[pollPictureIndex] = photo.image
let pollPictureButton = thumbnailsStackView.arrangedSubviews[pollPictureIndex] as! UIButton
pollPictureButton.setBackgroundImage(photo.image, forState: .Normal)
} else {
pollPictures[pollPictureIndex] = photo.image
let pageIndex = currentVotePollViewController.pageIndex
if (pageIndex == pollPictureIndex) {
currentVotePollViewController.pollPicture = photo.image
currentVotePollViewController.updatePollPicture()
}
}
}
func getPollOptionIndexCompleted(notification: NSNotification) {
if let userInfo = notification.userInfo {
let pollOptionIndex = userInfo[NotificationData.PollOptionIndex] as! Int
voteState = VoteState.Cast(pollOptionIndex)
updatePollPictureButtonVotes()
} else {
voteState = VoteState.Pending
}
updateVotePollViewController()
}
// MARK: - Update methods.
func updatePollPictureButtons(pollOptionIndex: Int) {
for (index, subview) in thumbnailsStackView.arrangedSubviews.enumerate() {
updatePollPictureButton(subview, image: nil, highlighted: index == pollOptionIndex)
}
}
func updatePollPictureButton(subview: UIView, image: UIImage?, highlighted: Bool) {
let pollPictureButton = subview as! UIButton
pollPictureButton.highlighted = highlighted
pollPictureButton.enabled = !highlighted
if let image = image {
pollPictureButton.setBackgroundImage(image, forState: .Normal)
}
}
func updatePollPictureButtonVotes() {
let voteCountTotal = getVoteCountTotal()
for (index, subview) in thumbnailsStackView.arrangedSubviews.enumerate() {
let pollOption = poll.pollOptions[index]
let pollPictureButton = subview as! UIButton
let title = getVotePercentage(pollOption.voteCount, voteCountTotal: voteCountTotal)
pollPictureButton.setTitle(title, forState: .Normal)
}
}
func updateVotePollViewController() {
let votePollViewController = pageViewController.viewControllers?[0] as! VotePollViewController
votePollViewController.voteState = voteState
votePollViewController.updateVoteButton()
}
// MARK: - Convenience methods.
func viewControllerAtIndex(index: Int) -> VotePollViewController {
let pollOptions = poll.pollOptions
var currentIndex = index
if currentIndex < 0 {
currentIndex = pollOptions.count - 1
} else if currentIndex >= pollOptions.count {
currentIndex = 0
}
let votePollViewController = storyboard?.instantiateViewControllerWithIdentifier(VotePollViewController.Identifier) as! VotePollViewController
votePollViewController.pageIndex = currentIndex
votePollViewController.pollPicture = pollPictures[currentIndex]
votePollViewController.voteState = voteState
votePollViewController.isError = isError
votePollViewController.delegate = self
return votePollViewController
}
func getPollPictureIndex(photo: Photo) -> Int {
var pollPictureIndex = 0
for (index, pollOption) in poll.pollOptions.enumerate() {
let id = photo.isThumbnail ? pollOption.pollPictureThumbnailId : pollOption.pollPictureId
if photo.id == id {
pollPictureIndex = index
}
}
return pollPictureIndex
}
func getVoteCountTotal() -> Int {
var voteCountTotal = 0
for pollOption in poll.pollOptions {
voteCountTotal += pollOption.voteCount
}
return voteCountTotal
}
func getVotePercentage(voteCount: Int, voteCountTotal: Int) -> String {
let voteCountFraction = voteCountTotal > 0 ? Float(voteCount) * 100 / Float(voteCountTotal) : 0.0
return String(format: "%.0f", voteCountFraction) + "%"
}
func startNetworkTimer(images: [UIImage?]) {
guard networkTimer == nil else {
return
}
var imagesDownloading = false
for image in images {
if image == nil {
imagesDownloading = true
break
}
}
guard imagesDownloading else {
return
}
networkTimer = NSTimer.scheduledTimerWithTimeInterval(NetworkTimeout, target: self, selector: #selector(showNetworkAlertController), userInfo: nil, repeats: false)
}
func showNetworkAlertController() {
if !isError {
isError = true
let currentVotePollViewController = pageViewController.viewControllers![0] as! VotePollViewController
currentVotePollViewController.isError = isError
currentVotePollViewController.updatePollPicture()
createAlertController(Title.NetworkError, message: Error.UnableToDownloadImage)
}
}
}
| [
-1
] |
6e7865a46bff86e3daf2314cd0a98923baca518d | 47554aebf3a829114573ce483e85eecb187dee47 | /AdventCalendar/DayCollectionViewCell.swift | 5154bf4212bffca6392b2e3d96e467bfa0cf9461 | [
"MIT"
] | permissive | huokedu/GIF-Keyboard | 3a5c4b34bb588e9fcc404a1d638266dd394d840f | 5f53c5bea848caa8bf5f5d3a5c33c3329be99ad7 | refs/heads/master | 2021-01-13T16:45:08.033102 | 2015-12-23T23:35:56 | 2015-12-23T23:35:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,031 | swift | //
// DayCollectionViewCell.swift
// AdventCalendar
//
// Created by Romain Pouclet on 2015-11-30.
// Copyright © 2015 Perfectly-Cooked. All rights reserved.
//
import UIKit
class DayCollectionViewCell: UICollectionViewCell {
@IBOutlet weak var dayLabel: UILabel! {
didSet {
dayLabel.textColor = .whiteColor()
dayLabel.font = UIFont(name: "PWChristmasfont", size: 50)!
}
}
override func awakeFromNib() {
super.awakeFromNib()
contentView.layer.borderColor = UIColor.whiteColor().CGColor
contentView.layer.borderWidth = 1.0
contentView.layer.cornerRadius = 20
}
override var selected: Bool {
didSet {
if selected {
contentView.backgroundColor = .whiteColor()
dayLabel.textColor = .blackColor()
} else {
contentView.backgroundColor = .clearColor()
dayLabel.textColor = .whiteColor()
}
}
}
}
| [
-1
] |
af5fa808a076d4836181026d5676e8983c124ab2 | 112b670135d3ede713321471951ddac73527ae0a | /Roshambo/AppDelegate.swift | 3ff92761e8a692b3cd6a19afa45bdc1fc3d30487 | [] | no_license | shashvati16/Roshambo | a6700e7f0b6c5b807972dcc5cc45d5ab5b0a80f5 | b3c1cfabe3f9427d5c890c6bd294e2de650307aa | refs/heads/master | 2021-08-11T18:26:29.764757 | 2017-11-14T02:22:52 | 2017-11-14T02:22:52 | 110,624,805 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,174 | swift | //
// AppDelegate.swift
// Roshambo
//
// Created by Sambit Mohapatra on 11/12/17.
// Copyright © 2017 udacity. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
| [
229380,
229383,
229385,
278539,
294924,
229388,
278542,
229391,
327695,
278545,
229394,
278548,
229397,
229399,
229402,
352284,
229405,
278556,
278559,
229408,
294950,
229415,
229417,
327722,
237613,
229422,
360496,
229426,
237618,
229428,
311349,
286774,
286776,
319544,
286778,
229432,
204856,
352318,
286791,
237640,
286797,
278605,
311375,
163920,
237646,
196692,
319573,
311383,
278623,
278626,
319590,
311400,
278635,
303212,
278639,
131192,
278648,
237693,
303230,
327814,
303241,
131209,
417930,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
286916,
295110,
286922,
286924,
286926,
319694,
286928,
131281,
131278,
278743,
278747,
295133,
131299,
319716,
237807,
303345,
286962,
131314,
229622,
327930,
278781,
278783,
278785,
237826,
319751,
286987,
319757,
311569,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
295220,
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,
311850,
279084,
172591,
172598,
172607,
172609,
172612,
377413,
172614,
172618,
303690,
33357,
303696,
279124,
172634,
262752,
254563,
172644,
311911,
189034,
295533,
172655,
172656,
352880,
295538,
189040,
172660,
287349,
189044,
189039,
287355,
287360,
295553,
172675,
295557,
311942,
303751,
287365,
352905,
311946,
287371,
279178,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
172702,
303773,
164509,
172705,
287394,
172707,
303780,
287390,
287398,
205479,
287400,
279208,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
328381,
287423,
328384,
172737,
279231,
287427,
312005,
312006,
107208,
172748,
287436,
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,
303976,
336744,
303985,
303987,
328563,
303991,
303997,
295806,
295808,
295813,
304005,
320391,
304007,
213895,
304009,
304011,
304013,
295822,
213902,
279438,
189329,
295825,
304019,
58262,
304023,
304027,
279452,
279461,
279462,
304042,
213931,
230327,
304055,
287675,
230334,
304063,
238528,
304065,
213954,
189378,
156612,
197580,
312272,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
295945,
230413,
197645,
295949,
320528,
140312,
295961,
238620,
304164,
304170,
304175,
238641,
238652,
238655,
230465,
238658,
336964,
296004,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
205931,
296044,
164973,
205934,
279661,
312432,
279669,
337018,
189562,
279679,
304258,
279683,
66690,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
337067,
165035,
238766,
165038,
230576,
238770,
304311,
230592,
312518,
279750,
230600,
230607,
148690,
320727,
279769,
304348,
304354,
296163,
320740,
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,
296262,
230727,
238919,
296264,
320840,
296267,
296271,
222545,
230739,
312663,
222556,
337244,
230752,
312676,
230760,
173418,
148843,
230763,
410987,
230768,
296305,
312692,
230773,
304505,
304506,
279929,
181626,
181631,
148865,
312711,
296331,
288140,
288144,
230800,
337306,
288154,
288160,
173472,
288162,
288164,
279975,
304555,
370092,
279983,
173488,
288176,
279985,
312755,
296373,
312759,
279991,
288185,
337335,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
148946,
370130,
222676,
288210,
288212,
288214,
239064,
288217,
288218,
280027,
288220,
329177,
239070,
288224,
370146,
280034,
288226,
280036,
288229,
280038,
288230,
288232,
288234,
320998,
288236,
288238,
288240,
288242,
296435,
288244,
288250,
296446,
321022,
402942,
148990,
296450,
206336,
230916,
230919,
230923,
304651,
304653,
370187,
230940,
222752,
108066,
296486,
296488,
157229,
239152,
230961,
157236,
288320,
288325,
124489,
280145,
288338,
280149,
288344,
280152,
239194,
280158,
403039,
370272,
239202,
312938,
280183,
280185,
280188,
280191,
116354,
280194,
280208,
280211,
288408,
280218,
280222,
419489,
190118,
198310,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
419522,
280260,
419525,
206536,
280264,
206539,
206541,
206543,
263888,
313044,
280276,
321239,
280283,
313052,
18140,
288478,
313055,
419555,
321252,
313066,
288494,
280302,
321266,
288499,
419570,
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,
337732,
280388,
304968,
280402,
173907,
313171,
313176,
42842,
280419,
321381,
296809,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
313258,
321458,
296883,
124853,
214966,
296890,
10170,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
354265,
354270,
239586,
313320,
354281,
231404,
124913,
165876,
321528,
239612,
313340,
288764,
239617,
313347,
288773,
313358,
305176,
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,
313451,
223341,
280687,
149618,
215154,
313458,
280691,
313464,
329850,
321659,
288895,
321670,
215175,
141455,
275606,
313498,
100520,
288936,
288940,
288947,
280755,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
313548,
321740,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
280811,
280817,
125171,
280819,
157940,
182517,
280823,
280825,
280827,
280830,
280831,
280833,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
305464,
280888,
280891,
289087,
108865,
280897,
280900,
305480,
239944,
280906,
239947,
305485,
305489,
280919,
248153,
354653,
354656,
313700,
280937,
313705,
190832,
280946,
223606,
313720,
280956,
239997,
280959,
313731,
199051,
240011,
289166,
240017,
297363,
190868,
240021,
297365,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
289210,
305594,
281024,
289218,
289221,
289227,
281047,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
240132,
330244,
223752,
150025,
338440,
281095,
223757,
281102,
223763,
223765,
322074,
281116,
182819,
289317,
281127,
281135,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
338528,
338532,
199273,
281196,
19053,
158317,
313973,
297594,
281210,
158347,
264845,
182926,
133776,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
314045,
314047,
314051,
199364,
297671,
158409,
256716,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322314,
322318,
281361,
281372,
322341,
215850,
281388,
281401,
289593,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
281442,
174955,
224110,
207733,
207737,
158596,
183172,
338823,
322440,
314249,
183184,
142226,
289687,
240535,
289694,
289696,
289700,
289712,
281529,
289724,
183260,
289762,
322534,
297961,
183277,
322550,
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,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
290171,
314747,
306555,
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,
282127,
290321,
282130,
290325,
282133,
241175,
290328,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
282186,
224849,
282195,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
282261,
175770,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
306856,
282295,
323260,
282300,
323266,
282310,
282319,
306897,
241362,
306904,
282328,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
241450,
282410,
306988,
306991,
315184,
323376,
315190,
241464,
159545,
282425,
298811,
118593,
307009,
413506,
307012,
241475,
315211,
307027,
315221,
315223,
241496,
241498,
307035,
307040,
110433,
282465,
241509,
110438,
298860,
110445,
282478,
315249,
315253,
315255,
339838,
315267,
282499,
315269,
241544,
282505,
241546,
241548,
298896,
282514,
298898,
241556,
298901,
44948,
241560,
282520,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
241581,
241583,
323504,
241586,
290739,
241588,
282547,
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,
307211,
282639,
290835,
282645,
241693,
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,
307338,
233613,
241813,
307352,
299164,
241821,
299167,
315552,
184479,
184481,
184486,
307370,
307372,
307374,
307376,
299185,
323763,
184503,
299191,
176311,
307385,
258235,
307388,
176316,
307390,
299200,
307394,
299204,
307396,
184518,
307399,
323784,
233679,
307409,
307411,
299225,
233701,
307432,
282881,
184586,
282893,
291089,
282906,
291104,
233766,
299304,
295583,
307508,
315701,
332086,
307510,
307512,
307515,
307518,
282942,
282947,
323917,
282957,
233808,
323921,
315733,
323926,
233815,
315739,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
315801,
291226,
242075,
283033,
61855,
291231,
283042,
291238,
291241,
127403,
127405,
291247,
299440,
127407,
299444,
127413,
291254,
283062,
127417,
291260,
127421,
127424,
299457,
127429,
127431,
127434,
315856,
127440,
176592,
315860,
176597,
127447,
283095,
299481,
127449,
176605,
242143,
127455,
127457,
291299,
127460,
340454,
127463,
242152,
291305,
127466,
176620,
127469,
127474,
291314,
291317,
127480,
135672,
291323,
233979,
127485,
291330,
127490,
127494,
283142,
127497,
233994,
135689,
127500,
233998,
127506,
234003,
127509,
234006,
127511,
152087,
283161,
234010,
135707,
242202,
135710,
242206,
242208,
291361,
242220,
291378,
234038,
152118,
234041,
315961,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
135808,
291456,
299655,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
135839,
299680,
225954,
299684,
135844,
242343,
209576,
242345,
373421,
299706,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
119509,
226005,
226008,
299740,
201444,
299750,
283368,
234219,
283372,
226037,
283382,
316151,
234231,
234236,
226045,
242431,
234239,
209665,
234242,
299778,
242436,
234246,
226056,
291593,
234248,
242443,
234252,
242445,
234254,
291601,
234258,
242450,
242452,
234261,
348950,
201496,
234264,
234266,
234269,
283421,
234272,
234274,
152355,
299814,
234278,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
160572,
283452,
234302,
234307,
242499,
234309,
316233,
234313,
316235,
234316,
283468,
234319,
242511,
234321,
234324,
185173,
201557,
234329,
234333,
308063,
234336,
242530,
349027,
234338,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
226171,
291711,
234368,
291714,
234370,
291716,
234373,
226182,
234375,
201603,
308105,
226185,
234379,
324490,
234384,
234388,
234390,
226200,
234393,
209818,
308123,
234396,
324508,
291742,
324504,
234398,
234401,
291747,
291748,
234405,
291750,
324518,
324520,
234407,
324522,
291754,
291756,
234410,
226220,
324527,
291760,
234414,
201650,
324531,
234417,
234422,
226230,
324536,
234428,
291773,
242623,
324544,
226239,
234434,
324546,
324548,
234431,
226245,
234437,
234439,
234443,
291788,
193486,
234446,
193488,
275406,
316370,
234449,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234475,
234478,
316400,
234481,
316403,
234484,
234485,
234487,
324599,
234490,
234493,
316416,
234496,
308226,
234501,
275462,
308231,
234504,
234507,
234510,
234515,
300054,
316439,
234520,
234519,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
234543,
234546,
275508,
300085,
234549,
300088,
234553,
234556,
234558,
316479,
234561,
316483,
160835,
234563,
308291,
234568,
234570,
316491,
234572,
300108,
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,
234634,
234636,
177293,
234640,
275602,
234643,
308373,
226453,
234647,
234648,
275608,
234650,
308379,
324757,
300189,
324766,
119967,
324768,
234653,
283805,
234657,
242852,
300197,
234661,
283813,
234664,
177318,
275626,
234667,
316596,
308414,
234687,
300223,
300226,
308418,
234692,
300229,
308420,
308422,
283844,
300234,
283850,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
300267,
300270,
300272,
120053,
300278,
275703,
316663,
300284,
275710,
300287,
292097,
300289,
161027,
300292,
300294,
275719,
234760,
177419,
300299,
242957,
300301,
275725,
177424,
283917,
349451,
349464,
415009,
283939,
259367,
292143,
283951,
300344,
243003,
283963,
226628,
300357,
283973,
283983,
316758,
357722,
316766,
292192,
316768,
218464,
292197,
316774,
218473,
284010,
136562,
324978,
333178,
275834,
275840,
316803,
316806,
316811,
316814,
226703,
300433,
234899,
300436,
226709,
357783,
316824,
316826,
300448,
144807,
144810,
144812,
284076,
144814,
144820,
374196,
284084,
292279,
284087,
144826,
144828,
144830,
144832,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
226787,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
292338,
226802,
316917,
292343,
308727,
300537,
316933,
316947,
308757,
308762,
284191,
316959,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
194101,
284213,
316983,
194103,
284215,
308790,
284218,
226877,
292414,
284223,
284226,
284228,
292421,
243268,
284231,
226886,
128584,
284234,
276043,
317004,
366155,
284238,
226895,
284241,
194130,
284243,
300628,
284245,
292433,
284247,
317015,
276052,
276053,
235097,
243290,
284249,
300638,
284251,
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,
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,
284379,
276187,
284381,
284384,
358114,
284386,
358116,
317158,
358119,
284392,
325353,
358122,
284394,
284397,
358126,
284399,
358128,
276206,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
300819,
317207,
284440,
300828,
300830,
276255,
300832,
325408,
300834,
317221,
227109,
358183,
276268,
300845,
243504,
300850,
284469,
276280,
325436,
358206,
366406,
276295,
292681,
153417,
358224,
276308,
284502,
317271,
276315,
292700,
317279,
284511,
292715,
300912,
292721,
284529,
300915,
292729,
317306,
284540,
292734,
325512,
276365,
317332,
358292,
284564,
284566,
399252,
350106,
284572,
276386,
284579,
276388,
358312,
317353,
292776,
284585,
276395,
292784,
358326,
161718,
358330,
276411,
276418,
301009,
301011,
301013,
292823,
358360,
301017,
301015,
292828,
276446,
153568,
276448,
276452,
292839,
276455,
292843,
276460,
292845,
178161,
227314,
276466,
325624,
276472,
317435,
276476,
276479,
276482,
276485,
317446,
276490,
350218,
292876,
350222,
317456,
276496,
317458,
178195,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
276528,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
276544,
284739,
325700,
243779,
292934,
243785,
276553,
350293,
350295,
309337,
227418,
350299,
194649,
194654,
227423,
350304,
178273,
309346,
350302,
194660,
350308,
309350,
309348,
292968,
309352,
309354,
227426,
227430,
276583,
350313,
301167,
350316,
350321,
276590,
284786,
276595,
350325,
252022,
227440,
350328,
292985,
301178,
350332,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
350366,
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,
227571,
309491,
309494,
243960,
227583,
276735,
227587,
276739,
276742,
227596,
325910,
309530,
342298,
211232,
317729,
276775,
211241,
325937,
325943,
211260,
260421,
276809,
285002,
276811,
235853,
235858,
276829,
276833,
391523,
276836,
293227,
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,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
293346,
227810,
276964,
293352,
236013,
293364,
301562,
293370,
317951,
309764,
301575,
121352,
293387,
236043,
342541,
113167,
309779,
317971,
309781,
277011,
55837,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
23094,
277054,
129603,
301636,
318020,
301639,
301643,
285265,
399955,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
309871,
121458,
277106,
170619,
309885,
309888,
277122,
277128,
301706,
318092,
326285,
334476,
318094,
277136,
277139,
227992,
334488,
318108,
285340,
318110,
227998,
137889,
383658,
285357,
318128,
277170,
293555,
342707,
154292,
277173,
318132,
285368,
277177,
277181,
318144,
277187,
277194,
277196,
277201,
342745,
137946,
342747,
342749,
113378,
228069,
277223,
342760,
285417,
56043,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
228113,
285459,
277273,
293659,
326430,
228128,
285474,
293666,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
285494,
301880,
301884,
293696,
310080,
277317,
277322,
162643,
310100,
301911,
301913,
277337,
301921,
236397,
162671,
326514,
310134,
236408,
277368,
416639,
416640,
113538,
310147,
416648,
277385,
39817,
187274,
301972,
424853,
277405,
310179,
277411,
293798,
293802,
236460,
277426,
293811,
276579,
293817,
293820,
203715,
326603,
342994,
276586,
293849,
293861,
228327,
228328,
318442,
228330,
228332,
326638,
277486,
351217,
318450,
293876,
293877,
285686,
302073,
121850,
293882,
302075,
244731,
285690,
293887,
277504,
277507,
277511,
293899,
277519,
293908,
302105,
293917,
293939,
318516,
277561,
277564,
310336,
293956,
277573,
228422,
293960,
310344,
277577,
277583,
203857,
293971,
310355,
310359,
236632,
277594,
138332,
277598,
203872,
277601,
285792,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
367737,
285817,
302205,
285821,
392326,
285831,
253064,
294026,
302218,
285835,
162964,
384148,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
302241,
277671,
302248,
64682,
277678,
294063,
294065,
302258,
277687,
294072,
318651,
294076,
277695,
318657,
244930,
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,
64768,
310531,
138505,
228617,
318742,
277798,
130345,
113964,
285997,
285999,
113969,
318773,
318776,
286010,
417086,
286016,
302403,
294211,
384328,
294221,
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,
302541,
302543,
310737,
228825,
163290,
310749,
310755,
187880,
310764,
286188,
310772,
40440,
212472,
40443,
286203,
40448,
228864,
286214,
228871,
302603,
302614,
302617,
286233,
302621,
286240,
146977,
187939,
40484,
294435,
40486,
286246,
294440,
40488,
294439,
294443,
40491,
294445,
196133,
310831,
245288,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
327240,
40521,
286283,
40525,
40527,
212560,
400976,
228944,
40533,
147032,
40537,
40539,
40541,
278109,
40544,
40548,
40550,
40552,
286312,
40554,
286313,
310892,
40557,
40560,
294521,
343679,
294537,
310925,
286354,
278163,
302740,
122517,
278168,
179870,
327333,
229030,
212648,
278188,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
294601,
302793,
343757,
212690,
319187,
286420,
278227,
229076,
286425,
319194,
278235,
301163,
229086,
278238,
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,
294785,
327554,
360322,
294803,
40851,
294811,
237470,
319390,
40865,
319394,
294817,
294821,
311209,
343983,
294831,
188340,
40886,
319419,
294844,
294847,
393177,
294876,
294879,
294883,
393190,
311279,
278513,
237555,
311283,
278516,
278519,
237562
] |
b7e47f585dc95fe98c14c9bd3238fff6a1481a63 | d355f8c13a013b37d09a19768a5f77054940439d | /PitchPerfectTests/PitchPerfectTests.swift | c0e6c4f79c9b8a169392ded12c30145da93cff53 | [] | no_license | rloterh/PitchPerfect | 500122ffda0e1353c59ba7f667fab3ca98d02251 | 009705bc5d566301534200aa318e2db2a0068f28 | refs/heads/master | 2021-05-22T22:34:10.525545 | 2021-04-05T00:38:08 | 2021-04-05T00:38:08 | 253,126,944 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 917 | swift | //
// PitchPerfectTests.swift
// PitchPerfectTests
//
// Created by Admin on 03/04/2020.
// Copyright © 2020 com.admin. All rights reserved.
//
import XCTest
@testable import PitchPerfect
class PitchPerfectTests: XCTestCase {
override func setUp() {
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testExample() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measure {
// Put the code you want to measure the time of here.
}
}
}
| [
282633,
313357,
182296,
241692,
98333,
16419,
223268,
329765,
102437,
229413,
315432,
292902,
315434,
204840,
354345,
223274,
278570,
344107,
233517,
124975,
253999,
346162,
241716,
229430,
243767,
319542,
124984,
358456,
325694,
288833,
352326,
254027,
311372,
354385,
196691,
315476,
280661,
329814,
338007,
278615,
307289,
200794,
354393,
315487,
309345,
280675,
321637,
280677,
319591,
313447,
315498,
278634,
319598,
288879,
352368,
299121,
284788,
233589,
280694,
333940,
237689,
215164,
313469,
215166,
278655,
292992,
333955,
280712,
215178,
325776,
241808,
323729,
317587,
278677,
284826,
278685,
346271,
311458,
278691,
49316,
233636,
333991,
333992,
284842,
32941,
278704,
239793,
278708,
125109,
131256,
182456,
184505,
299198,
379071,
299203,
301251,
309444,
338119,
282831,
321745,
334042,
254170,
356576,
317664,
338150,
176362,
321772,
286958,
125169,
338164,
327929,
184570,
243962,
227578,
12542,
125183,
309503,
125188,
313608,
125193,
375051,
180493,
125198,
325905,
254226,
125203,
338197,
325912,
315673,
125208,
299293,
237856,
278816,
125217,
233762,
211235,
217380,
305440,
151847,
282919,
325931,
321840,
125235,
127284,
332085,
336183,
280887,
125240,
332089,
278842,
282939,
315706,
287041,
241986,
260418,
332101,
182598,
323916,
319821,
254286,
348492,
323920,
250192,
6481,
344401,
348500,
366929,
155990,
366930,
6489,
272729,
379225,
354655,
106847,
323935,
391520,
321894,
242023,
280939,
242029,
246127,
250226,
354676,
246136,
139640,
246137,
291192,
317820,
211326,
313727,
362881,
248194,
311685,
225670,
242058,
395659,
227725,
395661,
108944,
240016,
190871,
291224,
317852,
121245,
283038,
141728,
61857,
246178,
315810,
285090,
61859,
289189,
375207,
108972,
340398,
311727,
377264,
61873,
334260,
61880,
283064,
319930,
311738,
278970,
336317,
293310,
311745,
278978,
127427,
127428,
283075,
324039,
188871,
129483,
317901,
281040,
278993,
326100,
278999,
328152,
176601,
242139,
369116,
285150,
287198,
279008,
188894,
342498,
242148,
195045,
279013,
127465,
330218,
279018,
319981,
281072,
109042,
279029,
279032,
233978,
279039,
324097,
342536,
287241,
279050,
340490,
289304,
279065,
342553,
322078,
291358,
182817,
375333,
377386,
283184,
23092,
315960,
242237,
352829,
301638,
348742,
322120,
55881,
348749,
340558,
281166,
244310,
285271,
332378,
354911,
436832,
242273,
242277,
66150,
344680,
111208,
191082,
313966,
281199,
279164,
189057,
311941,
348806,
279177,
369289,
330379,
344715,
184973,
311949,
334481,
316049,
330387,
330388,
111253,
352917,
227990,
230040,
271000,
111258,
318107,
342682,
221852,
279206,
295590,
287404,
303793,
318130,
299699,
299700,
164533,
338613,
314040,
109241,
287417,
158394,
342713,
285373,
230072,
66242,
248517,
363211,
334547,
279252,
318173,
289502,
363230,
295652,
338662,
285415,
330474,
346858,
129773,
289518,
311954,
322291,
312052,
312053,
199414,
154359,
230134,
35583,
205568,
162561,
299776,
191235,
363263,
285444,
336648,
264968,
322316,
326414,
312079,
322319,
166676,
310036,
207640,
326429,
336671,
326433,
344865,
283430,
279336,
318250,
295724,
353069,
152365,
312108,
318252,
328499,
242485,
353078,
230199,
353079,
285497,
336702,
342847,
281408,
420677,
353094,
353095,
299849,
283467,
293711,
281427,
353109,
244568,
281433,
244570,
230234,
109409,
293730,
303972,
351077,
275303,
342887,
290811,
242541,
246641,
330609,
246648,
209785,
269178,
177019,
279417,
361337,
254850,
359298,
240518,
109447,
287622,
228233,
316298,
228234,
308107,
58253,
56208,
295824,
308112,
326553,
209817,
324506,
318364,
324507,
127902,
189348,
324517,
289703,
279464,
282276,
353195,
140204,
316333,
353197,
347055,
326581,
316343,
353216,
330689,
349121,
363458,
213960,
279498,
316364,
338899,
340955,
248796,
248797,
207838,
50143,
130016,
340961,
64485,
314342,
123881,
324586,
340974,
289774,
304110,
320494,
316405,
240630,
295927,
201720,
304122,
320507,
328700,
314362,
330754,
328706,
320516,
230410,
330763,
320527,
146448,
324625,
316437,
322582,
418837,
320536,
197657,
281626,
201755,
326685,
336929,
189474,
300068,
330788,
357414,
248872,
345132,
238639,
252980,
300084,
322612,
359478,
324666,
238651,
302139,
336960,
21569,
214086,
359495,
238664,
250956,
300111,
314448,
341073,
339030,
353367,
156764,
156765,
304222,
113760,
314467,
281700,
250981,
322663,
300136,
316520,
228458,
207979,
318572,
316526,
357486,
187506,
353397,
291959,
337017,
160891,
341115,
363644,
150657,
187521,
248961,
349316,
279685,
349318,
222343,
330888,
228491,
228493,
285838,
169104,
162961,
177296,
308372,
326804,
296086,
324760,
119962,
300187,
296092,
300188,
339102,
302240,
343203,
300201,
300202,
253099,
238765,
3246,
279728,
238769,
337077,
367799,
339130,
64700,
343234,
367810,
259268,
283847,
353479,
62665,
353481,
353482,
244940,
283853,
283852,
290000,
316627,
228563,
333011,
296153,
357595,
279774,
298212,
304356,
330984,
228588,
234733,
328940,
253167,
279792,
353523,
298228,
128251,
216315,
208124,
316669,
363771,
388349,
228609,
320770,
279814,
322824,
242954,
328971,
292107,
312587,
353551,
251153,
245019,
320796,
126237,
333090,
130338,
208164,
130343,
130348,
351537,
345396,
318775,
300343,
312634,
116026,
222524,
216386,
286018,
193859,
279875,
304456,
230729,
224586,
372043,
177484,
251213,
238927,
296273,
331090,
120148,
318805,
283991,
222559,
314720,
292195,
230756,
294243,
314726,
314728,
333160,
230765,
327024,
243056,
312689,
327025,
116084,
249204,
314739,
327031,
279920,
314751,
318848,
306559,
179587,
378244,
314758,
298374,
314760,
388487,
368011,
304524,
314766,
296335,
112017,
112018,
9619,
234898,
306579,
282007,
357786,
314783,
290207,
333220,
314789,
279974,
314791,
282024,
245161,
241066,
316842,
314798,
286129,
173491,
150965,
210358,
284089,
228795,
292283,
302529,
302531,
163268,
380357,
415171,
300487,
361927,
300489,
370123,
148940,
280013,
310732,
64975,
312782,
327121,
222675,
366037,
210390,
210391,
210392,
353750,
210393,
228827,
310748,
286172,
239068,
103909,
310757,
245223,
187878,
280041,
361963,
191981,
54765,
321009,
251378,
308723,
333300,
191990,
343542,
280055,
300536,
288249,
343543,
300535,
286205,
290301,
210433,
282114,
228867,
366083,
323080,
230921,
253452,
323087,
329232,
304656,
316946,
146964,
398869,
175639,
374296,
308764,
349726,
282146,
306723,
245287,
245292,
349741,
169518,
230959,
312880,
286254,
288309,
290358,
312889,
235070,
288318,
349763,
124485,
56902,
288326,
288327,
292425,
243274,
128587,
333388,
218696,
333393,
290390,
235095,
300630,
306776,
196187,
343647,
345700,
374372,
282213,
323178,
120427,
204397,
54893,
138863,
325231,
222832,
224883,
314998,
247416,
366203,
325245,
175741,
337535,
339584,
294529,
224901,
282245,
282246,
288392,
229001,
310923,
188048,
323217,
239250,
282259,
345752,
229020,
255649,
245412,
323236,
40613,
40614,
206504,
40615,
229029,
282280,
298661,
61101,
321199,
337591,
296632,
321207,
319162,
280251,
323263,
323264,
282303,
286399,
321219,
218819,
306890,
280267,
212685,
333517,
333520,
245457,
241361,
313041,
333521,
241365,
302802,
181975,
333523,
280278,
280280,
298712,
18138,
278234,
294622,
321247,
278240,
325346,
333542,
12010,
212716,
212717,
280300,
282348,
284401,
282358,
313081,
229113,
286459,
325371,
124669,
194303,
278272,
319233,
175873,
323331,
323332,
280329,
284429,
323346,
278291,
321302,
294678,
366360,
116505,
249626,
284442,
325404,
321310,
282400,
339745,
241442,
241441,
341796,
325410,
247590,
257830,
317232,
282417,
280374,
319288,
321337,
282427,
319292,
360252,
280380,
325439,
315202,
307011,
325445,
153415,
345929,
159562,
341836,
325457,
18262,
370522,
188251,
307039,
345951,
362337,
284514,
345955,
296806,
292712,
282474,
288619,
325484,
313199,
292720,
362352,
313203,
325492,
241528,
317304,
194429,
124798,
325503,
182144,
339841,
305026,
253829,
247686,
243591,
333701,
67463,
243597,
325518,
329622,
337815,
282518,
282519,
124824,
214937,
214938,
118685,
298909,
319392,
292771,
354212,
294823,
333735,
284587,
323507,
124852,
243637,
288697,
214977,
174019,
163781,
247757,
344013,
212946,
219101,
280541,
292836,
298980,
294886,
337895,
174057,
247785,
253929,
327661,
362480,
329712,
325619,
333817,
313339
] |
0f215324a722f85c5cdaf8acf3fb9afbd5d0e131 | 7f37534d8c360363e49987a3739216f20ef55654 | /ServiceLayer/ServiceLayer/Conversation/ConversationService.swift | aa192ebe9c7eb5900ad96853c965af46933b0fb8 | [] | no_license | ivanlardis/Fintech | e824133c86d70823807a1bba13597a5f897ecad3 | 896e429363e0787644d3fabee82f374a9210515d | refs/heads/master | 2020-03-29T16:52:51.386763 | 2018-12-03T20:46:07 | 2018-12-03T21:46:25 | 150,131,755 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,143 | swift | //
// ConversationService.swift
// FintechLarin
//
// Created by Иван Lardis on 12/11/2018.
// Copyright © 2018 ivan larin. All rights reserved.
//
import UIKit
import CoreData
import CoreLayer
public class ConversationService: IConversationService,
ICommunicationDelegate {
var communication: ICommunicationManager
var storage: IStorage
public init(communication: ICommunicationManager,
storage: IStorage) {
self.communication = communication
self.storage = storage
}
public func getConversationFRC() -> NSFetchedResultsController<Conversation> {
return storage.getConversationFRC()
}
public func getMessageFRC(conversationId: String) -> NSFetchedResultsController<Message> {
return storage.getMessageFRC(conversationId: conversationId)
}
public func sendMessage(text: String, toUserID: String) {
communication.sendMessage(text: text, toUserID: toUserID)
}
public func updateData(data: [String: ConversationModel]) {
storage.updateConversations(models: data.map {
$1
})
}
}
| [
-1
] |
7840b6364ceda7a92380bfe9f208c64df8b81ebe | 9a28d0d1bbea5431f473747156d091bbb2e10838 | /Shared/Entity/Core/Advert.swift | 5ce0a4fdcf7de1c159c978011efc80299926f798 | [] | no_license | Gdev82/Remix | 63b285d7d48a6908829b066419350dea565d9bed | 3ca87fd02308c8330af716e3f12baf1fca41c29e | refs/heads/master | 2020-03-19T00:01:07.129531 | 2018-03-24T18:27:40 | 2018-03-24T18:27:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 753 | swift | // Copyright © 2017 cutting.io. All rights reserved.
public typealias AdvertID = String
public struct Advert {
public let advertID: AdvertID
public let title: String
public let description: String
public let groupID: GroupID
public init(advertID: AdvertID, title: String, description: String, groupID: GroupID) {
self.advertID = advertID
self.title = title
self.description = description
self.groupID = groupID
}
}
extension Advert: Equatable {
public static func ==(lhs: Advert, rhs: Advert) -> Bool {
return lhs.advertID == rhs.advertID &&
lhs.title == rhs.title &&
lhs.description == rhs.description &&
lhs.groupID == rhs.groupID
}
}
| [
-1
] |
2ceecf5d7ec4a0916a6dc4f4d264beac68f15295 | 30598680fbd3d94245d67e6e63c1d9ff464bcaf8 | /Movieskip/code/Movieskip/Movieskip/Utils/CustomTextField.swift | bd56cb4ed43e7203a4b171f9a84bcdc6d59e2a81 | [] | no_license | marchelmon/PORTFOLIO | 1754a7929d4c45fc835df24ad0c1500ef504e8c6 | 3ac715db4690521a8c6466c6e32e6b129323aa43 | refs/heads/master | 2023-06-09T17:06:40.574550 | 2021-07-01T13:17:58 | 2021-07-01T13:17:58 | 373,942,047 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 891 | swift | //
// CustomTextField.swift
// Movieskip
//
// Created by marchelmon on 2021-02-25.
//
import UIKit
class CustomTextField: UITextField {
init(placeholder: String, secureText: Bool = false) {
super.init(frame: .zero)
let spacer = UIView()
spacer.setDimensions(height: 40, width: 12)
leftView = spacer
leftViewMode = .always
backgroundColor = UIColor(white: 1, alpha: 1)
textColor = .black
heightAnchor.constraint(equalToConstant: 50).isActive = true
layer.cornerRadius = 7
self.placeholder = placeholder
isSecureTextEntry = secureText
keyboardAppearance = .light
autocorrectionType = .no
autocapitalizationType = .none
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
| [
-1
] |
6edc9bba8fdfa4ab70c0e1be986926bc039f4e02 | fa250931d57bcf86f441aca8f78a79612639ff62 | /BlokusIOS/XIBs/results/results.swift | a10906e3af1b87592284a054b3c7fa6748a322fd | [] | no_license | VasileiosDiamantidis/Blokus | 98492a9a6886a5a5b7d94a1d2f34919877f5a36b | a217fd1648232e6ccabab40b4f4cf82f41399b49 | refs/heads/master | 2021-09-09T19:27:55.141470 | 2018-03-19T08:02:51 | 2018-03-19T08:02:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 994 | swift | //
// results.swift
// BlokusIOS
//
// Created by Vasileios Diamantidis on 29/12/2017.
// Copyright © 2017 vdiamant. All rights reserved.
//
import UIKit
class results: UIView {
/*
// Only override draw() if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
override func draw(_ rect: CGRect) {
// Drawing code
}
*/
@IBOutlet var winner: [UILabel]!
@IBOutlet var second: [UILabel]!
@IBOutlet var third: [UILabel]!
@IBOutlet var fourth: [UILabel]!
var gVC:gameAdaptiveViewController!
@IBAction func LobbyBtnPressed(_ sender: Any) {
self.goToLoby()
}
func goToLoby(){
let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle:nil)
let controller = storyBoard.instantiateViewController(withIdentifier: "HomeNavController")
self.gVC.present(controller, animated: true, completion: nil)
}
}
| [
-1
] |
4d7f86e1c43d72f4eeeff8625e3b26ccf0a6c868 | 50bcbbe41ed944764eff7ef6681ac881cb701531 | /Acrylic/Settings/LicensesView.swift | 8b3df57bdb69876dce9a7d9e47f18c184404e368 | [
"MIT"
] | permissive | benkoppe/Acrylic | bbc30e36b76129aedf5b745b2e6fb6d0a300f9fe | 15623537c73b17f214524ccf935048bdda3386af | refs/heads/main | 2023-08-31T01:26:19.984540 | 2021-10-30T02:30:17 | 2021-10-30T02:30:17 | 411,493,911 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,250 | swift | //
// LicensesView.swift
// Acrylic
//
// Created by Ben K on 9/30/21.
//
import SwiftUI
struct License: Hashable {
let name: String
let url: URL
}
struct LicensesView: View {
@Environment(\.presentationMode) var presentationMode
let licenseGroups = [[License(name: "Canvas LMS", url: URL(string: "https://www.google.com")!)]]
var body: some View {
ForEach(licenseGroups, id: \.self) { licenseArray in
Section {
ForEach(licenseArray, id: \.self) { license in
LicenseView(license: license)
}
}
}
.navigationTitle("Licenses")
.navigationBarTitleDisplayMode(.inline)
}
struct LicenseView: View {
let license: License
var body: some View {
Link(destination: license.url) {
HStack {
Text(license.name)
.foregroundColor(.primary)
Spacer()
Text("License")
.font(.callout)
}
}
}
}
}
struct LicensesView_Previews: PreviewProvider {
static var previews: some View {
LicensesView()
}
}
| [
-1
] |
749d10f98d7b64150fd08565855688734ccb234e | bfcbade9411d0e012bf74eef3ba113d23acd9cc3 | /Yelpify/Yelpify/Framework/CellConfigurator.swift | c2bd621a739bb06871c6f331e727240da1c2193a | [] | no_license | ryanyue123/EPIK | 52838cf49e59ab1858871fc3183b5ab7e32ee901 | 24fdf08507ffe66df4a70fd0df316bc8991fab67 | refs/heads/master | 2020-04-14T16:51:33.958472 | 2017-01-14T21:09:01 | 2017-01-14T21:09:01 | 51,788,456 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 761 | swift | //
// CellConfigurator.swift
// ConfigurableTableViewController
//
// Created by Arkadiusz Holko on 03-01-16.
// Copyright © 2016 Arkadiusz Holko. All rights reserved.
//
import UIKit
protocol CellConfiguratorType {
var reuseIdentifier: String { get }
var cellClass: AnyClass { get }
func updateCell(_ cell: UITableViewCell)
}
struct CellConfigurator<Cell> where Cell: Updatable, Cell: UITableViewCell {
let viewData: Cell.ViewData
let reuseIdentifier: String = NSStringFromClass(Cell)
let cellClass: AnyClass = Cell.self
func updateCell(_ cell: UITableViewCell) {
if let cell = cell as? Cell {
cell.updateWithViewData(viewData)
}
}
}
extension CellConfigurator: CellConfiguratorType {
}
| [
-1
] |
9bb83bf1969bb01a9d803bd03acf46109eb8fda8 | 75259a8c2d30d4f6af1b37b583b982f9a2e1ac73 | /MySpotify/Models/Spotify/SPTTracksSource.swift | 520ff398e65851676404dabf82f7631cde715cb5 | [] | no_license | VladislavFitz/MySpotify | 44b04ac5609d9bef68d47dd57f6a8b387463c354 | 47c764bc209c96a067bd58ee2a7eb7a3e4d6eb14 | refs/heads/master | 2021-01-12T16:08:40.131782 | 2016-11-13T16:51:54 | 2016-11-13T16:51:54 | 71,949,770 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 679 | swift | //
// SPTTracksSource.swift
// MySpotify
//
// Created by Vladislav Fitc on 26.10.16.
// Copyright © 2016 Fitc. All rights reserved.
//
import Foundation
class SPTTracksSource: RefreshableTracksSource {
typealias ItemType = SPTTrack
let playlistID: String
var items: [SPTTrack] {
return Storage.sharedInstance.tracks(forPlaylistWithID: playlistID)
}
init(playlistID: String) {
self.playlistID = playlistID
}
func refresh(completion: @escaping (Error?) -> Void) {
Storage.sharedInstance.refreshTracks(forPlaylistWithID: playlistID) { error in
completion(error)
}
}
}
| [
-1
] |
73d7bcdf3cfc211d172496ce9a87841f49f2de92 | 0e11ce75f1199ab758f94ccfd4cc1e685e92cd18 | /theAPIAwakens/Model/CharacterDetail.swift | 72e8a8a299b389aaf6feed579bebf3dbd7ebf847 | [] | no_license | gb4iosdev/TTH_TechDegree_Unit-06 | c9f033d045e0896d46c1b7ff42559d0d9dbd721c | b8aa5e0474fe291bdaa78f531a24f8fc96de88e0 | refs/heads/master | 2020-07-26T14:31:01.733028 | 2019-09-27T10:28:36 | 2019-09-27T10:28:36 | 208,676,206 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,077 | swift | //
// Character.swift
// theAPIAwakens
//
// Created by Gavin Butler on 16-09-2019.
// Copyright © 2019 Gavin Butler. All rights reserved.
//
import Foundation
struct CharacterDetail: Codable {
//Straigh JSON fills:
let birthYear: String
let homeworldURL: URL
let eyeColour: String
let hairColour: String
let url: URL
let vehiclesPiloted: [URL]
let starshipsPiloted: [URL]
//Derived Data requiring network calls
var home: String?
var vehicleNames: [String]?
var starshipNames: [String]?
//Mapping/Bridge between the JSON dictionary keys and model variables
enum CodingKeys: String, CodingKey {
case birthYear = "birth_year"
case homeworldURL = "homeworld"
case eyeColour = "eye_color"
case hairColour = "hair_color"
case url
case vehiclesPiloted = "vehicles"
case starshipsPiloted = "starships"
}
}
/*Schema:
{
"title": "People",
"required": [
"name",
"height",
"mass",
"hair_color",
"skin_color",
"eye_color",
"birth_year",
"gender",
"homeworld",
"films",
"species",
"vehicles",
"starships",
"url",
"created",
"edited"
],
"properties": {
"created": {
"format": "date-time",
"type": "string",
"description": "The ISO 8601 date format of the time that this resource was created."
},
"eye_color": {
"type": "string",
"description": "The eye color of this person."
},
"gender": {
"type": "string",
"description": "The gender of this person (if known)."
},
"homeworld": {
"type": "string",
"description": "The url of the planet resource that this person was born on."
},
"species": {
"type": "array",
"description": "The url of the species resource that this person is."
},
"skin_color": {
"type": "string",
"description": "The skin color of this person."
},
"films": {
"type": "array",
"description": "An array of urls of film resources that this person has been in."
},
"edited": {
"format": "date-time",
"type": "string",
"description": "the ISO 8601 date format of the time that this resource was edited."
},
"birth_year": {
"type": "string",
"description": "The birth year of this person. BBY (Before the Battle of Yavin) or ABY (After the Battle of Yavin)."
},
"mass": {
"type": "string",
"description": "The mass of this person in kilograms."
},
"name": {
"type": "string",
"description": "The name of this person."
},
"vehicles": {
"type": "array",
"description": "An array of vehicle resources that this person has piloted"
},
"url": {
"format": "uri",
"type": "string",
"description": "The url of this resource"
},
"hair_color": {
"type": "string",
"description": "The hair color of this person."
},
"height": {
"type": "string",
"description": "The height of this person in meters."
},
"starships": {
"type": "array",
"description": "An array of starship resources that this person has piloted"
}
},
"type": "object",
"description": "A person within the Star Wars universe",
"$schema": "http://json-schema.org/draft-04/schema"
}
*/
| [
-1
] |
e13145ac6becadd7081cba754675c6e601c79fc5 | b6fc1a11b7af815f9fbd55c0bc7873e2a4b87acf | /Sources/Validator/Rules/LengthValidationRule.swift | cd967ed5fdc33641925f18dfd04d68c8f4e77f0a | [
"MIT"
] | permissive | Incetro/validator | af589fedf8d9ffa242e868dfc899474c9d1a993a | 434a1b30cb2b2458a1d7719f09198fe933512acf | refs/heads/master | 2023-09-05T18:20:44.924514 | 2021-11-17T11:18:53 | 2021-11-18T17:12:43 | 381,146,937 | 0 | 0 | MIT | 2021-11-16T13:32:58 | 2021-06-28T19:57:12 | Swift | UTF-8 | Swift | false | false | 978 | swift | //
// LengthValidationRule.swift
// Validator IOS
//
// Created by incetro on 6/28/21.
//
// MARK: - LengthValidationRule
public struct LengthValidationRule: ValidationRule {
// MARK: - Properties
/// Min length value
public let min: Int
/// Max length value
public let max: Int
/// Validation error instance
public let error: ValidationError
// MARK: - Initializers
/// Default initializer
/// - Parameters:
/// - min: min length value
/// - max: max length value
/// - error: validation error instance
public init(min: Int = 0, max: Int = .max, error: ValidationError = "") {
self.min = min
self.max = max
self.error = error
}
// MARK: - ValidationRule
/// Validates the given input
/// - Parameter input: an input instance
public func validate(input: String) -> Bool {
let length = input.count
return length >= min && length <= max
}
}
| [
-1
] |
9b8093d8c1e33216c7c7fcbc7e556b49e27e3e09 | 181baaaf502eddf2ba74f8a17cdddeba6d3f5707 | /RememberMe/Model And States/SettingsController.swift | a0bd6c9b53ac00a3f17f53395b4691cb8e363003 | [] | no_license | ITzombietux/RememberMe | 904f1d773da8d058d5ca2ce63a418657ddda218e | 77698914cc15298545de04e77934ecb1dbfd09df | refs/heads/master | 2020-05-03T00:49:20.663805 | 2019-04-10T09:47:41 | 2019-04-10T09:47:41 | 178,319,293 | 1 | 0 | null | 2019-04-10T09:47:42 | 2019-03-29T02:40:21 | Swift | UTF-8 | Swift | false | false | 1,120 | swift | //
// SettingsController.swift
// RememberMe
//
// Created by zombietux on 01/04/2019.
// Copyright © 2019 zombietux. All rights reserved.
//
import Foundation
import UIKit
class SettingsController {
private let currentSchemeKey = "currentScheme"
private let defaults = UserDefaults.standard
var scheme: ColorScheme {
get {
guard let data = defaults.data(forKey: currentSchemeKey) else {
return .defaultScheme
}
let decoder = PropertyListDecoder()
return (try? decoder.decode(ColorScheme.self, from: data)) ?? .defaultScheme
}
set {
if let data = encode(newValue) {
defaults.setValue(data, forKey: currentSchemeKey)
}
}
}
init() {
if let data = encode(.defaultScheme) {
defaults.register(defaults: [currentSchemeKey: data])
}
}
}
private extension SettingsController {
func encode(_ scheme: ColorScheme) -> Data? {
let encoder = PropertyListEncoder()
return try? encoder.encode(scheme)
}
}
| [
-1
] |
6d77c9df7e2fb81c50722ad0890f32421b69c8c9 | 0417f911acec9be3d87d7d0966844f73ebe439e6 | /Tao/Public/Network/Operations/ArrayOperation.swift | 0d762d10672b97eefc0b50ced2857cddc2ea799c | [
"MIT"
] | permissive | allbut/Tao | b06d6a937d872a7404a4ad026700c148d14749ca | ad4b19a63e7cc45fadd885c4e4f1f209a65ea31d | refs/heads/master | 2020-07-20T20:28:27.683473 | 2019-09-06T03:35:48 | 2019-09-06T03:35:48 | 206,705,354 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 967 | swift | //
// ArrayOperation.swift
// Quizzes
//
// Created by user on 2018/10/29.
// Copyright © 2018 albutt. All rights reserved.
//
import Foundation
/// 数组类型
class ArrayOperation<R: BackendAPIRequest, O: Codable>: BaseOperation<R, [O]> {
var success: (([O]) -> Void)?
var failure: ((Int?, String?, Error?) -> Void)?
var exception: ((NSError) -> Void)?
override func handleSuccess(item: ResponseItem<[O]>) {
super.handleSuccess(item: item)
if let resp = item.resp {
success?(resp)
} else {
failure?(item.code, item.msg, BackendError.emptyResponse)
}
}
override func handleFailure(code: Int?, msg: String?, error: Error?) {
super.handleFailure(code: code, msg: msg, error: error)
failure?(code, msg, error)
}
override func handleException(error: NSError) {
super.handleException(error: error)
exception?(error)
}
}
| [
-1
] |
9c3fec0f1420a641bd9891802c5452175e91fa24 | 541d920a7372bb18631bf7926ff43f954ecf20f8 | /12. The N-Body Problem/NBodyProblem/Sources/NBodyProblem/NBodyProblem.swift | bac4c45f72eb43637b7468f9dcf21c90c1524076 | [
"MIT"
] | permissive | nonsensery/advent-of-code-2019 | fc9ee99e6d9819a32cfd4897d4746d0ceff87337 | 1e0d3d594aa5736332e8e52d552e5e3a7cf98ad4 | refs/heads/master | 2020-09-23T07:15:16.115323 | 2020-01-04T00:47:25 | 2020-01-04T00:47:25 | 225,436,009 | 0 | 0 | MIT | 2020-01-04T00:47:27 | 2019-12-02T17:54:23 | Swift | UTF-8 | Swift | false | false | 1,342 | swift |
func step(_ bodies: [Body]) {
step(bodies.map({ $0.x }))
step(bodies.map({ $0.y }))
step(bodies.map({ $0.z }))
}
func step(_ vectors: [Vector]) {
var remaining = ArraySlice(vectors)
while let a = remaining.popFirst() {
remaining.forEach { b in
applyGravity(a, b)
}
}
vectors.forEach({ $0.move() })
}
func totalEnergy(of bodies: [Body]) -> Int {
bodies.map({ $0.totalEnergy }).reduce(0, +)
}
func stepsPerCycle(_ bodies: [Body]) -> Int {
let xSteps = stepsPerCycle(of: bodies.map({ $0.x }))
let ySteps = stepsPerCycle(of: bodies.map({ $0.y }))
let zSteps = stepsPerCycle(of: bodies.map({ $0.z }))
return leastCommonMultiple(xSteps, ySteps, zSteps)
}
private func stepsPerCycle(of vectors: [Vector]) -> Int {
let initialState = vectors.map {
Vector(position: $0.position, velocity: $0.velocity)
}
var steps = 0
repeat {
step(vectors)
steps += 1
} while vectors != initialState
return steps
}
private func leastCommonMultiple(_ a: Int, _ b: Int, _ c: Int) -> Int {
var a = a, b = b, c = c
var i = 2
while i < min(a, b, c) {
while a % i == 0, b % i == 0, c % i == 0 {
a = a / i
b = b / i
c = c / i
}
i += 1
}
return a * b * c
}
| [
-1
] |
897a7df5fce3731b4397a571fc0f11c4027bd794 | 9cda14c4986536437c4144195b8a7ac99018731e | /ABMTE/ABMTEApp.swift | 5842cce3b99101f931e247a113097eed838b9314 | [] | no_license | Gemzicky/ABMTE | e9e4547f7ef38122cac87275e57525d912411022 | 84f61644b6c54dcc9d97acdc0a5e73e93ac790c5 | refs/heads/main | 2023-02-13T06:44:47.644431 | 2021-01-04T22:00:01 | 2021-01-04T22:00:01 | 326,201,823 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 327 | swift | //
// ABMTEApp.swift
// ABMTE
//
// Created by Maroš Gemzický on 02/01/2021.
//
import SwiftUI
@main
struct LandmarksApp: App {
@StateObject private var modelData = ModelData()
var body: some Scene {
WindowGroup {
ContentView()
.environmentObject(modelData)
}
}
}
| [
386625,
380339
] |
50b880cd2c47e753cd312dc909d1ea83473d1339 | d9013cefae73e9bde7448e2b7d3896c340770bae | /92Agents/Model/Model.swift | ee408dc238f90453ae1151ad9f6fe9569d8bc9e4 | [] | no_license | ibpsoftwares/92Agents_IOS | cda0608aeb44e5913205c839a3f89f237b67bf6c | 70f78b42f29e68602073334945d84b5b126f8461 | refs/heads/master | 2020-03-28T03:12:34.949253 | 2018-11-28T11:29:29 | 2018-11-28T11:29:29 | 147,624,850 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 453 | swift | //
// Model.swift
// 92Agents
//
// Created by Apple on 21/06/18.
// Copyright © 2018 Apple. All rights reserved.
//
import Foundation
final class Model {
// Can't init is singleton
public init() { }
//MARK: Shared Instance
static let sharedInstance: Model = Model()
//MARK: Local Variable
var accessToken = String()
var userRole = String()
var userID = String()
var user = String()
}
| [
-1
] |
e3f237b654564e8f1d2e14fd68eca0a5d694376e | afea31ce163bfe969d9ec4637eaad8495b6c347f | /ch3nerdwrench/AppDelegate.swift | d447703cd211b8f75fd1891a4bf03dcd107427aa | [] | no_license | Mangoman3/chapter3 | abd9011a3e5ed2b2985eedb4a050d3cde5320a22 | f78713a34b9c7c4fb7030df0af0efc8eb5ab2dd1 | refs/heads/master | 2021-05-31T03:56:35.334752 | 2016-03-14T18:53:52 | 2016-03-14T18:53:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,139 | swift | //
// AppDelegate.swift
// ch3nerdwrench
//
// Created by Arsalan on 3/3/16.
// Copyright © 2016 Arsalan. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
func applicationDidEnterBackground(application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(application: UIApplication) {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
| [
229380,
229383,
229385,
278539,
229388,
294924,
278542,
229391,
327695,
278545,
229394,
278548,
229397,
229399,
229402,
278556,
229405,
352284,
278559,
229408,
278564,
294950,
229415,
229417,
327722,
237613,
229422,
360496,
229426,
237618,
229428,
286774,
229432,
286776,
286778,
319544,
204856,
286791,
237640,
278605,
286797,
311375,
163920,
237646,
196692,
319573,
311383,
278623,
278626,
319590,
311400,
278635,
303212,
278639,
278648,
131192,
237693,
327814,
131209,
303241,
417930,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
131264,
286916,
286922,
286924,
286926,
319694,
286928,
131281,
278743,
278747,
295133,
155872,
319716,
278760,
237807,
303345,
286962,
131314,
229622,
327930,
278781,
278783,
278785,
237826,
319751,
278792,
286987,
319757,
311569,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
287032,
155966,
319809,
319810,
278849,
319814,
311623,
319818,
311628,
229709,
287054,
319822,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
319879,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
278980,
98756,
278983,
319945,
278986,
319947,
278990,
278994,
311767,
279003,
279006,
188895,
172512,
279010,
287202,
279015,
172520,
319978,
279020,
172526,
279023,
311791,
172529,
279027,
319989,
164343,
180727,
279035,
311804,
287230,
279040,
303617,
287234,
279045,
172550,
287238,
172552,
303623,
320007,
279051,
172558,
279055,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
279082,
311850,
279084,
172591,
172598,
279095,
172607,
172609,
172612,
377413,
172614,
172618,
303690,
33357,
287309,
279124,
172634,
262752,
172644,
311911,
189034,
295533,
172655,
172656,
189039,
295538,
189040,
172660,
189044,
287349,
352880,
287355,
287360,
295553,
287365,
311942,
303751,
295557,
352905,
279178,
287371,
311946,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
164509,
303773,
172702,
230045,
287390,
287394,
172705,
303780,
172707,
287398,
295583,
279208,
287400,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
328384,
279231,
287427,
312006,
107208,
279241,
172748,
287436,
107212,
172751,
287440,
295633,
172755,
303827,
279255,
172760,
279258,
303835,
213724,
189149,
303838,
287450,
279267,
312035,
295654,
279272,
230128,
312048,
312050,
230131,
205564,
303871,
230146,
328453,
295685,
230154,
33548,
312077,
295695,
295701,
369433,
230169,
295707,
328476,
295710,
230175,
303914,
279340,
205613,
279353,
230202,
312124,
222018,
295755,
377676,
148302,
287569,
303959,
279383,
230237,
279390,
230241,
279394,
303976,
336744,
303985,
328563,
303987,
279413,
303991,
303997,
295806,
295808,
304005,
295813,
213895,
320391,
304007,
304009,
304011,
230284,
304013,
279438,
213902,
295822,
189329,
295825,
304019,
189331,
279445,
58262,
279452,
410526,
279461,
279462,
304042,
213931,
230327,
304055,
287675,
197564,
304063,
238528,
304065,
213954,
189378,
156612,
295873,
213963,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
312321,
295945,
295949,
197645,
230413,
320528,
140312,
295961,
238620,
197663,
304164,
189479,
304170,
238641,
312374,
238652,
238655,
230465,
238658,
336964,
296004,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
205931,
296044,
279661,
205934,
164973,
312432,
279669,
337018,
189562,
279679,
279683,
222340,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
238766,
165038,
230576,
238770,
304311,
230592,
279750,
312518,
230600,
230607,
148690,
320727,
279769,
304348,
279777,
304354,
296163,
320740,
279781,
304360,
320748,
279788,
279790,
304370,
296189,
320771,
312585,
296202,
296205,
230674,
320786,
230677,
296213,
296215,
320792,
230681,
230679,
214294,
304416,
230689,
173350,
312622,
296243,
312630,
222522,
222525,
296253,
312639,
296255,
230718,
296259,
378181,
230727,
238919,
320840,
296264,
296267,
296271,
222545,
230739,
312663,
337244,
222556,
230752,
312676,
230760,
173418,
410987,
230763,
230768,
296305,
312692,
230773,
279929,
304506,
304505,
181626,
181631,
312711,
312712,
296331,
288140,
288144,
230800,
304533,
337306,
288154,
288160,
173472,
288162,
288164,
279975,
304555,
370092,
279983,
288176,
279985,
173488,
312755,
296373,
279991,
312759,
288185,
337335,
222652,
312766,
173507,
296389,
222665,
230860,
280014,
312783,
288208,
230865,
288210,
370130,
288212,
280021,
288214,
222676,
239064,
288217,
329177,
280027,
288220,
288218,
239070,
288224,
280034,
288226,
280036,
288229,
280038,
288230,
288232,
370146,
288234,
320998,
288236,
288238,
288240,
291754,
288242,
296435,
288244,
296439,
288250,
402942,
148990,
296446,
206336,
296450,
321022,
230916,
230919,
214535,
304651,
370187,
304653,
230940,
222752,
108066,
296486,
296488,
157229,
230961,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
280152,
288344,
239194,
280158,
403039,
370272,
181854,
239202,
312938,
280183,
280185,
280188,
280191,
280194,
116354,
280208,
280211,
288408,
280218,
280222,
190118,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
313027,
280260,
206536,
280264,
206539,
206541,
206543,
280276,
313044,
321239,
280283,
313052,
288478,
313055,
321252,
313066,
280302,
288494,
280304,
313073,
321266,
419570,
288499,
288502,
280314,
288510,
124671,
67330,
280324,
198405,
288519,
280331,
198416,
280337,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
296767,
288576,
345921,
280388,
304968,
280393,
280402,
313176,
42842,
280419,
321381,
280426,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280458,
280464,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
280487,
313258,
321458,
296883,
124853,
214966,
10170,
296890,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
239586,
313320,
231404,
124913,
165876,
321528,
239612,
313340,
288764,
239617,
313347,
288773,
313358,
321560,
305176,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
378941,
313406,
288831,
288836,
67654,
223303,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
223327,
280671,
149599,
321634,
149601,
149603,
329830,
280681,
313451,
223341,
280687,
313458,
280691,
215154,
313464,
329850,
321659,
280702,
288895,
321670,
215175,
141446,
141455,
141459,
280725,
313498,
100520,
288936,
280747,
288940,
280755,
288947,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
313548,
321740,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
157930,
280811,
280817,
125171,
157940,
280819,
182517,
280823,
280825,
280827,
280830,
280831,
280833,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
280888,
280891,
289087,
280897,
280900,
239944,
305480,
280906,
239947,
305485,
305489,
379218,
280919,
354653,
313700,
280937,
313705,
280940,
190832,
280946,
223606,
313720,
280956,
239997,
280959,
313731,
199051,
240011,
289166,
240017,
297363,
190868,
297365,
240021,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
305594,
289210,
281024,
289218,
289221,
289227,
281045,
281047,
215526,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
240132,
223749,
281095,
338440,
150025,
223752,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
281135,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
281179,
199262,
338528,
338532,
281190,
199273,
281196,
158317,
19053,
313973,
281210,
297594,
158347,
133776,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
199364,
297671,
199367,
158409,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322314,
322318,
281361,
281372,
322341,
215850,
281388,
289593,
281401,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
281442,
174955,
224110,
207733,
207737,
183172,
158596,
240519,
322440,
338823,
314249,
183184,
289687,
240535,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
281567,
289762,
322534,
297961,
183277,
281581,
322550,
134142,
322563,
175134,
322599,
322610,
314421,
281654,
314427,
207937,
314433,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
289912,
248995,
306341,
306344,
306347,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
126190,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
257334,
216376,
298306,
380226,
281923,
224584,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
290171,
314747,
298365,
290174,
306555,
224641,
281987,
298372,
314756,
281990,
224647,
265604,
298377,
314763,
142733,
298381,
224657,
306581,
314779,
314785,
282025,
314793,
282027,
241068,
241070,
241072,
282034,
241077,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
290291,
282101,
241142,
191992,
290298,
151036,
290302,
282111,
290305,
175621,
192008,
323084,
257550,
282127,
290321,
282130,
323090,
282133,
290325,
241175,
290328,
282137,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
282186,
224849,
282195,
282199,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
324757,
282261,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
306856,
282295,
282300,
323260,
323266,
282310,
323273,
282319,
306897,
241362,
282328,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
241450,
282410,
306988,
306991,
315184,
323376,
315190,
241464,
159545,
282425,
298811,
307009,
413506,
241475,
307012,
148946,
315211,
282446,
307027,
315221,
282454,
315223,
241496,
323414,
241498,
307035,
307040,
282465,
110433,
241509,
110438,
298860,
110445,
282478,
315249,
110450,
315251,
282481,
315253,
315255,
339838,
282499,
315267,
315269,
241544,
282505,
241546,
241548,
298896,
298898,
282514,
44948,
298901,
241556,
282520,
241560,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
36779,
241581,
282542,
241583,
323504,
241586,
282547,
241588,
290739,
241590,
241592,
241598,
290751,
241600,
241605,
151495,
241610,
298975,
241632,
298984,
241640,
241643,
298988,
241646,
241649,
241652,
323574,
290807,
241661,
299006,
282623,
315396,
241669,
315397,
282632,
282639,
290835,
282645,
241693,
282654,
241701,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
307278,
192596,
176213,
307287,
315482,
217179,
315483,
192605,
233567,
200801,
299105,
217188,
299109,
307303,
315495,
356457,
45163,
307307,
315502,
192624,
307314,
323700,
299126,
233591,
299136,
307329,
307338,
233613,
241813,
307352,
299164,
184479,
299167,
184481,
315557,
184486,
307370,
307372,
184492,
307374,
307376,
323763,
176311,
299191,
307385,
307386,
258235,
176316,
307388,
307390,
184503,
299200,
184512,
307394,
307396,
299204,
184518,
307399,
323784,
307409,
307411,
176343,
299225,
233701,
307432,
184572,
282881,
184579,
282893,
291089,
282906,
291104,
233766,
282931,
307508,
315701,
307510,
332086,
307512,
151864,
176435,
307515,
168245,
282942,
307518,
151874,
282947,
323917,
110926,
282957,
233808,
323921,
315733,
323926,
233815,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299388,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
283033,
291226,
242075,
315801,
291231,
61855,
283042,
291238,
291241,
127403,
127405,
291247,
127407,
299440,
299444,
127413,
283062,
291254,
127417,
291260,
283069,
127421,
127424,
299457,
127429,
127431,
283080,
176592,
315856,
315860,
176597,
127447,
283095,
299481,
176605,
242143,
291299,
127463,
242152,
291305,
127466,
176620,
127474,
291314,
291317,
135672,
233979,
291323,
291330,
283142,
127497,
233994,
135689,
291341,
233998,
234003,
234006,
152087,
127511,
283161,
242202,
234010,
135707,
242206,
135710,
242208,
291361,
242220,
291378,
234038,
152118,
234041,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
291456,
135808,
373383,
299655,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
225948,
135839,
299680,
225954,
299684,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
225998,
299726,
226002,
119509,
226005,
226008,
242396,
299740,
201444,
299750,
283368,
234219,
283372,
381677,
226037,
283382,
234231,
316151,
234236,
226045,
234239,
242431,
209665,
234242,
299778,
242436,
226053,
234246,
226056,
234248,
291593,
242443,
234252,
242445,
234254,
291601,
242450,
234258,
242452,
234261,
348950,
201496,
234264,
234266,
234269,
283421,
234272,
234274,
152355,
234278,
299814,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
283452,
160572,
234302,
234307,
242499,
234309,
292433,
234313,
316233,
316235,
234316,
283468,
242511,
234319,
234321,
234324,
185173,
201557,
234329,
234333,
308063,
234336,
234338,
242530,
349027,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
226171,
234364,
291711,
234368,
234370,
201603,
291714,
234373,
226182,
234375,
291716,
226185,
308105,
234379,
234384,
234388,
234390,
324504,
234393,
209818,
308123,
324508,
226200,
234398,
234396,
291742,
234401,
291747,
291748,
234405,
291750,
234407,
324518,
324520,
234410,
324522,
226220,
291756,
234414,
324527,
291760,
234417,
201650,
324531,
234422,
226230,
275384,
324536,
234428,
291773,
234431,
242623,
324544,
324546,
226239,
324548,
234437,
226245,
234439,
234434,
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,
324599,
234487,
234490,
234493,
234496,
316416,
234501,
275462,
308231,
234504,
234507,
234510,
234515,
300054,
234519,
316439,
234520,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
144430,
234543,
234546,
275508,
234549,
300085,
300088,
234553,
234556,
234558,
316479,
234561,
316483,
234563,
308291,
234568,
234570,
316491,
300108,
234572,
234574,
300115,
234580,
234581,
300628,
234585,
242777,
275545,
234590,
234593,
234595,
300133,
234597,
234601,
300139,
234605,
234607,
160879,
275569,
234610,
300148,
234614,
398455,
234618,
144506,
275579,
234620,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
275594,
234636,
177293,
234640,
275602,
234643,
226453,
275606,
234647,
275608,
308373,
234650,
234648,
308379,
234653,
324766,
119967,
283805,
234657,
300189,
324768,
242852,
234661,
283813,
300197,
234664,
275626,
234667,
316596,
308414,
234687,
300226,
308418,
226500,
234692,
300229,
308420,
283844,
283850,
300234,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
161003,
300267,
300270,
300272,
120053,
300278,
316663,
275703,
300284,
275710,
300287,
283904,
300289,
292097,
300292,
300294,
275719,
300299,
177419,
283917,
300301,
242957,
177424,
275725,
349464,
283939,
259367,
283951,
292143,
300344,
226617,
243003,
283963,
226628,
283973,
300357,
177482,
283983,
316758,
357722,
316766,
292192,
316768,
218464,
292197,
316774,
243046,
218473,
284010,
136562,
324978,
275834,
333178,
275836,
275840,
316803,
316806,
226696,
316811,
226699,
316814,
226703,
300433,
234899,
226709,
357783,
316824,
316826,
144796,
300448,
144807,
144810,
144812,
284076,
144814,
144820,
284084,
284087,
292279,
144826,
144828,
144830,
144832,
144835,
284099,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
226787,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
226802,
316917,
308727,
292343,
300537,
316947,
308757,
308762,
284191,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
284213,
194101,
284215,
194103,
284218,
226877,
284223,
284226,
243268,
292421,
226886,
284231,
128584,
284228,
284234,
276043,
317004,
366155,
284238,
226895,
284241,
194130,
284243,
276052,
276053,
284245,
284247,
317015,
235097,
284249,
243290,
284251,
284253,
300638,
284255,
243293,
284258,
292452,
292454,
284263,
177766,
284265,
292458,
284267,
292461,
284272,
284274,
276086,
284278,
292470,
292473,
284283,
276093,
284286,
276095,
284288,
292481,
284290,
325250,
284292,
276098,
292479,
292485,
284297,
317066,
284299,
317068,
276109,
284301,
284303,
276114,
284306,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
276137,
284329,
284331,
317098,
284333,
284335,
276144,
284337,
284339,
300726,
284343,
284346,
284350,
276160,
358080,
284354,
358083,
276166,
284358,
358089,
276170,
284362,
276175,
284368,
276177,
284370,
317138,
284372,
358098,
284377,
276187,
284379,
284381,
284384,
284386,
358114,
358116,
276197,
317158,
358119,
284392,
325353,
284394,
358122,
284397,
358126,
276206,
358128,
284399,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
300819,
317207,
284440,
186139,
300828,
300830,
276255,
325408,
284449,
300834,
300832,
317221,
227109,
358183,
186151,
276268,
300845,
194351,
243504,
300850,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
300872,
153417,
284499,
276308,
284502,
317271,
178006,
276315,
292700,
284511,
227175,
292715,
300912,
284529,
292721,
300915,
284533,
292729,
317306,
284540,
292734,
325512,
169868,
276365,
284564,
358292,
284566,
350106,
284572,
276386,
284579,
276388,
358312,
284585,
317353,
276395,
292776,
292784,
276402,
358326,
161718,
276410,
276411,
358330,
276418,
276425,
301009,
301011,
301013,
292823,
301015,
301017,
358360,
292828,
276446,
153568,
276448,
276452,
276455,
292839,
292843,
276460,
276464,
178161,
227314,
276466,
276472,
325624,
317435,
276476,
276479,
276482,
276485,
317446,
276490,
292876,
276496,
317456,
317458,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
276528,
243762,
309298,
325685,
325689,
235579,
276539,
235581,
325692,
178238,
276544,
284739,
292934,
243785,
276553,
350293,
350295,
194649,
227418,
309337,
350302,
227423,
194654,
178273,
194657,
276579,
227426,
194660,
227430,
276583,
309346,
309348,
309350,
309352,
309354,
350308,
276590,
350313,
350316,
350321,
284786,
276595,
227440,
301167,
350325,
350328,
292985,
301178,
292989,
292993,
301185,
350339,
317570,
317573,
350342,
227463,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
276638,
350366,
284837,
153765,
350375,
350379,
350381,
350383,
129200,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
309450,
301258,
276685,
276689,
227540,
309462,
301272,
276699,
309468,
194780,
309471,
301283,
317672,
276713,
317674,
325867,
243948,
194801,
227571,
309491,
276725,
309494,
243960,
276735,
227583,
227587,
276739,
211204,
276742,
227593,
227596,
325910,
309530,
342298,
276766,
211232,
317729,
276775,
211241,
325937,
276789,
325943,
211260,
260421,
276809,
285002,
276811,
235853,
276816,
235858,
276829,
276833,
391523,
276836,
276843,
293227,
276848,
293232,
186744,
285051,
211324,
227709,
285061,
317833,
178572,
285070,
178575,
285077,
178583,
227738,
317853,
276896,
317858,
342434,
285093,
317864,
285098,
276907,
235955,
276917,
293304,
293307,
293314,
309707,
293325,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
227810,
293346,
276964,
293352,
236013,
293364,
301562,
317951,
309764,
301575,
121352,
236043,
317963,
342541,
55822,
113167,
317971,
309779,
309781,
277011,
55837,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
285236,
23094,
277054,
244288,
129603,
318020,
301636,
301639,
301643,
277071,
285265,
399955,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
121458,
277106,
170618,
170619,
309885,
309888,
277122,
227975,
277128,
285320,
301706,
318092,
326285,
318094,
334476,
277136,
277139,
227992,
285340,
318108,
227998,
318110,
137889,
383658,
285357,
318128,
277170,
342707,
154292,
277173,
293555,
318132,
285368,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
137946,
113378,
203491,
228069,
277223,
342760,
285417,
56041,
56043,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
285453,
228113,
285459,
277273,
293659,
326430,
228128,
293666,
285474,
228135,
318248,
277291,
293677,
318253,
285489,
293685,
285494,
301880,
285499,
301884,
310080,
293696,
277314,
277317,
277322,
277329,
162643,
310100,
301911,
277337,
301913,
301921,
400236,
236397,
162671,
326514,
310134,
15224,
236408,
277368,
416639,
416640,
113538,
310147,
416648,
39817,
187274,
277385,
301972,
424853,
277405,
277411,
310179,
293798,
293802,
236460,
277426,
293811,
293817,
293820,
203715,
326603,
276586,
293849,
293861,
228327,
228328,
228330,
318442,
228332,
277486,
326638,
318450,
293876,
293877,
285686,
302073,
285690,
121850,
302075,
244731,
293882,
293887,
277504,
277507,
277511,
277519,
293908,
277526,
293917,
293939,
318516,
277561,
277564,
310336,
7232,
293956,
277573,
228422,
310344,
277577,
293960,
277583,
203857,
310355,
293971,
310359,
236632,
277594,
138332,
277598,
285792,
277601,
203872,
310374,
203879,
277608,
310376,
228460,
318573,
203886,
187509,
285815,
285817,
367737,
285821,
302205,
285824,
392326,
285831,
253064,
302218,
285835,
294026,
384148,
162964,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
285862,
277671,
302248,
64682,
277678,
228526,
294063,
294065,
302258,
277687,
294072,
318651,
294076,
277695,
318657,
244930,
302275,
130244,
302277,
228550,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
302296,
384222,
310498,
285927,
318698,
302315,
195822,
228592,
294132,
138485,
204023,
228601,
204026,
228606,
204031,
64768,
310531,
285958,
138505,
228617,
318742,
204067,
277798,
130345,
277801,
113964,
285997,
277804,
285999,
277807,
113969,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
417086,
277822,
286016,
294211,
302403,
384328,
277832,
277836,
294221,
326991,
294223,
277839,
277842,
277847,
277850,
179547,
277853,
146784,
277857,
302436,
277860,
294246,
327015,
310632,
327017,
351594,
277864,
277869,
277872,
351607,
310648,
277880,
310651,
277884,
277888,
310657,
351619,
294276,
310659,
277892,
327046,
253320,
310665,
318858,
277898,
277894,
277903,
310672,
351633,
277905,
277908,
277917,
310689,
277921,
277923,
130468,
228776,
277928,
277932,
310703,
277937,
310710,
130486,
310712,
277944,
310715,
277947,
302526,
228799,
277950,
277953,
64966,
245191,
163272,
302534,
310727,
277959,
292968,
302541,
277966,
302543,
277963,
310737,
277971,
277975,
228825,
163290,
277978,
310749,
277981,
277984,
310755,
277989,
277991,
187880,
277995,
310764,
286188,
278000,
278003,
310772,
228851,
278006,
40440,
278009,
212472,
40443,
286203,
40448,
228864,
286214,
228871,
302603,
65038,
302614,
286233,
302617,
302621,
286240,
146977,
187939,
294435,
40484,
286246,
294439,
286248,
278057,
294440,
294443,
40486,
294445,
40488,
310831,
40491,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
40521,
286283,
40525,
40527,
212560,
228944,
400976,
40533,
147032,
40537,
40539,
278109,
40541,
40544,
40548,
40550,
286312,
286313,
40554,
40552,
310892,
40557,
40560,
188022,
122488,
294521,
343679,
278150,
310925,
286354,
278163,
302740,
122517,
278168,
327333,
229030,
212648,
278188,
302764,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
294601,
302793,
343757,
212690,
278227,
286420,
319187,
229076,
286425,
319194,
278235,
301163,
278238,
229086,
286432,
294625,
294634,
302838,
319226,
286460,
171774,
278274,
302852,
278277,
302854,
294664,
311048,
352008,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
278320,
319280,
319290,
229192,
302925,
188247,
237409,
294776,
360317,
294785,
327554,
40840,
40851,
294803,
188312,
294811,
319390,
294817,
319394,
40865,
294821,
311209,
180142,
294831,
188340,
40886,
319419,
294844,
294847,
393177,
294876,
294879,
294883,
294890,
311279,
278513,
237555,
278516,
311283,
278519,
237562
] |
1c47c7aaff074e9614a53ec8d55ac48d8ece0f97 | d835e5bd67d9e1bb91acd14ea39718e52b80e418 | /Example/PrebidDemo/PrebidDemoSwift/AppDelegate.swift | 609a2d97bdbdadcfc90919fd47fada24b665e376 | [
"Apache-2.0"
] | permissive | maddapper/prebid-mobile-ios | 977858a596f1ec5f52ac6c0acc01db986ddd8b91 | f58e03cdea72aa084c84c487d4f138e11eeb7535 | refs/heads/master | 2023-08-04T03:38:59.180851 | 2023-05-15T09:05:14 | 2023-05-15T09:05:14 | 495,573,802 | 0 | 0 | Apache-2.0 | 2022-05-23T21:07:09 | 2022-05-23T21:07:09 | null | UTF-8 | Swift | false | false | 2,895 | swift | /* Copyright 2019-2022 Prebid.org, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import UIKit
import GoogleMobileAds
import AppLovinSDK
import PrebidMobile
import PrebidMobileGAMEventHandlers
import PrebidMobileAdMobAdapters
import PrebidMobileMAXAdapters
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// ===== INIT: Prebid
if CommandLine.arguments.contains("-uiTesting") {
UIApplication.shared.getKeyWindow()?.layer.speed = 2
UIView.setAnimationsEnabled(false)
}
// Set account id and custom Prebid server URL
Prebid.shared.prebidServerAccountId = "0689a263-318d-448b-a3d4-b02e8a709d9d"
try! Prebid.shared.setCustomPrebidServer(url: "https://prebid-server-test-j.prebid.org/openrtb2/auction")
// Initialize Prebid SDK
Prebid.initializeSDK(GADMobileAds.sharedInstance()) { status, error in
if let error = error {
print("Initialization Error: \(error.localizedDescription)")
return
}
}
// ===== CONFIGURE: Prebid
Targeting.shared.sourceapp = "PrebidDemoSwift"
// ===== INIT: Ad Server SDK
// Initialize GoogleMobileAds SDK
GADMobileAds.sharedInstance().requestConfiguration.testDeviceIdentifiers = [ GADSimulatorID, "fa7ff8af558fb08a04c94453647e54a1"]
GADMobileAds.sharedInstance().start()
AdMobUtils.initializeGAD()
GAMUtils.shared.initializeGAM()
// Initialize AppLovin MAX SDK
ALSdk.shared()?.mediationProvider = ALMediationProviderMAX
ALSdk.shared()?.userIdentifier = "USER_ID"
ALSdk.shared()?.initializeSdk()
return true
}
// MARK: UISceneSession Lifecycle
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {}
}
| [
-1
] |
0f5b889fd4f7197867fe7188237de4990c8574ce | 39e726d4fbf137023a03b89d09ab901db2211823 | /Sources/ScenesShellD/TitleInteractionLayer.swift | abda1996e4087fc919d5104ab3d62cf9c86c106d | [] | no_license | Karoawr/CapstoneBrickyBoi | 947c5fe6aa22b9d572b7674f426410f752a94c88 | edd95abfaa3340bd2861500639cf925af9adff15 | refs/heads/master | 2021-02-10T21:25:07.362405 | 2020-03-02T16:34:15 | 2020-03-02T16:34:15 | 244,420,004 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 679 | swift | import Scenes
import Igis
class TitleInteractionLayer : Layer {
let playStart : PlayStart
var buttonPressed = false
override init(){
print("Creating TitleInteractionLayer...")
playStart = PlayStart()
super.init()
insert(entity:playStart, at:.front)
}
override func wantsMouseEvents() -> MouseEventTypeSet{
return [.click]
}
override func preCalculate(canvas:Canvas){
guard let owner = owner as? TitleScene else{
fatalError("TitleScene needed as owner in TitleInteractionLayer")
}
setAlpha(alpha:Alpha(alphaValue:owner.alphaValue))
}
}
| [
-1
] |
1ac569a1de8c0ae778ff4f0ae7d4087708c7c1bb | 9ee89ee58ba2418c31ced52a829af45b3ec91242 | /ChemicalCalculator/SavedSolutionTableViewController.swift | 28203ff1c6491f8a9b8ac02882c4e846f1a0509b | [
"MIT"
] | permissive | yanqingsmile/ChemicalCalculator | 7c64681c25114351f8ca8eebc1c2237cbf02ba5d | 03a33dad4095463e5eae8ae31e9f83cedb6d86d8 | refs/heads/master | 2021-01-19T08:12:26.794949 | 2017-05-19T15:43:24 | 2017-05-19T15:43:24 | 87,610,727 | 0 | 0 | null | 2017-05-19T15:43:24 | 2017-04-08T05:33:25 | Swift | UTF-8 | Swift | false | false | 13,622 | swift | //
// SavedSolutionTableViewController.swift
// ChemicalCalculator
//
// Created by Vivian Liu on 3/18/17.
// Copyright © 2017 Vivian Liu. All rights reserved.
//
import UIKit
import CoreData
import Mixpanel
class SavedSolutionTableViewController: CoreDataTableViewController {
fileprivate var solutionCount: Int {
get {
var count: Int?
if let context = managedObjectContext {
context.performAndWait({
count = try? context.count(for: NSFetchRequest(entityName: "Solution"))
})
}
return count ?? 0
}
}
fileprivate let searchController = UISearchController(searchResultsController: nil)
// MARK: - IBOutlets
@IBOutlet var addToButton: UIBarButtonItem!
@IBOutlet var cancelButton: UIBarButtonItem!
@IBOutlet var selectButton: UIBarButtonItem!
// MARK: - IBActions
@IBAction func selectButtonClicked(_ sender: UIBarButtonItem) {
Mixpanel.mainInstance().track(event: "Select button in SavedSolution TVC clicked")
tableView.setEditing(true, animated: true)
tableView.allowsSelectionDuringEditing = true
updateButtonsToMatchTableState()
}
@IBAction func cancelButtonClicked(_ sender: UIBarButtonItem) {
if presentingViewController != nil {
presentingViewController?.dismiss(animated: true, completion: nil)
} else {
tableView.setEditing(false, animated: true)
updateButtonsToMatchTableState()
}
}
@IBAction func addToButtonClicked(_ sender: UIBarButtonItem) {
if presentingViewController == nil {
performSegue(withIdentifier: "addToGroup", sender: self)
} else {
performSegue(withIdentifier: "addToSourceGroup", sender: self)
}
// Mixpanel tracking
Mixpanel.mainInstance().track(event: "Save to group")
}
// MARK: - View life cycle
override func viewDidLoad() {
super.viewDidLoad()
tableView.separatorStyle = .none
// Set up tableview background view color
let bgView = UIView()
bgView.backgroundColor = UIColor.grayWhite()
tableView.backgroundView = bgView
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
self.navigationItem.rightBarButtonItem = self.selectButton
// Set up search controller
searchController.searchResultsUpdater = self
searchController.dimsBackgroundDuringPresentation = true
definesPresentationContext = true
tableView.tableHeaderView = searchController.searchBar
searchController.searchBar.delegate = self
refreshPlaceholderText()
// Allow bulk selection
tableView.allowsMultipleSelectionDuringEditing = true
updateButtonsToMatchTableState()
// Mixpanel
Mixpanel.mainInstance().track(event: "Saved solution loaded", properties: ["saved solution count": solutionCount])
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
// Fetech data from core data
if let context = managedObjectContext {
context.performAndWait({
let request = NSFetchRequest<NSFetchRequestResult>(entityName: "Solution")
request.sortDescriptors = [NSSortDescriptor(
key: "createdDate",
ascending: false,
selector: nil
)]
self.fetchedResultsController = NSFetchedResultsController(fetchRequest: request, managedObjectContext: context, sectionNameKeyPath: nil, cacheName: nil)
})
} else {
fetchedResultsController = nil
}
// Clear tab bar badge number
tabBarController?.tabBar.items![1].badgeValue = nil
}
// MARK: - Table view data source
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
var compound: Compound?
var conc: Double?
var concUnit: String?
var volume: Double?
var volumeUnit: String?
var mass: Double?
var massUnit: String?
var date: NSDate?
var isDiluted = false
var stockConcentrationText: String?
var stockNeededVolume: Double?
var stockNeededVolumeUnit: String?
if let context = managedObjectContext {
context.performAndWait({
if let solution = self.fetchedResultsController?.object(at: indexPath) as? Solution {
compound = solution.solute
conc = solution.finalConcentration
concUnit = solution.concentrationUnit
volume = solution.finalVolume
volumeUnit = solution.volumeUnit
mass = solution.soluteMass
massUnit = solution.massUnit
date = solution.createdDate
isDiluted = solution.isDiluted
stockConcentrationText = solution.stockConcentration
stockNeededVolume = solution.stockNeededVolume
stockNeededVolumeUnit = solution.stockNeededVolumeUnit
}
})
}
if isDiluted {
let cell = tableView.dequeueReusableCell(withIdentifier: "dilutionCell", for: indexPath) as! SolutionTableViewCell
cell.nameLabel.text = compound?.name
cell.concentrationLabel.text = String(describing: conc!) + " "
cell.concentrationUnitLabel.text = concUnit
cell.volumeLabel.text = String(describing: volume!) + " "
cell.volumeUnitLabel.text = volumeUnit
cell.stockNeededVolumeLabel.text = String(describing: stockNeededVolume!) + " "
cell.stockNeededVolumeUnitLabel.text = stockNeededVolumeUnit
cell.stockConcentrationLabel.text = stockConcentrationText?.components(separatedBy: " ")[0]
cell.stockConcentrationUnitLabel.text = stockConcentrationText?.components(separatedBy: " ")[1]
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "MM/dd/yyyy"
let result = dateFormatter.string(from: date! as Date)
cell.createdDateLabel.text = result
return cell
} else {
let cell = tableView.dequeueReusableCell(withIdentifier: "solutionCell", for: indexPath) as! SolutionTableViewCell
cell.nameLabel.text = compound?.name
cell.concentrationLabel.text = String(describing: conc!) + " "
cell.concentrationUnitLabel.text = concUnit
cell.volumeLabel.text = String(describing: volume!) + " "
cell.volumeUnitLabel.text = volumeUnit
cell.massLabel.text = String(describing: mass!) + " "
cell.massUnitLabel.text = massUnit
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "MM/dd/yyyy"
let result = dateFormatter.string(from: date! as Date)
cell.createdDateLabel.text = result
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 func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
updateButtonsToMatchTableState()
}
override func tableView(_ tableView: UITableView, didDeselectRowAt indexPath: IndexPath) {
updateButtonsToMatchTableState()
}
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if let solution = fetchedResultsController?.object(at: indexPath) as? Solution {
if solution.isDiluted {
return 200
} else {
return 180
}
}
return 200
}
// 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
if let context = managedObjectContext {
context.performAndWait({
if let solutionToDelete = self.fetchedResultsController?.object(at: indexPath) as? Solution {
context.delete(solutionToDelete)
try? context.save()
}
})
}
// Below code is not needed, because the CoreDataTVC which implements fetchedResultsController delegate will handle the change in UI.
//tableView.deleteRows(at: [indexPath], with: .fade)
}
}
override func tableView(_ tableView: UITableView, shouldIndentWhileEditingRowAt indexPath: IndexPath) -> Bool {
return false
}
// Override to remove section footer.
override func tableView(_ tableView: UITableView, titleForFooterInSection section: Int) -> String? {
return nil
}
override func controllerDidChangeContent(_ controller: NSFetchedResultsController<NSFetchRequestResult>) {
super.controllerDidChangeContent(controller)
refreshPlaceholderText()
}
// MARK: - Methods
func filterContentForSearchText(searchText: String?) {
if let context = managedObjectContext {
let request = NSFetchRequest<NSFetchRequestResult>(entityName: "Solution")
if let searchText = searchText, searchText != "" {
request.predicate = NSPredicate(format: "any solute.name contains[c] %@", searchText)
}
request.sortDescriptors = [NSSortDescriptor(
key: "solute.name",
ascending: true,
selector: #selector(NSString.localizedCaseInsensitiveCompare(_:))
), NSSortDescriptor(
key: "createdDate",
ascending: false,
selector: nil)
]
fetchedResultsController = NSFetchedResultsController(fetchRequest: request, managedObjectContext: context, sectionNameKeyPath: nil, cacheName: nil)
} else {
fetchedResultsController = nil
}
}
fileprivate func updateButtonsToMatchTableState() {
if tableView.isEditing {
navigationItem.rightBarButtonItem = addToButton
addToButton.isEnabled = tableView.indexPathsForSelectedRows?.count ?? 0 > 0
navigationItem.leftBarButtonItem = cancelButton
} else {
navigationItem.rightBarButtonItem = selectButton
navigationItem.leftBarButtonItem = nil
}
}
fileprivate func refreshPlaceholderText() {
searchController.searchBar.placeholder = "Search from \(solutionCount) saved solution"
}
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func shouldPerformSegue(withIdentifier identifier: String, sender: Any?) -> Bool {
return !tableView.isEditing
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "addToGroup" {
let naVC = segue.destination as! UINavigationController
let addToTemporaryTVC = naVC.visibleViewController as! AddToTemporaryTableViewController
if let selectedIndexPaths = tableView.indexPathsForSelectedRows {
let selectedSolutions = selectedIndexPaths.map{fetchedResultsController?.object(at: $0) as! Solution}
addToTemporaryTVC.toAddSolutions = selectedSolutions
}
} else if segue.identifier == "make a dilution" {
Mixpanel.mainInstance().track(event: "Make a dilution")
let calculatorVC = segue.destination as! CalculatorViewController
calculatorVC.style = .dilution
if let selectedCell = sender as? UITableViewCell {
let selectedIndexPath = tableView.indexPath(for: selectedCell)
let selectedSolution = fetchedResultsController?.object(at: selectedIndexPath!) as! Solution
calculatorVC.stockSolution = selectedSolution
calculatorVC.compound = selectedSolution.solute
}
}
}
@IBAction func unwindToSavedSolutionTVC(sender: UIStoryboardSegue) {
}
}
// MARK: - Delegation Methods
extension SavedSolutionTableViewController: UISearchResultsUpdating {
func updateSearchResults(for searchController: UISearchController) {
let searchBar = searchController.searchBar
filterContentForSearchText(searchText: searchBar.text)
}
}
extension SavedSolutionTableViewController: UISearchBarDelegate {
func searchBarTextDidBeginEditing(_ searchBar: UISearchBar) {
let searchBar = searchController.searchBar
filterContentForSearchText(searchText: searchBar.text)
}
}
| [
-1
] |
4e3676cb0050d3e920b92775d675931b6a64073c | 1e8a737cfc6d8d1b225579e9304a73dcbcfc13c6 | /Accessing Superclasses Methods, Properties and Subscripts.playground/Contents.swift | 86311e63be59e85e529dcd43362878c54a9df2ff | [] | no_license | Ki1L3r/iOS-Swift-Foundations | 2705a274b842cda15f5ddc57105f157b498325b5 | 57478a4070e742a5d40800ae69da752e8ddcce7d | refs/heads/master | 2021-01-10T16:46:01.303313 | 2016-03-25T21:09:00 | 2016-03-25T21:09:00 | 52,260,004 | 0 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 883 | swift | //: Playground - noun: a place where people can play
import UIKit
class AViewController : UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
}
class Building {
var name : String
var floors : Int
init(name: String, floors: Int){
self.name = name
self.floors = floors
}
func info() {
print("Name is: \(name) and has \(floors) floors.")
}
}
class House: Building {
var windows = 4
init(name: String, floors: Int, windows: Int) {
super.init(name: name, floors: floors)
self.windows = windows
}
override func info() {
super.info()
print("We also have \(windows) windows.")
}
}
let myHouse = House(name: "House", floors: 4, windows: 3)
print(myHouse.name)
print(myHouse.floors)
print(myHouse.windows)
myHouse.info()
| [
-1
] |
c22a733cf126ebbf07ea16b4d07e2151c2c9c56a | 66b963bcbf3765abbdfbe4e1e22af23995f39b03 | /SignupLogin/SignupViewController.swift | 974b2285c58d241cf91b508613d417fdc9813286 | [] | no_license | dctooandy/Swift-betlead-temp | dd9bbb4e28b99594d8da7b292e81636478db1615 | 419206e37ffae64bb566eccae6217a6afa4421d4 | refs/heads/main | 2023-03-18T23:52:15.168652 | 2021-03-16T15:12:14 | 2021-03-16T15:12:14 | 348,351,069 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,574 | swift | //
// SignupViewController.swift
// betlead
//
// Created by Victor on 2019/5/28.
// Copyright © 2019 Andy Chen. All rights reserved.
//
import UIKit
import RxSwift
class SignupViewController: BaseViewController {
@IBOutlet weak var registerButton: CornerradiusButton!
@IBOutlet weak var bottomMessageLabel: UILabel!
private var accountInputView: AccountInputView?
private var timer: Timer? = nil
private var seconds = BuildConfig.HG_NORMAL_COUNT_SECONDS
var rxVerifyCodeButtonClick: Observable<String>?
private var onClick = PublishSubject<SignupPostDto>()
private var loginMode : LoginMode = .account {
didSet {
loginModeDidChange()
}
}
static func instance(mode: LoginMode) -> SignupViewController {
let vc = SignupViewController.loadNib()
vc.loginMode = mode
return vc
}
// MARK: - Life cycle
override func viewDidLoad() {
super.viewDidLoad()
setupUI()
bindRegisterBtn()
bindAccountView()
}
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
view.endEditing(true)
}
//MARK: - UI
func setDefault() {
stopTimer()
accountInputView?.passwordRightButton.setTitle("发送验证码", for: .normal)
}
func cleanTextField() {
accountInputView?.cleanTextField()
}
private func setupUI() {
accountInputView = AccountInputView(inputMode: loginMode, isLogin: false, lineColor: Themes.grayLight)
rxVerifyCodeButtonClick = accountInputView?.rxVerifyCodeButtonClick()
view.addSubview(accountInputView!)
accountInputView?.snp.makeConstraints { (make) in
make.top.equalToSuperview().offset(88)
make.centerX.equalToSuperview()
make.width.equalToSuperview().multipliedBy(0.872)
make.height.equalToSuperview().multipliedBy(0.275)
}
registerButton.snp.makeConstraints { (make) in
make.top.equalTo(self.accountInputView!.snp.bottom).offset(48)
make.centerX.equalToSuperview()
make.width.equalToSuperview().multipliedBy(0.872)
make.height.equalTo(view).multipliedBy(0.08)
}
bottomMessageLabel.snp.makeConstraints { (make) in
make.top.equalTo(registerButton.snp.bottom).offset(24)
make.centerX.equalTo(registerButton)
}
}
func modeTitle() -> String {
switch loginMode {
case .account: return "帐号注册"
case .phone: return "手机注册"
}
}
func showVerifyCode(_ code: String) {
self.accountInputView?.passwordTextField.text = code
self.accountInputView?.passwordTextField.sendActions(for: .valueChanged)
}
// MARK: - Actions
func bindAccountView() {
accountInputView!
.rxCheckPassed()
.bind(to:registerButton.rx.isEnabled)
.disposed(by: disposeBag)
}
func bindRegisterBtn() {
registerButton.rx.tap.subscribeSuccess { [weak self] in
self?.signup()
}.disposed(by: disposeBag)
}
func signup() {
guard let acc = accountInputView?.accountTextField.text?.lowercased() else { return }
guard let pwd = accountInputView?.passwordTextField.text else { return }
let dto = SignupPostDto(account: acc, password: pwd, signupMode: loginMode)
self.view.endEditing(true)
onClick.onNext(dto)
}
func rxSignupButtonPressed() -> Observable<SignupPostDto> {
return onClick.asObserver()
}
private func loginModeDidChange() {
accountInputView?.changeInputMode(mode: self.loginMode)
}
func startReciprocal() {
self.timer = Timer.scheduledTimer(timeInterval: 1.0, target: self, selector: #selector(setPwdRightBtnSecondTime), userInfo: nil, repeats: true)
self.accountInputView?.setPasswordRightBtnEnable(isEnable: false)
timer?.fire()
}
@objc private func setPwdRightBtnSecondTime() {
self.accountInputView?.setPasswordRightBtnTime(seconds)
if seconds == 0 {
stopTimer()
return
}
seconds -= 1
}
private func stopTimer() {
self.timer?.invalidate()
self.timer = nil
seconds = BuildConfig.HG_NORMAL_COUNT_SECONDS
self.accountInputView?.setPasswordRightBtnEnable(isEnable: true)
}
}
| [
-1
] |
32560316e3cc74001f743aed1af05c20e5fbcf69 | e1aa4bbf53433826636ee2fb75d2d9b7270701af | /____PROJECTNAME____/____PROJECTNAME____/Extensions/UIImage.swift | d2701f4a7702087744e464add2286f6580179083 | [
"MIT"
] | permissive | dmanuelcl/iOSAppsSkeleton | c458e39a211e8db19590939cdfb59ea13d551db2 | bdd2e0cc3ada80608b3cbee85b71986eeb18f310 | refs/heads/master | 2021-05-05T07:35:58.465090 | 2018-01-26T00:00:56 | 2018-01-26T00:02:08 | 118,876,753 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 856 | swift | //
// UIImage.swift
// ____PROJECTNAME____
//
// Created by Dani Manuel on 4/16/17.
// Copyright © ____PROJECTNAME____. All rights reserved.
//
import UIKit
extension UIImage{
public static func image(withColor color: UIColor, andSize size: CGSize) -> UIImage?{
let scale = UIScreen.main.scale
if scale > 1{
UIGraphicsBeginImageContextWithOptions(size, false, scale)
}else{
UIGraphicsBeginImageContext(size)
}
let context = UIGraphicsGetCurrentContext()
//
// Fill background of context
//
context?.setFillColor(color.cgColor)
context?.fill(CGRect(x: 0, y: 0, width: size.width, height: size.height))
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return image
}
}
| [
-1
] |
5a6721ecc04b15974b82770278240b054d22e57f | 55d3fe259cb461a09e69e6676b38b060295118ee | /The Love-Letter Mystery.playground/Contents.swift | 71b87e75a5c7fc14702f1780f80e2540df8140b3 | [] | no_license | vninfo/hackerrank-strings | 27f99271c2522773a8aba76789df645f167a02be | a49009f53d064191dcb47d4d081d80944ecfbed3 | refs/heads/master | 2020-04-02T14:39:34.222586 | 2017-07-15T21:18:03 | 2017-07-15T21:18:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 756 | swift | import Foundation;
// Enter your code here
let queries = Int(readLine()!)!
for _ in 1...queries {
let string = readLine()!
let input = Array(string.characters).map({ String($0).unicodeScalars.first!.value }).map({ Int($0) })
let count = string.characters.count
var base = [Int]()
var comparison = [Int]()
var result = 0
if string.characters.count % 2 == 0 {
base = Array(input[0..<(count / 2)])
comparison = Array(input[(count / 2)..<count])
} else {
base = Array(input[0..<(count / 2)])
comparison = Array(input[((count / 2) + 1)..<count])
}
for (index,item) in base.enumerated() {
result += abs(item - comparison.reversed()[index])
}
print(result)
} | [
-1
] |
15602deb1efad64a1e27d53c1c9bca033293b780 | 187eb0b943dabecf407fa55def14e42130336c3a | /StickerMadness/Mustache.swift | 701a816593a05e00233a6b1357b026ca6d89ca61 | [] | no_license | luhagel/LN_StickerMadness | 26768c57bc43c059b8ce0850d618663c42377f1f | e0d3c743ec7bb0273d49f6bb8ee3cca3f23d763b | refs/heads/master | 2021-01-09T20:11:50.331064 | 2016-07-01T17:12:18 | 2016-07-01T17:12:18 | 62,167,714 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 394 | swift | //
// Mustache.swift
// StickerMadness
//
// Created by Luca Hagel on 6/28/16.
// Copyright © 2016 Luca Hagel. All rights reserved.
//
import UIKit
class Mustache: Sticker {
init(){
super.init(height: 50, width: 100, imageName: "Mustache1.png")
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
| [
-1
] |
8319c68ab22aeb710c466c07deb553c86cd0bf87 | 02f92d1020a26ee381db1b78035a81ecb058cd63 | /Pods/Moya/Sources/Moya/MoyaProvider+Defaults.swift | e10e3f6866cef860de5e71af804956acc3e3db57 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | naeemshaikh90/BabylonHealthDemo | 9c69b38c30b25712a88410c9c3523655fe7040c7 | b4897ab070e6d79d0381470375a101fc3bb184fa | refs/heads/master | 2022-08-15T13:52:23.198030 | 2022-05-23T01:56:53 | 2022-05-23T01:56:53 | 78,640,457 | 0 | 1 | MIT | 2022-07-22T00:53:50 | 2017-01-11T13:14:22 | HTML | UTF-8 | Swift | false | false | 1,284 | swift | import Foundation
import Alamofire
/// These functions are default mappings to `MoyaProvider`'s properties: endpoints, requests, manager, etc.
public extension MoyaProvider {
public final class func defaultEndpointMapping(for target: Target) -> Endpoint<Target> {
let url = target.baseURL.appendingPathComponent(target.path).absoluteString
return Endpoint(
url: url,
sampleResponseClosure: { .networkResponse(200, target.sampleData) },
method: target.method,
parameters: target.parameters,
parameterEncoding: target.parameterEncoding
)
}
public final class func defaultRequestMapping(for endpoint: Endpoint<Target>, closure: RequestResultClosure) {
if let urlRequest = endpoint.urlRequest {
closure(.success(urlRequest))
} else {
closure(.failure(MoyaError.requestMapping(endpoint.url)))
}
}
public final class func defaultAlamofireManager() -> Manager {
let configuration = URLSessionConfiguration.default
configuration.httpAdditionalHeaders = Manager.defaultHTTPHeaders
let manager = Manager(configuration: configuration)
manager.startRequestsImmediately = false
return manager
}
}
| [
116673
] |
2aa6fc1084b958f45342fe48ece8285bd649c37a | fd7f313ebc4bd56b4bf8a5ff4fc74863b0ab7bde | /Pods/ReadMoreTextView/Sources/ReadMoreTextView.swift | 28d57d004633b67948ddfac2d92136475f7e8cad | [
"MIT"
] | permissive | happyguleria1234/Restored-Glory-Christian-Center | bc76f0565d81b5576fe409fd11d367f4c4d11b87 | d24edcbdbeda2405590381884e3f58520ba243e6 | refs/heads/main | 2023-08-04T18:47:47.301200 | 2021-09-20T13:27:48 | 2021-09-20T13:27:48 | 336,483,700 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 13,702 | swift | //
// ReadMoreTextView.swift
// ReadMoreTextView
//
// Created by Ilya Puchka on 06.04.15.
// Copyright (c) 2015 - 2016 Ilya Puchka. All rights reserved.
//
import UIKit
/**
UITextView subclass that adds "read more"/"read less" capabilities.
Disables scrolling and editing, so do not set these properties to true.
*/
@IBDesignable
public class ReadMoreTextView: UITextView {
public override init(frame: CGRect, textContainer: NSTextContainer?) {
readMoreTextPadding = .zero
readLessTextPadding = .zero
super.init(frame: frame, textContainer: textContainer)
setupDefaults()
}
public convenience init(frame: CGRect) {
self.init(frame: frame, textContainer: nil)
}
public convenience init() {
self.init(frame: CGRect.zero, textContainer: nil)
}
public required init?(coder aDecoder: NSCoder) {
readMoreTextPadding = .zero
readLessTextPadding = .zero
super.init(coder: aDecoder)
setupDefaults()
}
func setupDefaults() {
let defaultReadMoreText = NSLocalizedString("ReadMoreTextView.readMore", value: "more", comment: "")
let attributedReadMoreText = NSMutableAttributedString(string: "... ")
readMoreTextPadding = .zero
readLessTextPadding = .zero
isScrollEnabled = false
isEditable = false
let attributedDefaultReadMoreText = NSAttributedString(string: defaultReadMoreText, attributes: [
NSAttributedString.Key.foregroundColor: UIColor.lightGray,
NSAttributedString.Key.font: font ?? UIFont.systemFont(ofSize: 14)
])
attributedReadMoreText.append(attributedDefaultReadMoreText)
self.attributedReadMoreText = attributedReadMoreText
}
/**Block to be invoked when text view changes its content size.*/
public var onSizeChange: (ReadMoreTextView)->() = { _ in }
/**
The maximum number of lines that the text view can display. If text does not fit that number it will be trimmed.
Default is `0` which means that no text will be never trimmed.
*/
@IBInspectable
public var maximumNumberOfLines: Int = 0 {
didSet {
_originalMaximumNumberOfLines = maximumNumberOfLines
setNeedsLayout()
}
}
/**The text to trim the original text. Setting this property resets `attributedReadMoreText`.*/
@IBInspectable
public var readMoreText: String? {
get {
return attributedReadMoreText?.string
}
set {
if let text = newValue {
attributedReadMoreText = attributedStringWithDefaultAttributes(from: text)
} else {
attributedReadMoreText = nil
}
}
}
/**The attributed text to trim the original text. Setting this property resets `readMoreText`.*/
public var attributedReadMoreText: NSAttributedString? {
didSet {
setNeedsLayout()
}
}
/**
The text to append to the original text when not trimming.
*/
@IBInspectable
public var readLessText: String? {
get {
return attributedReadLessText?.string
}
set {
if let text = newValue {
attributedReadLessText = attributedStringWithDefaultAttributes(from: text)
} else {
attributedReadLessText = nil
}
}
}
/**
The attributed text to append to the original text when not trimming.
*/
public var attributedReadLessText: NSAttributedString? {
didSet {
setNeedsLayout()
}
}
/**
A Boolean that controls whether the text view should trim it's content to fit the `maximumNumberOfLines`.
The default value is `false`.
*/
@IBInspectable
public var shouldTrim: Bool = false {
didSet {
guard shouldTrim != oldValue else { return }
if shouldTrim {
maximumNumberOfLines = _originalMaximumNumberOfLines
} else {
let _maximumNumberOfLines = maximumNumberOfLines
maximumNumberOfLines = 0
_originalMaximumNumberOfLines = _maximumNumberOfLines
}
cachedIntrinsicContentHeight = nil
setNeedsLayout()
}
}
/**
Force to update trimming on the next layout pass. To update right away call `layoutIfNeeded` right after.
*/
public func setNeedsUpdateTrim() {
_needsUpdateTrim = true
setNeedsLayout()
}
/**
A padding around "read more" text to adjust touchable area.
If text is trimmed touching in this area will change `shouldTream` to `false` and remove trimming.
That will cause text view to change it's content size. Use `onSizeChange` to adjust layout on that event.
*/
public var readMoreTextPadding: UIEdgeInsets
/**
A padding around "read less" text to adjust touchable area.
If text is not trimmed and `readLessText` or `attributedReadLessText` is set touching in this area
will change `shouldTream` to `true` and cause trimming. That will cause text view to change it's content size.
Use `onSizeChange` to adjust layout on that event.
*/
public var readLessTextPadding: UIEdgeInsets
public override var text: String! {
didSet {
if let text = text {
_originalAttributedText = attributedStringWithDefaultAttributes(from: text)
} else {
_originalAttributedText = nil
}
}
}
public override var attributedText: NSAttributedString! {
willSet {
if #available(iOS 9.0, *) { return }
//on iOS 8 text view should be selectable to properly set attributed text
if newValue != nil {
isSelectable = true
}
}
didSet {
_originalAttributedText = attributedText
}
}
public override func layoutSubviews() {
super.layoutSubviews()
if _needsUpdateTrim {
//reset text to force update trim
attributedText = _originalAttributedText
_needsUpdateTrim = false
}
needsTrim() ? showLessText() : showMoreText()
}
public override var intrinsicContentSize : CGSize {
textContainer.size = CGSize(width: bounds.size.width, height: CGFloat.greatestFiniteMagnitude)
var intrinsicContentSize = layoutManager.boundingRect(forGlyphRange: layoutManager.glyphRange(for: textContainer), in: textContainer).size
// intrinsicContentSize.width = UIView.noIntrinsicMetric
intrinsicContentSize.height += (textContainerInset.top + textContainerInset.bottom)
intrinsicContentSize.height = ceil(intrinsicContentSize.height)
return intrinsicContentSize
}
private var intrinsicContentHeight: CGFloat {
return intrinsicContentSize.height
}
private var cachedIntrinsicContentHeight: CGFloat?
public override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
return hitTest(pointInGliphRange: point, event: event) { _ in
guard pointIsInReadMoreOrReadLessTextRange(point: point) != nil else { return nil }
return self
}
}
public override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
if let point = touches.first?.location(in: self) {
shouldTrim = pointIsInReadMoreOrReadLessTextRange(point: point) ?? shouldTrim
}
super.touchesEnded(touches, with: event)
}
//MARK: Private methods
private var _needsUpdateTrim = false
private var _originalMaximumNumberOfLines: Int = 0
private var _originalAttributedText: NSAttributedString!
private var _originalTextLength: Int {
get {
return _originalAttributedText?.length ?? 0
}
}
private func attributedStringWithDefaultAttributes(from text: String) -> NSAttributedString {
return NSAttributedString(string: text, attributes: [
NSAttributedString.Key.font: font ?? UIFont.systemFont(ofSize: 14),
NSAttributedString.Key.foregroundColor: textColor ?? UIColor.black
])
}
private func needsTrim() -> Bool {
return shouldTrim && readMoreText != nil
}
private func showLessText() {
if let readMoreText = readMoreText, text.hasSuffix(readMoreText) { return }
shouldTrim = true
textContainer.maximumNumberOfLines = maximumNumberOfLines
layoutManager.invalidateLayout(forCharacterRange: layoutManager.characterRangeThatFits(textContainer: textContainer), actualCharacterRange: nil)
textContainer.size = CGSize(width: bounds.size.width, height: CGFloat.greatestFiniteMagnitude)
if let text = attributedReadMoreText {
let range = rangeToReplaceWithReadMoreText()
guard range.location != NSNotFound else { return }
textStorage.replaceCharacters(in: range, with: text)
}
invalidateIntrinsicContentSize()
invokeOnSizeChangeIfNeeded()
}
private func showMoreText() {
if let readLessText = readLessText, text.hasSuffix(readLessText) { return }
shouldTrim = false
textContainer.maximumNumberOfLines = 0
if let originalAttributedText = _originalAttributedText?.mutableCopy() as? NSMutableAttributedString {
attributedText = _originalAttributedText
let range = NSRange(location: 0, length: text.unicodeScalars.count)
if let attributedReadLessText = attributedReadLessText {
originalAttributedText.append(attributedReadLessText)
}
textStorage.replaceCharacters(in: range, with: originalAttributedText)
}
invalidateIntrinsicContentSize()
invokeOnSizeChangeIfNeeded()
}
private func invokeOnSizeChangeIfNeeded() {
if let cachedIntrinsicContentHeight = cachedIntrinsicContentHeight {
if intrinsicContentHeight != cachedIntrinsicContentHeight {
self.cachedIntrinsicContentHeight = intrinsicContentHeight
onSizeChange(self)
}
} else {
self.cachedIntrinsicContentHeight = intrinsicContentHeight
onSizeChange(self)
}
}
private func rangeToReplaceWithReadMoreText() -> NSRange {
let rangeThatFitsContainer = layoutManager.characterRangeThatFits(textContainer: textContainer)
if NSMaxRange(rangeThatFitsContainer) == _originalTextLength {
return NSMakeRange(NSNotFound, 0)
}
else {
let lastCharacterIndex = characterIndexBeforeTrim(range: rangeThatFitsContainer)
if lastCharacterIndex > 0 {
return NSMakeRange(lastCharacterIndex, textStorage.length - lastCharacterIndex)
}
else {
return NSMakeRange(NSNotFound, 0)
}
}
}
private func characterIndexBeforeTrim(range rangeThatFits: NSRange) -> Int {
if let text = attributedReadMoreText {
let readMoreBoundingRect = attributedReadMoreText(text: text, boundingRectThatFits: textContainer.size)
let lastCharacterRect = layoutManager.boundingRectForCharacterRange(range: NSMakeRange(NSMaxRange(rangeThatFits)-1, 1), inTextContainer: textContainer)
var point = lastCharacterRect.origin
point.x = textContainer.size.width - ceil(readMoreBoundingRect.size.width)
let glyphIndex = layoutManager.glyphIndex(for: point, in: textContainer, fractionOfDistanceThroughGlyph: nil)
let characterIndex = layoutManager.characterIndexForGlyph(at: glyphIndex)
return characterIndex - 1
} else {
return NSMaxRange(rangeThatFits) - readMoreText!.length
}
}
private func attributedReadMoreText(text aText: NSAttributedString, boundingRectThatFits size: CGSize) -> CGRect {
let textContainer = NSTextContainer(size: size)
let textStorage = NSTextStorage(attributedString: aText)
let layoutManager = NSLayoutManager()
layoutManager.addTextContainer(textContainer)
textStorage.addLayoutManager(layoutManager)
let readMoreBoundingRect = layoutManager.boundingRectForCharacterRange(range: NSMakeRange(0, text.length), inTextContainer: textContainer)
return readMoreBoundingRect
}
private func readMoreTextRange() -> NSRange {
var readMoreTextRange = rangeToReplaceWithReadMoreText()
if readMoreTextRange.location != NSNotFound {
readMoreTextRange.length = readMoreText!.length + 1
}
return readMoreTextRange
}
private func readLessTextRange() -> NSRange {
return NSRange(location: _originalTextLength, length: readLessText!.length + 1)
}
private func pointIsInReadMoreOrReadLessTextRange(point aPoint: CGPoint) -> Bool? {
if needsTrim() && pointIsInTextRange(point: aPoint, range: readMoreTextRange(), padding: readMoreTextPadding) {
return false
} else if readLessText != nil && pointIsInTextRange(point: aPoint, range: readLessTextRange(), padding: readLessTextPadding) {
return true
}
return nil
}
}
extension String {
var length: Int {
return utf16.count
}
}
| [
-1
] |
b05ca26485f0a2f9d9a99deaaf46cc27431fbf87 | df5969a598832cf7db2e4b3f3e104ed8320d3c45 | /KanbanView/Model/ColumnData.swift | d26418e14db1891481475ad373d9b4084453fb90 | [] | no_license | steanox/KanbanViewStarter | 8e1c6b8168fd6aa5e76f830117683379192520b3 | 45cde5b24b1da35f5fd0d68393879d39c343aff7 | refs/heads/master | 2020-06-12T08:47:02.670581 | 2019-06-28T10:03:25 | 2019-06-28T10:03:25 | 194,249,631 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,944 | swift | //
// ColumnData.swift
// KanbanView
//
// Created by octavianus on 24/06/19.
// Copyright © 2019 octavianus. All rights reserved.
//
import Foundation
let titles = """
Fix UIKIT,
Design Wireframe,
Held user interview,
Fix The notification button,
Meeting with Product Owner,
Handle back end,
Research for the front end
Have some sleep,
Learn about UISwift,
Handling bugs in the main menu,
Create mockup,
Learn more about user persona,
Give doggos some chips,
Configure apps deployment,
Call customer service,
Compare the New Difable data source
"""
struct KanbanColumn{
let headerTitle: String
let row: [KanbanRow]
static func fetchTestData() -> [KanbanColumn]{
var columns = [KanbanColumn]()
columns.append(KanbanColumn(headerTitle: "Ready", row: KanbanRow.fetchTestData()))
columns.append(KanbanColumn(headerTitle: "Progress", row: KanbanRow.fetchTestData()))
columns.append(KanbanColumn(headerTitle: "Waiting", row: KanbanRow.fetchTestData()))
columns.append(KanbanColumn(headerTitle: "Done", row: KanbanRow.fetchTestData()))
columns.append(KanbanColumn(headerTitle: "Fail", row: KanbanRow.fetchTestData()))
columns.append(KanbanColumn(headerTitle: "On Meeting", row: KanbanRow.fetchTestData()))
columns.append(KanbanColumn(headerTitle: "Bye", row: KanbanRow.fetchTestData()))
return columns
}
}
struct KanbanRow{
let title: String
let priority: Int = Int.random(in: 0...3)
static func fetchTestData() -> [KanbanRow]{
let testData = titles.components(separatedBy: ",\n")
let totalTestData = testData.count - 1
var kanbanRow = [KanbanRow]()
for data in 0...Int.random(in: 0...totalTestData){
kanbanRow.append(KanbanRow(title: testData[Int.random(in: 0...totalTestData)]))
}
return kanbanRow
}
}
| [
-1
] |
459300708f1842543f10fc9ec78d9b53b06343cb | 30624796c17fd369a2247d5d385b38abb23ec1db | /viewFinder/AddPhotoViewController.swift | ccb035d06227b083e8bae8621e639096e2237f94 | [] | no_license | maevet78/viewFinder | d259298bd40adb31eeeebe7cbcdb7d50658fcccb | 302d8388f0ee23010ea5dfb135654e0fdbe3d446 | refs/heads/master | 2020-06-20T19:02:33.661101 | 2019-07-16T20:31:05 | 2019-07-16T20:31:05 | 197,216,281 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,126 | swift | //
// AddPhotoViewController.swift
// viewFinder
//
// Created by Maeve Thompson on 7/16/19.
// Copyright © 2019 Maeve Thompson. All rights reserved.
//
import UIKit
class AddPhotoViewController: UIViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate {
var imagePicker = UIImagePickerController()
@IBOutlet weak var imageView: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
imagePicker.delegate = self
// Do any additional setup after loading the view.
}
@IBOutlet weak var captionText: UITextField!
@IBAction func cameraTapped(_ sender: UIButton) {
imagePicker.sourceType = .camera
present(imagePicker, animated: true, completion: nil)
}
@IBAction func albumTapped(_ sender: UIButton) {
imagePicker.sourceType = .photoLibrary
present(imagePicker, animated: true, completion: nil)
}
@IBAction func saveButtonTapped(_ sender: UIButton) {
if let context = (UIApplication.shared.delegate as? AppDelegate)?.persistentContainer.viewContext {
let photoToSave = Photos(entity: Photos.entity(), insertInto: context)
photoToSave.caption = captionText.text
if let userImage = imageView.image {
if let userImageData = userImage.pngData() {
photoToSave.imageData = userImageData
}
}
(UIApplication.shared.delegate as? AppDelegate)?.saveContext()
navigationController?.popViewController(animated: true)
}
}
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
if let selectedImage = info[UIImagePickerController.InfoKey.originalImage] as? UIImage
{imageView.image = selectedImage}
imagePicker.dismiss(animated: true, completion: nil)
}
}
| [
-1
] |
37fe58f3c500a825e199f77d352f5a340985c75d | b5c39f5a14e85abce56a198d1b2940d7b3bd8f6b | /Smack/Controller/ProfileVC.swift | 12f6e77dfff1f88f7d0539c2ede3f3d1981d7156 | [] | no_license | ArminSpahic/Smack-master | 873b2dd81e4a9409408ac5cdba196e2ee01ea17e | 78d7a1ad7d7628bfacc03a516f4158f47c7d5884 | refs/heads/master | 2021-05-12T15:42:13.979879 | 2018-02-12T21:43:41 | 2018-02-12T21:43:41 | 116,990,709 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,549 | swift | //
// ProfileVC.swift
// Smack
//
// Created by Armin Spahic on 25/01/2018.
// Copyright © 2018 Armin Spahic. All rights reserved.
//
import UIKit
class ProfileVC: UIViewController {
@IBOutlet weak var userImg: UIImageView!
@IBOutlet weak var userName: UILabel!
@IBOutlet weak var userEmail: UILabel!
@IBOutlet weak var bgView: UIView!
override func viewDidLoad() {
super.viewDidLoad()
setupView()
// Do any additional setup after loading the view.
}
@IBAction func closeBtn(_ sender: Any) {
self.dismiss(animated: true, completion: nil)
}
@IBAction func logoutBtn(_ sender: Any) {
UserDataService.instance.logoutUser()
NotificationCenter.default.post(name: NOTIF_USER_DATA_DID_CHANGE, object: nil)
dismiss(animated: true, completion: nil)
}
func setupView() {
userName.text = UserDataService.instance.name
userEmail.text = UserDataService.instance.email
userImg.image = UIImage(named: UserDataService.instance.avatarName)
userImg.backgroundColor = UserDataService.instance.returnUIColor(components: UserDataService.instance.avatarColor)
let closeTouch = UITapGestureRecognizer(target: self, action: #selector(ProfileVC.closeTap(_recognizer:)))
bgView.addGestureRecognizer(closeTouch)
}
@objc func closeTap(_recognizer: UITapGestureRecognizer){
dismiss(animated: true, completion: nil)
}
}
| [
325653
] |
d37705af052cd5b015f5ae47f46e23cdc8c8fd94 | bdacf531d9b82e6ccfb3f39dfdd7f92eefb9b4e8 | /Sources/Core/SwiftAST/Expression/BlockLiteralExpression.swift | 506abe5d5ab66c5e31801d8496bb7017f1e58aeb | [
"LicenseRef-scancode-warranty-disclaimer",
"BSD-2-Clause",
"BSD-3-Clause",
"MIT"
] | permissive | LuizZak/SwiftRewriter | 63d73da7cae09edf95ce989fe5b0c41ecd5ba2a5 | 1e1e1a910e769b83c6b24786a15289d704f1a144 | refs/heads/master | 2023-06-24T22:42:57.421077 | 2023-06-12T16:58:43 | 2023-06-12T16:58:43 | 140,700,310 | 243 | 36 | NOASSERTION | 2023-06-12T16:58:45 | 2018-07-12T10:48:12 | Swift | UTF-8 | Swift | false | false | 3,917 | swift | public class BlockLiteralExpression: Expression, ExpressionKindType {
public var expressionKind: ExpressionKind {
.blockLiteral(self)
}
public var parameters: [BlockParameter]
public var returnType: SwiftType
public var body: CompoundStatement {
didSet { oldValue.parent = nil; body.parent = self }
}
public override var children: [SyntaxNode] {
[body]
}
public override var description: String {
var buff = "{ "
buff += "("
buff += parameters.map(\.description).joined(separator: ", ")
buff += ") -> "
buff += returnType.description
buff += " in "
buff += "< body >"
buff += " }"
return buff
}
public override var requiresParens: Bool {
true
}
public init(parameters: [BlockParameter], returnType: SwiftType, body: CompoundStatement) {
self.parameters = parameters
self.returnType = returnType
self.body = body
super.init()
self.body.parent = self
}
public required init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
parameters = try container.decode([BlockParameter].self, forKey: .parameters)
returnType = try container.decode(SwiftType.self, forKey: .returnType)
body = try container.decodeStatement(CompoundStatement.self, forKey: .body)
try super.init(from: container.superDecoder())
self.body.parent = self
}
@inlinable
public override func copy() -> BlockLiteralExpression {
BlockLiteralExpression(
parameters: parameters,
returnType: returnType,
body: body.copy()
).copyTypeAndMetadata(from: self)
}
@inlinable
public override func accept<V: ExpressionVisitor>(_ visitor: V) -> V.ExprResult {
visitor.visitBlock(self)
}
public override func isEqual(to other: Expression) -> Bool {
switch other {
case let rhs as BlockLiteralExpression:
return self == rhs
default:
return false
}
}
public override func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(parameters, forKey: .parameters)
try container.encode(returnType, forKey: .returnType)
try container.encodeStatement(body, forKey: .body)
try super.encode(to: container.superEncoder())
}
public static func == (lhs: BlockLiteralExpression, rhs: BlockLiteralExpression) -> Bool {
if lhs === rhs {
return true
}
return lhs.parameters == rhs.parameters &&
lhs.returnType == rhs.returnType &&
lhs.body == rhs.body
}
private enum CodingKeys: String, CodingKey {
case parameters
case returnType
case body
}
}
public extension Expression {
@inlinable
var asBlock: BlockLiteralExpression? {
cast()
}
@inlinable
var isBlock: Bool {
asBlock != nil
}
static func block(
parameters: [BlockParameter] = [],
`return` returnType: SwiftType = .void,
body: CompoundStatement
) -> BlockLiteralExpression {
BlockLiteralExpression(parameters: parameters, returnType: returnType, body: body)
}
}
public struct BlockParameter: Codable, Equatable {
public var name: String
public var type: SwiftType
public init(name: String, type: SwiftType) {
self.name = name
self.type = type
}
}
extension BlockParameter: CustomStringConvertible {
public var description: String {
"\(self.name): \(type)"
}
}
| [
-1
] |
23f773e2b79481d6e5ca3792bc70f9c23a686524 | 6132903d1adc5fa05ba119d4ce77759ce4fe0f04 | /PhantomTests/AppDelegateTest.swift | dd197f5692e7365de8b77b3d393b909f80cd0259 | [
"MIT"
] | permissive | Cantallops/Phantom | 51b0ba6c42944ae9b0e4e8ea2335a62a2a996813 | de650f6f47f69a1a27a5f255dad034a7b419bde5 | refs/heads/master | 2021-05-14T08:46:56.453139 | 2018-07-08T19:42:46 | 2018-07-08T19:42:46 | 116,307,975 | 22 | 2 | MIT | 2018-01-28T22:11:26 | 2018-01-04T21:11:00 | Swift | UTF-8 | Swift | false | false | 2,760 | swift | //
// AppDelegateTest.swift
// PhantomTests
//
// Created by Alberto Cantallops on 05/09/2017.
// Copyright © 2017 Alberto Cantallops. All rights reserved.
//
import XCTest
@testable import Phantom
class AppDelegateTest: XCTestCase {
// swiftlint:disable:next weak_delegate
fileprivate var appDelegate: AppDelegate!
fileprivate var firstFakeService: FakeAppDelegateService!
fileprivate var secondFakeService: FakeAppDelegateService!
override func setUp() {
super.setUp()
appDelegate = AppDelegate()
appDelegate.checkRunningTest = false
firstFakeService = FakeAppDelegateService()
secondFakeService = FakeAppDelegateService()
appDelegate.services = [firstFakeService, secondFakeService]
}
override func tearDown() {
super.tearDown()
}
func testExecuteDidFinishLaunchingShouldExecuteAllOfServices() {
_ = appDelegate.application(UIApplication.shared, didFinishLaunchingWithOptions: nil)
XCTAssertTrue(firstFakeService.executedDidFinishLaunchingWithOptions)
XCTAssertTrue(secondFakeService.executedDidFinishLaunchingWithOptions)
}
func testExecuteDidFinishLaunchingShouldReturnFalseIfOneOfTheServicesDoes() {
secondFakeService.didFinishLaunchingWithOptionsResult = false
let result = appDelegate.application(UIApplication.shared, didFinishLaunchingWithOptions: nil)
XCTAssertTrue(firstFakeService.executedDidFinishLaunchingWithOptions)
XCTAssertTrue(secondFakeService.executedDidFinishLaunchingWithOptions)
XCTAssertFalse(result)
}
func testExecuteDidFinishLaunchingShouldNotExecuteFollowingServiceIfOneReturnFalse() {
secondFakeService.didFinishLaunchingWithOptionsResult = false
let thirdFakeService = FakeAppDelegateService()
appDelegate.services = [firstFakeService, secondFakeService, thirdFakeService]
_ = appDelegate.application(UIApplication.shared, didFinishLaunchingWithOptions: nil)
XCTAssertTrue(firstFakeService.executedDidFinishLaunchingWithOptions)
XCTAssertTrue(secondFakeService.executedDidFinishLaunchingWithOptions)
XCTAssertFalse(thirdFakeService.executedDidFinishLaunchingWithOptions)
}
}
private class FakeAppDelegateService: NSObject, UIApplicationDelegate {
var executedDidFinishLaunchingWithOptions: Bool = false
var didFinishLaunchingWithOptionsResult: Bool = true
override init() {
}
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]? = nil
) -> Bool {
executedDidFinishLaunchingWithOptions = true
return didFinishLaunchingWithOptionsResult
}
}
| [
-1
] |
a3c4979ed7c750496ca1a33038e0fe33ef875220 | f7379566cd8d8aa1947f76581706c94085d0390f | /CXSwiftStudy/CXSwiftStudy/Classes/Runtime/CXRuntimeTableViewController.swift | 1fe2eac0d56f8dac0925d2346cc863e57c661e20 | [] | no_license | cangxue/CXSwiftAndOC | bf5adda46c997356380cce3b6d1a96378bfb9c1c | 194a8c6dc967c741ee35f37ac1c55c6157643597 | refs/heads/master | 2021-01-19T12:25:35.030610 | 2018-10-16T01:36:54 | 2018-10-16T01:36:54 | 88,031,567 | 0 | 0 | null | 2017-12-23T04:13:04 | 2017-04-12T09:01:34 | Objective-C | UTF-8 | Swift | false | false | 3,343 | swift | //
// CXRuntimeTableViewController.swift
// CXSwiftStudy
//
// Created by ymh on 2018/3/8.
// Copyright © 2018年 CX. All rights reserved.
//
import UIKit
class myTableView: UITableView {
override init(frame: CGRect, style: UITableViewStyle) {
super.init(frame: frame, style: style)
// myTableView.awake
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
class CXRuntimeTableViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {
var mainTableView: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
mainTableView = UITableView(frame: view.bounds, style: .plain)
mainTableView.dataSource = self
mainTableView.delegate = self
self.view.addSubview(mainTableView)
mainTableView.register(UITableViewCell.self, forCellReuseIdentifier: "CellID")
}
func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 2
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let indentifier = "CellID"
let cell = tableView.dequeueReusableCell(withIdentifier: indentifier, for: indexPath)
cell.textLabel?.text = "cell"
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
self.mainTableView.reloadData()
}
}
extension UIApplication {
open override var next: UIResponder? {
// UITableView.awake
return super.next
}
}
extension UITableView {
//静态方法,只执行一次
static let awake: Void = {
let originalSelector = #selector(UITableView.reloadData)
let swizzledSelector = #selector(UITableView.sizzle_reloadData)
let originalMethod = class_getInstanceMethod(UITableView.self, originalSelector)
let swizzledMethod = class_getInstanceMethod(UITableView.self, swizzledSelector)
method_exchangeImplementations(originalMethod, swizzledMethod)
}()
//dynamic修饰才能动态调用
@objc dynamic private func sizzle_reloadData() {
print("刷新数据吧2")
//执行刷新
self.checkEmpty()
self.sizzle_reloadData()
}
private func checkEmpty() {
var isEmpty: Bool = true
let data_source = self.dataSource
let sections = (data_source?.numberOfSections!(in: self))!
for item in 1...sections {
let rows = (data_source?.tableView(self, numberOfRowsInSection: item))!
if rows > 0 {
isEmpty = false
break
} else {
isEmpty = true
}
}
if isEmpty == true {
print("数据为空")
let view = UIView(frame: self.bounds)
view.backgroundColor = UIColor.red
self.addSubview(view)
} else {
print("数据不为空")
}
}
}
| [
-1
] |
3fa0f0f4d4bce7d94818c5fcba9e73ba291d93e2 | c07a3a9492525b3b876ebf5af9d7c42d5f22ca42 | /2018/AOC_12_1.swift | c12b785c155821be9db7c8a319f45ee69af661b9 | [
"MIT"
] | permissive | SamirTalwar/advent-of-code | 78d28149bd7c9f79e9afddaba975ba75c08fd9cc | 686ee9cf8c05db98c1bb54114660e24d1dd23fee | refs/heads/main | 2023-01-08T15:07:51.819896 | 2022-12-17T13:20:56 | 2022-12-17T13:20:56 | 76,997,372 | 5 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,963 | swift | enum Pot {
case empty
case withPlant
}
extension Pot: CustomStringConvertible {
var description: String {
switch self {
case .empty:
return "."
case .withPlant:
return "#"
}
}
}
struct Pots: Hashable, BidirectionalCollection, CustomStringConvertible {
typealias Element = Pot
typealias Collection = [Element]
typealias Index = Collection.Index
typealias Iterator = Collection.Iterator
private let pots: Collection
var description: String {
return pots.map { pot in pot.description }.joined()
}
var count: Int {
return pots.count
}
var startIndex: Index {
return pots.startIndex
}
var endIndex: Index {
return pots.endIndex
}
init(_ pots: Collection) {
self.pots = pots
}
subscript(index: Index) -> Element {
if index < startIndex || index >= endIndex {
return Pot.empty
}
return pots[index]
}
func index(before index: Index) -> Index {
return pots.index(before: index)
}
func index(after index: Index) -> Index {
return pots.index(after: index)
}
func index(index: Index, offsetBy distance: Int) -> Index {
return pots.index(index, offsetBy: distance)
}
func makeIterator() -> Iterator {
return pots.makeIterator()
}
func shrink() -> (Pots, Int) {
guard let dropFromStart = pots.firstIndex(where: { pot in pot == Pot.withPlant }) else {
return (Pots([]), 0)
}
let dropFromEnd = pots.lastIndex(where: { pot in pot == Pot.withPlant })!
let shrunkPots = Array(pots[dropFromStart ... dropFromEnd])
return (Pots(shrunkPots), dropFromStart)
}
}
typealias Spreading = [Pots: Pot]
struct State: Hashable, CustomStringConvertible {
let pots: Pots
let offset: Int
var description: String {
return pots.description
}
var result: Int {
return pots.enumerated()
.reduce(0) { value, pot in value + (pot.element == Pot.withPlant ? pot.offset + offset : 0) }
}
init(pots: Pots) {
self.init(pots: pots, offset: 0)
}
init(pots: Pots, offset: Int) {
let (shrunkPots, shrinkingOffset) = pots.shrink()
self.pots = shrunkPots
self.offset = offset + shrinkingOffset
}
func spread(spreading: Spreading) -> State {
let indices = pots.index(pots.startIndex, offsetBy: -2) ... pots.index(pots.endIndex, offsetBy: 2)
let newPots = indices.map { i -> Pot in
let surrounding = Pots([self.pots[i - 2], self.pots[i - 1], self.pots[i], self.pots[i + 1], self.pots[i + 2]])
return spreading[surrounding] ?? Pot.empty
}
return State(pots: Pots(newPots), offset: offset - 2)
}
}
let initialStateParser = try! RegExp(pattern: "^initial state: ([\\.#]+)$")
let spreadingParser = try! RegExp(pattern: "^([\\.#]+) => ([\\.#])$")
func main() {
let initialState = parseInitialState(in: readLine()!)
_ = readLine()!
let spreading = Dictionary(uniqueKeysWithValues: StdIn().map(parseSpreading))
var state = initialState
for _ in 1 ... 20 {
state = state.spread(spreading: spreading)
}
print(state.result)
}
func parseInitialState(in string: String) -> State {
let match = initialStateParser.firstMatch(in: string)!
return parseState(in: String(match[1]))
}
func parseSpreading(in string: String) -> (Pots, Pot) {
let match = spreadingParser.firstMatch(in: string)!
return (parsePots(in: String(match[1])), parsePot(in: match[2].first!))
}
func parseState(in string: String) -> State {
return State(pots: parsePots(in: string))
}
func parsePots(in string: String) -> Pots {
return Pots(string.map(parsePot))
}
func parsePot(in character: Character) -> Pot {
return character == "#" ? Pot.withPlant : Pot.empty
}
| [
-1
] |
28fb73baf486e20df8b637b9330b71de8e20e6bb | 94982be8d1040589ce906f8c712e370a87be4017 | /Game States/Menu.swift | 32485df201e5206c98ca6edda77558b06e7d85da | [] | no_license | shaniherskowitz/Shape-Up | 2fa85034793b250e474f1f254b7f0fd8092fd5e3 | ec66165372fa702e98e7b3190b63c439da90b0cf | refs/heads/master | 2020-03-18T11:57:15.671424 | 2018-06-03T06:46:41 | 2018-06-03T06:46:41 | 134,700,334 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 820 | swift | //
// Menu.swift
// Shapes
//
// Created by shani herskowitz on 5/23/18.
// Copyright © 2018 Ray Wenderlich. All rights reserved.
//
import SpriteKit
import GameplayKit
class Menu: GKState {
unowned let scene: GameScene
init(scene: SKScene) {
self.scene = scene as! GameScene
super.init()
}
override func didEnter(from previousState: GKState?) {
let scale = SKAction.scale(to: 1.0, duration: 0.25)
scene.childNode(withName: GameMessageName)!.run(scale)
}
override func willExit(to nextState: GKState) {
if nextState is Playing {
let scale = SKAction.scale(to: 0, duration: 0.4)
scene.childNode(withName: GameMessageName)!.run(scale)
}
}
override func isValidNextState(_ stateClass: AnyClass) -> Bool {
return stateClass is Playing.Type
}
}
| [
-1
] |
8a205ac9e54cc80f41ddf4e1abf5cdf23ad9afa1 | 9ce4e26d29cd63a61965a543f408f62995252309 | /BYT/BYT/Protocols/FoaasProtocols.swift | fc7d5c4a421bce8ca440267ef31e8bf533cfcc4e | [
"MIT"
] | permissive | AccessLite/BYT-sabrinaip | 1b9dd52818605f8b0682e599fa839e709f914647 | cfcc957d86f408f07c820e62526fd1c72add05fc | refs/heads/master | 2020-06-28T19:39:31.685099 | 2016-11-23T05:14:50 | 2016-11-23T05:14:50 | 74,476,206 | 0 | 0 | null | 2016-11-23T06:31:29 | 2016-11-22T13:41:52 | Swift | UTF-8 | Swift | false | false | 565 | swift | //
// FoaasProtocols.swift
// BYT
//
// Created by Sabrina Ip on 11/22/16.
// Copyright © 2016 Sabrina. All rights reserved.
//
import Foundation
protocol JSONConvertible {
init?(json: [String : AnyObject])
func toJson() -> [String : AnyObject]
}
// This protocol's intention is to allow you to convert a model into Data to be stored in UserDefaults
// This protocol relies on JSONConvertible working to convert models into Swift-types (Array, Dict, String, etc.).
protocol DataConvertible {
init?(data: Data)
func toData() throws -> Data
}
| [
-1
] |
cf8c15362d4bcb360bb04c91dbb97ed67c45f7b7 | 2d33fa4e6f6a3f05580e5ccc369a3e9b6d6db42d | /src/wsm/wsm/viewcontrollers/TimeSheet/TimeSheetViewController.swift | 5d901231bf67f4a054e4237250e2d05bfc88abf3 | [] | no_license | duongdang152/wsm_ios | 2f7e670c340b2b06fd137f3b4afe045119461cfc | 0a5ce9d37ef98771b9eb034bc564ad2386790fc8 | refs/heads/develop | 2021-07-08T13:19:33.331827 | 2017-10-04T07:47:35 | 2017-10-04T07:47:35 | 105,842,843 | 0 | 0 | null | 2017-10-05T02:49:55 | 2017-10-05T02:49:55 | null | UTF-8 | Swift | false | false | 17,247 | swift | //
// TimeSheetViewController.swift
// wsm
//
// Created by framgia on 9/20/17.
// Copyright © 2017 framgia. All rights reserved.
//
import UIKit
import Floaty
import InAppLocalize
import PromiseKit
class TimeSheetViewController: BaseViewController, FloatyDelegate {
//MARK: properties
fileprivate let floaty = Floaty()
fileprivate var calendar: FSCalendar!
fileprivate let calenderIdentifier = "wsmCalendar"
fileprivate let calenderCellIdentifier = "calenderCellIdentifier"
fileprivate var workingTimeSheets: TimeSheetModel?
fileprivate var gregorian: Calendar!
fileprivate var preMonthButton: UIButton!
fileprivate var nextMonthButton: UIButton!
fileprivate var today = Calendar.calendarUS.todayOfCalendar
private let buttonHeaderWidth: CGFloat = 40.0
fileprivate var selectedTimeSheetDay: TimeSheetDayModel?
fileprivate var shouldShowTimeSheetDayDetail = false
fileprivate let refreshControl = UIRefreshControl()
//MARK: IBOutlet
@IBOutlet weak var timeSheetTableView: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
gregorian = Calendar.calendarUS
timeSheetTableView.delegate = self
timeSheetTableView.dataSource = self
// Add Refresh Control to Table View
if #available(iOS 10.0, *) {
timeSheetTableView.refreshControl = refreshControl
} else {
timeSheetTableView.addSubview(refreshControl)
}
// Configure Refresh Control
refreshControl.addTarget(self, action: #selector(pullToRefreshHandler(_:)), for: .valueChanged)
initDateForToday()
}
@objc private func pullToRefreshHandler(_: Any) {
fetchWorkingCalendarData(forDate: self.calendar.currentPage)
}
//1. run API with today value
//2.1 check if: start ..-> today ..-> end working date => keep current page
//2.2 check if: today ..-> start ..-> end working date => this case never happend -> just set null for API return value -> display normal calendar
//2.3 check if: start ..-> end ..-> today working date => call API with value of current endWorkingDate.addMonth(1) value (month, year)
//2.3.1 move currrent page to next page
private func initDateForToday() {
AlertHelper.showLoading()
if let cutOffDate = UserServices.getLocalUserProfile()?.company?.cutOffDate,
let dayOfToday = today.component(.day),
dayOfToday > cutOffDate {
today = today.dateFor(.startOfMonth).adjust(.month, offset: 1)
}
TimesheetProvider.getUserTimeSheet(month: today.component(.month)!, year: today.component(.year)!)
.then { userTimeSheet -> Void in
self.workingTimeSheets = userTimeSheet.userTimeSheetData
if let workingTimeSheets = self.workingTimeSheets {
let correctMonthOffSet = -self.correctMonthAdujstOffSet(startWorkingDate: workingTimeSheets.startDate?.dateFor(.startOfDay),
endWorkingDate: workingTimeSheets.endDate?.dateFor(.startOfDay),
currentPage: self.today)
if correctMonthOffSet == 1 {
let nextWorkingMonth = self.today.adjust(.month, offset: correctMonthOffSet)
self.fetchWorkingCalendarData(forDate: nextWorkingMonth, withAnimation: false)
} else if correctMonthOffSet == -1 {
self.workingTimeSheets = nil
AlertHelper.hideLoading()
} else {
//update cutOffDay on UserProfile
if let userProfile = UserServices.getLocalUserProfile() {
userProfile.company?.cutOffDate = workingTimeSheets.endDate?.component(.day)
UserServices.saveUserProfile(userProfileResult: userProfile)
}
AlertHelper.hideLoading()
}
}
}.catch { error in
AlertHelper.showError(error: error)
}.always {
self.createFSCalendar(withToday: self.today)
self.calendar.setCurrentPage(self.today, animated: false)
self.calendar.reloadData()
self.timeSheetTableView.reloadData()
}
}
func fetchWorkingCalendarData(forDate date: Date, withAnimation: Bool = true) {
firstly { _ -> Promise<TimeSheetApiOutputModel> in
self.shouldShowTimeSheetDayDetail = false
self.timeSheetTableView.reloadData()
AlertHelper.showLoading()
return TimesheetProvider.getUserTimeSheet(month: date.component(.month)!, year: date.component(.year)!)
}.then { userTimeSheet -> Void in
if let workingTimeSheets = userTimeSheet.userTimeSheetData {
self.workingTimeSheets = workingTimeSheets
//update cutOffDay on UserProfile
if let userProfile = UserServices.getLocalUserProfile() {
userProfile.company?.cutOffDate = workingTimeSheets.endDate?.component(.day)
UserServices.saveUserProfile(userProfileResult: userProfile)
}
self.correctCalendarDisplayCurrentPage(startWorkingDate: workingTimeSheets.startDate,
endWorkingDate: workingTimeSheets.endDate,
currentPage: self.calendar.currentPage,
withAnimation: withAnimation)
}
}.recover { error in
AlertHelper.showErrorWithPromise(error: error)
}.always {
self.refreshControl.endRefreshing()
AlertHelper.hideLoading()
}
}
/**
* each page which is have the calendar.currentPage is the first day of current month
* if new workingTimeSheets is nil -> keep current state
* 1. if the new startWorkingDay ->.. currentPage ->.. endWorkingDay |=> keep display currentPage
* 2. if the currentPage ->.. new startWorkingDay ->.. endWorkingDay |=> display next page
* 3. if the new startWorkingDay ->.. endWorkingDay ->.. currentPage |=> display previous page
*/
private func correctMonthAdujstOffSet(startWorkingDate: Date?, endWorkingDate: Date?, currentPage: Date) -> Int {
var offset = 0
if let startWorkingDate = startWorkingDate,
let endWorkingDate = endWorkingDate {
if (currentPage.compare(.isLater(than: startWorkingDate)) || currentPage.compare(.isSameDay(as: startWorkingDate))) &&
(currentPage.compare(.isEarlier(than: endWorkingDate)) || currentPage.compare(.isSameDay(as: endWorkingDate))) {
//case 1
offset = 0
} else if currentPage.compare(.isEarlier(than: startWorkingDate)) {
//case 2
offset = 1
} else if currentPage.compare(.isLater(than: endWorkingDate)) {
//case 3
offset = -1
}
}
print("startWorkingDate: \(String(describing: startWorkingDate)) , endWorkingDate: \(String(describing: endWorkingDate)) , currentPage: \(currentPage) , offset: \(offset)")
return offset
}
/**
* Correct display of calendar page
*/
private func correctCalendarDisplayCurrentPage(startWorkingDate: Date?, endWorkingDate: Date?, currentPage: Date, withAnimation: Bool = true) {
let offSet = self.correctMonthAdujstOffSet(startWorkingDate: startWorkingDate,
endWorkingDate: endWorkingDate,
currentPage: currentPage)
let newPage = currentPage.adjust(.month, offset: offSet)
self.calendar.setCurrentPage(newPage, animated: withAnimation)
self.calendar.reloadData()
self.timeSheetTableView.reloadData()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
private func createRequestButton() {
floaty.addButton(title: LocalizationHelper.shared.localized("create_others_request"), hexColor: "#35F128")
floaty.addButton(title: LocalizationHelper.shared.localized("create_request_leave"), hexColor: "#FA003F")
floaty.addButton(title: LocalizationHelper.shared.localized("create_request_ot"), hexColor: "#1564C0")
floaty.paddingX = floaty.paddingY
floaty.fabDelegate = self
floaty.buttonColor = UIColor.init(hexString: "#DB4336")
floaty.buttonImage = UIImage(named: "ic_add")
self.view.addSubview(floaty)
}
override func loadView() {
super.loadView()
createRequestButton()
}
func createFSCalendar(withToday: Date?) {
let height: CGFloat = UIDevice.current.model.hasPrefix("iPad") ? 400 : 300
let view = UIView(frame: CGRect(x: 0,
y: 0,
width: UIScreen.main.bounds.width,
height: height))
view.backgroundColor = UIColor.white
let calendar = FSCalendar(frame: view.frame, with: Calendar.calendarUS)
calendar.dataSource = self
calendar.delegate = self
view.addSubview(calendar)
self.calendar = calendar
calendar.accessibilityIdentifier = calenderIdentifier
calendar.appearance.headerMinimumDissolvedAlpha = 0
calendar.appearance.caseOptions = .headerUsesUpperCase
calendar.calendarHeaderView.backgroundColor = UIColor.lightGray.withAlphaComponent(0.1)
calendar.appearance.headerTitleColor = UIColor.appBarTintColor
calendar.appearance.weekdayTextColor = UIColor.appBarTintColor
calendar.calendarWeekdayView.backgroundColor = UIColor.lightGray.withAlphaComponent(0.1)
calendar.appearance.titleSelectionColor = UIColor.darkText
calendar.appearance.shouldRemovePlaceholderStyle(true)
calendar.register(TimeSheetViewCell.self, forCellReuseIdentifier: calenderCellIdentifier)
calendar.clipsToBounds = true // Remove top/bottom line
calendar.placeholderType = .fillHeadTail
calendar.appearance.titleTodayColor = UIColor.darkText
calendar.scrollEnabled = false
calendar.swipeToChooseGesture.isEnabled = false
calendar.allowsMultipleSelection = false
// let scopeGesture = UIPanGestureRecognizer(target: calendar, action: #selector(calendar.handleScopeGesture(_:)));
// calendar.addGestureRecognizer(scopeGesture)
//init pre and next button on header
preMonthButton = UIButton(type: .roundedRect)
preMonthButton.frame = CGRect(x: 0 + 8, y: 0 + 5, width: buttonHeaderWidth, height: 34)
preMonthButton.backgroundColor = UIColor.clear
preMonthButton.layer.cornerRadius = 8
preMonthButton.layer.borderWidth = 1
preMonthButton.layer.borderColor = UIColor.appBarTintColor.cgColor
preMonthButton.setTitle("◀︎", for: .normal)
preMonthButton.titleLabel?.adjustsFontSizeToFitWidth = true
preMonthButton.titleLabel?.font = UIFont.boldSystemFont(ofSize: 18)
preMonthButton.setTitleColor(UIColor.appBarTintColor, for: .normal)
preMonthButton.addTarget(self, action: #selector(preMonthButtonClicked), for: .touchUpInside)
view.addSubview(preMonthButton)
nextMonthButton = UIButton(type: .roundedRect)
nextMonthButton.frame = CGRect(x: self.view.frame.size.width - buttonHeaderWidth - 8, y: 0 + 5, width: buttonHeaderWidth, height: 34)
nextMonthButton.backgroundColor = UIColor.clear
nextMonthButton.layer.cornerRadius = 8
nextMonthButton.layer.borderWidth = 1
nextMonthButton.layer.borderColor = UIColor.appBarTintColor.cgColor
nextMonthButton.setTitle("▶︎", for: .normal)
nextMonthButton.titleLabel?.adjustsFontSizeToFitWidth = true
nextMonthButton.titleLabel?.font = UIFont.boldSystemFont(ofSize: 18)
nextMonthButton.setTitleColor(UIColor.appBarTintColor, for: .normal)
nextMonthButton.addTarget(self, action: #selector(nextMonthButtonClicked), for: .touchUpInside)
view.addSubview(nextMonthButton)
if let withToday = withToday {
calendar.today = withToday
}
timeSheetTableView.tableHeaderView = view
}
}
extension TimeSheetViewController: FSCalendarDataSource {
func calendar(_ calendar: FSCalendar, cellFor date: Date, at position: FSCalendarMonthPosition) -> FSCalendarCell {
return calendar.dequeueReusableCell(withIdentifier: calenderCellIdentifier, for: date, at: position)
}
func calendar(_ calendar: FSCalendar,
willDisplay cell: FSCalendarCell,
for date: Date,
at monthPosition: FSCalendarMonthPosition) {
guard let timeSheetCell = cell as? TimeSheetViewCell else {
return
}
timeSheetCell.applyStyleAppearanceForCell(dateForCell: date,
dateStartWorking: self.workingTimeSheets?.startDate,
dateEndWorking: self.workingTimeSheets?.endDate,
displayDateSetting: self.workingTimeSheets?.timeSheetDays?.first(where: {
$0.date?.compare(.isSameDay(as: date)) ?? false }))
}
}
extension TimeSheetViewController: FSCalendarDelegate {
func numberOfHeadPlaceholders(forMonth month: Date) -> Int {
var mustAddNumber = 0
let dateStartOfMonth = month.dateFor(.startOfDay)
if let dateStartWorking = workingTimeSheets?.startDate?.dateFor(.startOfDay) {
if dateStartWorking.compare(.isEarlier(than: dateStartOfMonth)) {
let daysMustAdd = gregorian.dateComponents([.day], from: dateStartWorking.dateFor(.startOfWeek), to: dateStartOfMonth).day
mustAddNumber = daysMustAdd ?? 0
}
}
if mustAddNumber == 0 {
//if cannot get mustAddNumber or the case: dateStartOfMonth -> dateStartWorking, just fill the date of week containt dateStartOfMonth
let currentWeekday = gregorian.component(.weekday, from: month)
let number = ((currentWeekday - gregorian.firstWeekday) + 7) % 7
mustAddNumber = number
}
return mustAddNumber
}
func numberOfRows(inMonth month: Date) -> Int {
return 6
}
func calendar(_ calendar: FSCalendar, didSelect date: Date, at monthPosition: FSCalendarMonthPosition) {
self.selectedTimeSheetDay = self.workingTimeSheets?.timeSheetDays?.first(where: {
$0.date?.compare(.isSameDay(as: date)) ?? false })
self.shouldShowTimeSheetDayDetail = true
self.timeSheetTableView.reloadData()
}
}
extension TimeSheetViewController {
func preMonthButtonClicked(sender: UIButton!) {
fetchWorkingCalendarData(forDate: self.calendar.currentPage.adjust(.month, offset: -1), withAnimation: true)
}
func nextMonthButtonClicked(sender: UIButton!) {
fetchWorkingCalendarData(forDate: self.calendar.currentPage.adjust(.month, offset: 1), withAnimation: true)
}
}
extension TimeSheetViewController: UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
return 2
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if section == 0 {
//data for selected date
return self.shouldShowTimeSheetDayDetail && self.selectedTimeSheetDay != nil ? 1 : 0
} else {
return self.workingTimeSheets != nil ? 1 : 0
}
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.section == 0 {
return self.selectedTimeSheetDay != nil ? (self.selectedTimeSheetDay?.hoursOverTime ?? 0 > 0 ? 124 : 90) : 0
} else {
return 300
}
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier:
indexPath.section == 0 ?
"TimeSheetDetailViewCell" : "TimeSheetSummaryViewCell", for: indexPath)
if indexPath.section == 0,
let cellDetail = cell as? TimeSheetDetailViewCell {
cellDetail.setTimeSheetDayModel(timeSheet: self.selectedTimeSheetDay)
} else if let cellInfo = cell as? TimeSheetSummaryViewCell {
cellInfo.setTimeSheetInfo(timeSheet: self.workingTimeSheets)
}
return cell
}
}
extension TimeSheetViewController: UITableViewDelegate {
}
| [
-1
] |
d846b6b6104b9b37ae8ab1e5f26b830970bc68eb | ddd7c2666d60ff65fadecb24e8a92c6cf1abddbf | /HighTime/Features/Tests for my level/Cells/PassTheTestCVCell.swift | 407b21cc22d5dc10912fc550bc2919f2655b4c2a | [] | no_license | Santineet/HighTime | 928c44cc759f513a86f4e9a340fe1532db9c3e73 | bbdfa1c4ae5573098a2f8a69e472736f84458753 | refs/heads/master | 2020-07-15T09:21:26.160424 | 2019-11-09T10:35:32 | 2019-11-09T10:35:32 | 205,531,082 | 4 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,417 | swift | //
// PassTheTestCVCell.swift
// HighTime
//
// Created by Mairambek on 21/08/2019.
// Copyright © 2019 Sunrise. All rights reserved.
//
import UIKit
import MBRadioButton
class PassTheTestCVCell: UICollectionViewCell, RadioButtonDelegate {
//Outlets
@IBOutlet weak var titleQuestion: UILabel!
@IBOutlet weak var contentQuestion: UILabel!
@IBOutlet weak var secondAnswer: RadioButton!
@IBOutlet weak var firstAnswer: RadioButton!
@IBOutlet weak var thirdAnswer: RadioButton!
@IBOutlet weak var fourthAnswer: RadioButton!
@IBOutlet weak var fifthAnswer: RadioButton!
//Variables
var viewContainerCell = RadioButtonContainer()
var link: PassTheTestCVC?
var answersButtonArray:[RadioButton] = []
override func awakeFromNib() {
super.awakeFromNib()
viewContainerCell.delegate = self
answersButtonArray = [firstAnswer,secondAnswer,thirdAnswer,
fourthAnswer,fifthAnswer]
viewContainerCell.addButtons(answersButtonArray)
firstAnswer.tag = 1
secondAnswer.tag = 2
thirdAnswer.tag = 3
fourthAnswer.tag = 4
fifthAnswer.tag = 5
firstAnswer.addTarget(self, action: #selector(didTappedAnswerButton(sender:)), for: .touchUpInside)
secondAnswer.addTarget(self, action: #selector(didTappedAnswerButton(sender:)), for: .touchUpInside)
thirdAnswer.addTarget(self, action: #selector(didTappedAnswerButton(sender:)), for: .touchUpInside)
fourthAnswer.addTarget(self, action: #selector(didTappedAnswerButton(sender:)), for: .touchUpInside)
fifthAnswer.addTarget(self, action: #selector(didTappedAnswerButton(sender:)), for: .touchUpInside)
}
@objc func didTappedAnswerButton(sender:RadioButton){
link?.didTappedAnswerButton(answerButton: sender, cell: self)
}
func radioButtonDidSelect(_ button: RadioButton) {
button.setTitleColor(UIColor(red: 0.21, green: 0.48, blue: 0.96, alpha: 1), for: .normal)
}
func radioButtonDidDeselect(_ button: RadioButton) {
button.setTitleColor( UIColor(red: 0.43, green: 0.43, blue: 0.44, alpha: 1), for: .normal)
}
class var identifier:String {
return String(describing: self)
}
class var nib:UINib {
return UINib(nibName: identifier, bundle: nil)
}
}
| [
-1
] |
14f095b528d639715cc1afacdd3890d25fff9258 | cc1021d1f24b6263a24c4184166fe86f977c956d | /TwitterTutorialRpt/ViewModel/UploadTweetViewModel.swift | 42ba1e8e14ba823e3b3e5e732a814fdc82c9dac1 | [] | no_license | sjlearmonth/TwitterTutorialRpt | 49d72b337c4472d5ad04756c44bc842b39f59da5 | 1704facf1d4b0dfee8ecd112b7f45b8a04fbd70a | refs/heads/main | 2023-05-10T05:53:37.580279 | 2021-06-07T15:08:56 | 2021-06-07T15:08:56 | 337,808,602 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 824 | swift | //
// UploadTweetViewModel.swift
// TwitterTutorialRpt
//
// Created by Stephen Learmonth on 05/05/2021.
//
import UIKit
enum UploadTweetConfiguration {
case tweet
case reply(Tweet)
}
struct UploadTweetViewModel {
let actionButtonTitle: String
let placeholderText: String
var shouldShowReplyLabel: Bool
var replyText: String?
init(config: UploadTweetConfiguration) {
switch config {
case .tweet:
actionButtonTitle = "Tweet"
placeholderText = "What's happening?"
shouldShowReplyLabel = false
case .reply(let tweet):
actionButtonTitle = "Reply"
placeholderText = "Tweet your reply."
shouldShowReplyLabel = true
replyText = "Replying to @\(tweet.user.username)"
}
}
}
| [
-1
] |
037fd6ca802879684df43e3bcb358f91546c0c55 | d4f23a8a146d027238ea7a9a5c519afbc734f658 | /AgingPeople/AppDelegate.swift | 0723cd0dde8becb9be72bea721ea3fa1b39483bc | [] | no_license | kaankabalak/AgingPeople | 5960e53ef465db47e29cd2b27bb0741093a73cc4 | ba6e6e14ee000c9084c9b3272eec35b53c603c7d | refs/heads/master | 2020-06-24T13:19:31.135605 | 2017-07-11T21:19:43 | 2017-07-11T21:19:43 | 96,938,181 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,176 | swift | //
// AppDelegate.swift
// AgingPeople
//
// Created by Kaan Kabalak on 7/7/17.
// Copyright © 2017 Kaan Kabalak. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
| [
229380,
229383,
229385,
278539,
294924,
229388,
278542,
229391,
327695,
278545,
229394,
278548,
229397,
229399,
229402,
352284,
229405,
278556,
278559,
229408,
294950,
229415,
229417,
327722,
237613,
229422,
360496,
229426,
237618,
229428,
286774,
286776,
319544,
286778,
229432,
204856,
352318,
286791,
237640,
286797,
278605,
311375,
163920,
237646,
196692,
319573,
311383,
278623,
278626,
319590,
311400,
278635,
303212,
278639,
131192,
278648,
237693,
303230,
327814,
303241,
131209,
417930,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
131264,
286916,
295110,
286922,
286924,
286926,
319694,
286928,
131281,
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,
262448,
311601,
287032,
155966,
319809,
319810,
278849,
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,
172534,
180727,
164343,
279035,
311804,
287230,
279040,
303617,
287234,
279045,
172550,
303623,
172552,
320007,
287238,
279051,
172558,
279055,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
279082,
311850,
279084,
172591,
172598,
279095,
172607,
172609,
172612,
377413,
172614,
172618,
303690,
33357,
287309,
303696,
279124,
172634,
262752,
254563,
172644,
311911,
189034,
295533,
189039,
172656,
352880,
295538,
189040,
172660,
287349,
189044,
172655,
287355,
287360,
295553,
172675,
295557,
287365,
311942,
303751,
352905,
311946,
287371,
279178,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
172702,
303773,
164509,
172705,
287394,
172707,
303780,
287390,
287398,
205479,
287400,
279208,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
328384,
172737,
279231,
287427,
312005,
312006,
107208,
172748,
287436,
107212,
172751,
287440,
295633,
172755,
303827,
279255,
172760,
287450,
303835,
279258,
189149,
303838,
213724,
312035,
279267,
295654,
279272,
230128,
312048,
312050,
230131,
189169,
205564,
303871,
230146,
328453,
295685,
230154,
33548,
312077,
295695,
295701,
230169,
369433,
295707,
328476,
295710,
230175,
295720,
303914,
279340,
205613,
279353,
230202,
312124,
328508,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
279390,
230241,
279394,
303976,
336744,
303985,
328563,
303987,
279413,
303991,
303997,
295806,
295808,
295813,
304005,
320391,
304007,
213895,
304009,
304011,
230284,
304013,
295822,
213902,
279438,
189329,
295825,
304019,
189331,
58262,
304023,
304027,
279452,
410526,
279461,
279462,
304042,
213931,
230327,
304055,
287675,
230334,
304063,
238528,
304065,
213954,
189378,
156612,
295873,
213963,
197580,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
312321,
295945,
230413,
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,
279661,
312432,
279669,
337018,
189562,
279679,
66690,
279683,
222340,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
337067,
165035,
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,
230763,
410987,
230768,
296305,
312692,
230773,
304505,
304506,
279929,
181626,
181631,
312711,
296331,
288140,
288144,
230800,
304533,
337306,
288154,
288160,
173472,
288162,
288164,
279975,
304555,
370092,
279983,
173488,
288176,
279985,
312755,
296373,
312759,
279991,
288185,
337335,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
148946,
370130,
222676,
288210,
288212,
288214,
239064,
288217,
288218,
280027,
288220,
329177,
239070,
288224,
370146,
280034,
288226,
280036,
288229,
280038,
288230,
288232,
288234,
320998,
288236,
288238,
288240,
288242,
296435,
288244,
288250,
296446,
321022,
402942,
148990,
296450,
206336,
230916,
230919,
214535,
230923,
304651,
304653,
370187,
230940,
222752,
108066,
296486,
296488,
157229,
239152,
230961,
157236,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
288344,
280152,
239194,
280158,
403039,
370272,
181854,
239202,
312938,
280183,
280185,
280188,
280191,
116354,
280194,
280208,
280211,
288408,
280218,
280222,
419489,
190118,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
419522,
280260,
419525,
206536,
280264,
206539,
206541,
206543,
263888,
313044,
280276,
321239,
280283,
313052,
288478,
313055,
419555,
321252,
313066,
288494,
280302,
280304,
313073,
321266,
288499,
419570,
288502,
280314,
288510,
124671,
67330,
280324,
198405,
288519,
280331,
198416,
280337,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
296767,
288576,
345921,
337732,
280388,
304968,
280393,
280402,
173907,
313171,
313176,
42842,
280419,
321381,
296809,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280464,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
280487,
313258,
321458,
296883,
124853,
214966,
296890,
10170,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
354265,
354270,
239586,
313320,
354281,
231404,
124913,
165876,
321528,
239612,
313340,
288764,
239617,
313347,
288773,
313358,
305176,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
378941,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
149599,
280671,
149601,
321634,
149603,
223327,
329830,
280681,
313451,
223341,
280687,
149618,
215154,
313458,
280691,
313464,
329850,
321659,
280702,
288895,
321670,
215175,
141446,
141455,
275606,
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,
280819,
157940,
182517,
280823,
280825,
280827,
280830,
280831,
280833,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
305464,
280888,
280891,
289087,
108865,
280897,
280900,
305480,
239944,
280906,
239947,
305485,
305489,
379218,
280919,
248153,
354653,
354656,
313700,
280937,
313705,
190832,
280946,
223606,
313720,
280956,
280959,
313731,
199051,
240011,
289166,
240017,
297363,
190868,
240021,
297365,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
289210,
305594,
281024,
289218,
289221,
289227,
281045,
281047,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
240132,
330244,
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,
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,
281401,
289593,
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,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
281567,
289762,
322534,
297961,
183277,
322550,
134142,
322563,
330764,
175134,
322599,
322610,
314421,
281654,
314427,
314433,
207937,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
289912,
248995,
306341,
306344,
306347,
322734,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
126190,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
257334,
216376,
380226,
298306,
224584,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
290171,
314747,
306555,
290174,
298365,
224641,
281987,
298372,
314756,
281990,
224647,
265604,
298377,
314763,
142733,
298381,
314768,
224657,
306581,
314773,
314779,
314785,
314793,
282025,
282027,
241068,
241070,
241072,
282034,
241077,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
290291,
282101,
241142,
191992,
290298,
151036,
290302,
282111,
290305,
175621,
306694,
192008,
323084,
257550,
282127,
290321,
282130,
323090,
290325,
282133,
241175,
290328,
282137,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
282186,
224849,
282195,
282199,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
282261,
175770,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
306856,
282295,
323260,
282300,
323266,
282310,
323273,
282319,
306897,
241362,
306904,
282328,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
241450,
282410,
306988,
306991,
315184,
323376,
315190,
241464,
159545,
282425,
298811,
118593,
307009,
413506,
307012,
241475,
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,
282514,
298898,
241556,
298901,
44948,
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,
299003,
241661,
299006,
282623,
315396,
241669,
315397,
282632,
307211,
282639,
290835,
282645,
241693,
282654,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
307278,
192596,
176213,
307287,
307290,
217179,
315482,
192605,
315483,
233567,
299105,
200801,
217188,
299109,
307303,
315495,
356457,
45163,
307307,
315502,
192624,
307314,
323700,
299126,
233591,
299136,
307329,
307338,
233613,
241813,
307352,
299164,
241821,
299167,
315552,
184479,
184481,
315557,
184486,
307370,
307372,
184492,
307374,
307376,
299185,
323763,
184503,
299191,
176311,
307385,
258235,
307388,
176316,
307390,
307386,
299200,
184512,
307394,
299204,
307396,
184518,
307399,
323784,
233679,
307409,
307411,
176343,
299225,
233701,
307432,
184572,
282881,
184579,
184586,
282893,
291089,
282906,
291104,
233766,
299304,
295583,
176435,
307508,
315701,
332086,
307510,
307512,
168245,
307515,
307518,
282942,
282947,
323917,
282957,
110926,
233808,
323921,
315733,
323926,
233815,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299388,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
315801,
291226,
242075,
283033,
61855,
291231,
283042,
291238,
291241,
127403,
127405,
291247,
299440,
127407,
299444,
127413,
291254,
283062,
127417,
291260,
127421,
127424,
299457,
127429,
127431,
127434,
315856,
127440,
176592,
315860,
176597,
127447,
283095,
299481,
127449,
176605,
242143,
127455,
127457,
291299,
127460,
340454,
127463,
242152,
291305,
127466,
176620,
127469,
127474,
291314,
291317,
127480,
135672,
291323,
233979,
127485,
291330,
127490,
127494,
283142,
127497,
233994,
135689,
127500,
291341,
233998,
127506,
234003,
127509,
234006,
127511,
152087,
283161,
234010,
135707,
242202,
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,
299706,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
119509,
226005,
226008,
299740,
242396,
201444,
299750,
283368,
234219,
283372,
226037,
283382,
316151,
234231,
234236,
226045,
242431,
234239,
209665,
234242,
299778,
242436,
234246,
226056,
291593,
234248,
242443,
234252,
242445,
234254,
291601,
234258,
242450,
242452,
234261,
348950,
201496,
234264,
234266,
234269,
283421,
234272,
234274,
152355,
299814,
234278,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
160572,
283452,
234302,
234307,
242499,
234309,
292433,
316233,
234313,
316235,
234316,
283468,
234319,
242511,
234321,
234324,
185173,
201557,
234329,
234333,
308063,
234336,
242530,
349027,
234338,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
226171,
291711,
234368,
291714,
234370,
291716,
234373,
226182,
234375,
226185,
308105,
234379,
234384,
234388,
234390,
226200,
234393,
209818,
308123,
234396,
324504,
291742,
324508,
234398,
234401,
291747,
291748,
234405,
291750,
324518,
324520,
234407,
324522,
291754,
291756,
234410,
226220,
324527,
291760,
234414,
201650,
324531,
234417,
234422,
226230,
324536,
275384,
234428,
291773,
242623,
324544,
226239,
234434,
324546,
324548,
234431,
226245,
234437,
234439,
234443,
291788,
193486,
234446,
193488,
275406,
234449,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234475,
234478,
316400,
234481,
316403,
234484,
234485,
234487,
324599,
234490,
234493,
316416,
234496,
234501,
275462,
308231,
234504,
234507,
234510,
234515,
300054,
316439,
234520,
234519,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
234543,
234546,
275508,
300085,
234549,
300088,
234553,
234556,
234558,
316479,
234561,
316483,
160835,
234563,
308291,
234568,
234570,
316491,
234572,
300108,
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,
234634,
234636,
177293,
234640,
275602,
234643,
308373,
226453,
234647,
234648,
275608,
234650,
308379,
324757,
300189,
324766,
119967,
324768,
234653,
283805,
234657,
242852,
300197,
234661,
283813,
234664,
177318,
275626,
234667,
316596,
308414,
234687,
300223,
300226,
308418,
234692,
300229,
308420,
308422,
283844,
300234,
283850,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
300267,
161003,
300270,
300272,
120053,
300278,
275703,
316663,
300284,
275710,
300287,
292097,
300289,
161027,
300292,
300294,
275719,
234760,
177419,
300299,
242957,
300301,
275725,
177424,
283917,
349451,
349464,
415009,
283939,
259367,
292143,
283951,
300344,
226617,
243003,
283963,
226628,
300357,
283973,
177482,
283983,
316758,
357722,
316766,
292192,
316768,
218464,
292197,
316774,
243046,
218473,
284010,
136562,
324978,
333178,
275834,
275836,
275840,
316803,
316806,
226696,
316811,
226699,
316814,
226703,
300433,
234899,
300436,
226709,
357783,
316824,
316826,
300448,
144807,
144810,
144812,
284076,
144814,
144820,
374196,
284084,
292279,
284087,
144826,
144828,
144830,
144832,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
226787,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
292338,
226802,
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,
243268,
284231,
226886,
128584,
284234,
276043,
317004,
366155,
284238,
226895,
284241,
194130,
284243,
300628,
284245,
276052,
284247,
276053,
235097,
243290,
284249,
284251,
317015,
284253,
300638,
284255,
243293,
284258,
292452,
292454,
284263,
177766,
284265,
292458,
284267,
292461,
284272,
284274,
284278,
292470,
276086,
292473,
284283,
276093,
284286,
292479,
284288,
292481,
284290,
325250,
284292,
292485,
325251,
276095,
276098,
284297,
317066,
284299,
317068,
284301,
276109,
284303,
284306,
276114,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
284329,
317098,
284331,
276137,
284333,
284335,
276144,
284337,
284339,
300726,
284343,
284346,
284350,
358080,
276160,
284354,
358083,
284358,
276166,
358089,
284362,
276170,
284365,
276175,
284368,
276177,
284370,
358098,
284372,
317138,
284377,
284379,
284381,
284384,
358114,
284386,
358116,
276197,
317158,
358119,
284392,
325353,
358122,
284394,
284397,
358126,
284399,
358128,
276206,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
300819,
317207,
284440,
300828,
300830,
276255,
300832,
325408,
300834,
317221,
227109,
358183,
186151,
276268,
300845,
243504,
300850,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
300872,
292681,
153417,
358224,
284499,
276308,
284502,
317271,
178006,
276315,
292700,
317279,
284511,
227175,
292715,
300912,
292721,
284529,
300915,
284533,
292729,
317306,
284540,
292734,
325512,
169868,
276365,
317332,
358292,
284564,
284566,
399252,
350106,
284572,
276386,
284579,
276388,
358312,
317353,
292776,
284585,
276395,
292784,
276402,
358326,
161718,
358330,
276411,
276418,
276425,
301009,
301011,
301013,
292823,
358360,
301017,
301015,
292828,
276446,
153568,
276448,
276452,
292839,
276455,
292843,
276460,
292845,
178161,
227314,
276466,
325624,
276472,
317435,
276476,
276479,
276482,
276485,
317446,
276490,
350218,
292876,
350222,
317456,
276496,
317458,
178195,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
276528,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
276544,
284739,
325700,
243779,
292934,
243785,
276553,
350293,
350295,
309337,
227418,
350299,
194649,
194654,
227423,
350304,
178273,
309346,
350302,
194660,
350308,
309350,
309348,
292968,
309352,
227426,
227430,
276583,
350313,
350316,
301167,
276590,
350321,
284786,
276595,
227440,
350325,
252022,
350328,
292985,
301178,
350332,
292989,
301185,
292993,
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,
309455,
276689,
309462,
301272,
276699,
194780,
309468,
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,
317858,
342434,
285093,
317864,
285098,
276907,
235955,
276917,
293304,
293307,
293314,
309707,
293325,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
293346,
227810,
276964,
293352,
236013,
293364,
301562,
317951,
309764,
301575,
121352,
293387,
236043,
342541,
317963,
113167,
55822,
309779,
317971,
309781,
277011,
55837,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
285236,
23094,
277054,
244288,
129603,
301636,
318020,
301639,
301643,
285265,
399955,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
309871,
121458,
277106,
170618,
170619,
309885,
309888,
277122,
227975,
277128,
285320,
301706,
318092,
326285,
334476,
318094,
277136,
277139,
227992,
334488,
318108,
285340,
318110,
227998,
137889,
383658,
285357,
318128,
277170,
293555,
342707,
154292,
277173,
318132,
285368,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
342745,
137946,
342747,
342749,
113378,
203491,
228069,
277223,
342760,
285417,
56041,
56043,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
228113,
285459,
277273,
293659,
326430,
228128,
285474,
293666,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
285494,
301880,
285499,
301884,
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,
293882,
302075,
244731,
285690,
293887,
277504,
277507,
277511,
293899,
277519,
293908,
302105,
293917,
293939,
318516,
277561,
277564,
310336,
7232,
293956,
277573,
228422,
293960,
310344,
277577,
277583,
203857,
293971,
310355,
310359,
236632,
277594,
138332,
277598,
203872,
277601,
285792,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
367737,
285817,
302205,
285821,
392326,
285831,
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,
228592,
294132,
138485,
228601,
204026,
228606,
204031,
64768,
310531,
138505,
228617,
318742,
204067,
277798,
130345,
277801,
113964,
285997,
277804,
285999,
277807,
113969,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
417086,
277822,
286016,
302403,
294211,
384328,
277832,
277836,
294221,
294223,
326991,
277839,
277842,
277847,
277850,
179547,
277853,
146784,
277857,
302436,
277860,
294246,
327015,
310632,
327017,
351594,
277864,
277869,
277872,
351607,
310648,
277880,
310651,
277884,
277888,
310657,
351619,
294276,
310659,
327046,
277892,
253320,
310665,
318858,
277894,
277898,
277903,
310672,
351633,
277905,
277908,
277917,
310689,
277921,
130468,
228776,
277928,
277932,
310703,
277937,
310710,
130486,
310712,
277944,
310715,
277947,
302526,
228799,
277950,
277953,
302534,
310727,
245191,
64966,
277959,
277963,
302541,
277966,
302543,
310737,
277971,
228825,
163290,
277978,
310749,
277981,
277984,
310755,
277989,
277991,
187880,
277995,
310764,
286188,
278000,
228851,
310772,
278003,
278006,
40440,
212472,
278009,
40443,
286203,
40448,
228864,
286214,
228871,
302603,
302614,
302617,
286233,
302621,
286240,
146977,
187939,
40484,
294435,
40486,
286246,
294440,
40488,
294439,
294443,
40491,
294445,
196133,
310831,
245288,
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,
179870,
327333,
229030,
212648,
278188,
302764,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
294601,
302793,
343757,
212690,
319187,
286420,
278227,
229076,
286425,
319194,
278235,
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,
280021,
237409,
229233,
294776,
360317,
294785,
327554,
360322,
40840,
294803,
40851,
188312,
294811,
237470,
319390,
40865,
319394,
294817,
294821,
311209,
180142,
343983,
294831,
188340,
40886,
319419,
294844,
294847,
309354,
393177,
294876,
294879,
294883,
393190,
294890,
311279,
278513,
237555,
311283,
278516,
278519,
237562
] |
92244b55904dee57753f13cf2536bc7fce467fc8 | 536a58d4c5ca8b4277aecdce101537c4c13cb933 | /fridgeApp/FridgeViewController.swift | f5d52589192de66fbc19456a74791d6551508bdb | [] | no_license | kamrynmc/fridgeAppTest | fd342aef5a81b46e260e4f3aef0bd17e9b8dbac6 | 6a5ffae7da264748a9f8a1ac68ca2d864942086f | refs/heads/main | 2023-01-12T19:53:09.685872 | 2020-11-16T16:29:18 | 2020-11-16T16:29:18 | 313,154,098 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,515 | swift | //
// FridgeViewController.swift
// fridgeApp
//
// Created by Kamryn on 11/9/20.
//
import UIKit
class FridgeViewController: UIViewController, UITableViewDataSource {
@IBOutlet weak var fridgeTable: UITableView!
var items: [Item]!
override func viewDidLoad() {
super.viewDidLoad()
let retrieveData = UserDefaults.standard.data(forKey: "items")
items = try! JSONDecoder().decode([Item].self, from: retrieveData!)
// Do any additional setup after loading the view.
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return items.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
//get instance of template cell
let fridgeTableCell = fridgeTable.dequeueReusableCell(withIdentifier: "FridgeCell")! as! FridgeCell
//get row
let row = indexPath.row
//modify properties of cell
fridgeTableCell.itemLabel.text = items[row].name
fridgeTableCell.quantityLabel.text = items[row].quantity
//fridgeTableCell.expireLabel.text = "temp"
let dateNum = items[row].date
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "YY/MM/dd"
let strDate = dateFormatter.string(from: dateNum)
fridgeTableCell.expireLabel.text = strDate
return fridgeTableCell;
}
func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
if editingStyle == UITableViewCell.EditingStyle.delete {
let row = indexPath.row
items.remove(at: row)
tableView.deleteRows(at: [indexPath], with: UITableView.RowAnimation.fade)
let data = try! JSONEncoder().encode(items)
UserDefaults.standard.setValue(data, forKey: "items")
}
}
/*
// 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.
}
*/
}
class FridgeCell:UITableViewCell {
@IBOutlet weak var itemLabel: UILabel!
@IBOutlet weak var quantityLabel: UILabel!
@IBOutlet weak var expireLabel: UILabel!
}
| [
-1
] |
bb0097907382439d39e5000955804aa5dd2aa960 | c7d5c2f2dd26126e63cb8b414016198cb36783c5 | /BubblePop-UTS-AU2021/Models/CircularButton.swift | 7c9e1573ccb18093f37f3d562f5dd61ddafeec63 | [] | no_license | trungducng0410/bubblepop-uts | f69aeb1ffdaa4b6a66b351e66f89786b21b779ba | 1a29106939f8ed400cb9eb2050fa8333dd956b09 | refs/heads/main | 2023-04-17T07:47:16.559486 | 2021-04-28T03:42:37 | 2021-04-28T03:42:37 | 362,147,608 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 872 | swift | //
// CircularButton.swift
// BubblePop-UTS-AU2021
//
// Created by Trung Duc on 23/04/2021.
//
import UIKit
class CircularButton: UIButton {
var shoudHandleTouches = true
final override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
if shoudHandleTouches, let touch = touches.first, isPointInside(touch.location(in: self.superview)) {
successfulTouch()
super.touchesBegan(touches, with: event)
}
}
func isPointInside(_ point: CGPoint) -> Bool {
let currFrame = layer.presentation()?.frame ?? frame
let radius = CGFloat(currFrame.width / 2.0)
let center = CGPoint(x: currFrame.minX + radius, y: currFrame.minY + radius)
return Distance.Distance(point, center) <= Double(radius)
}
func successfulTouch() {
}
}
| [
-1
] |
4f4f30e6847201097c22e8d610549d01623b3c2e | 764dcc6cf6de260fa97c18d804435a5e47cf1da2 | /GeneratorApp/GameScene.swift | 0ec576428feca8ab9836c4e46a2ab19f2731c364 | [] | no_license | griffingdm/GeneratorApp | 0ae078194eb22b6998c21cf8939567fefd3fd6ea | de87b004568d542b142f5340cb49c807aa1454fa | refs/heads/master | 2021-01-17T15:06:09.134861 | 2017-02-12T00:46:05 | 2017-02-12T00:46:05 | 71,800,290 | 0 | 0 | null | 2017-02-12T00:46:06 | 2016-10-24T14:58:44 | JavaScript | UTF-8 | Swift | false | false | 8,347 | swift | //
// GameScene.swift
// GameTest
//
// Created by Mullins, Griffin on 11/11/16.
// Copyright © 2016 Mullins, Griffin. All rights reserved.
//
import SpriteKit
import GameplayKit
struct PhysicsCategory {
static let None : UInt32 = 0
static let All : UInt32 = UInt32.max
static let Surge : UInt32 = 0b1 // 1
static let Counter: UInt32 = 0b10 // 2
}
class GameScene: SKScene, SKPhysicsContactDelegate {
var gameController: GameViewController!
var surgesCountered: Int = 0
var birthTimer:TimeInterval = TimeInterval(0)
//GAME SETTINGS
let counterSpeed: Double = 1.0 //speed of user's projectile
var birthInterval:TimeInterval = TimeInterval(0.8)
let topBirthSpeed: Double = 0.3 //top speed (in seconds) of surge spawning
let eachBirthSpeedIncrease: Double = 0.015 //delay decrease b/n spawns after surge counter
var surgeTravelDuration = 3.0
let topSurgeSpeed = 0.6 //top speed (in seconds) for surge travel top -> bottom
let surgeSpeedIncrease: Double = 0.02 //speed increase amount after surge counter
var delta:TimeInterval = TimeInterval(0)
var last_update_time:TimeInterval = TimeInterval(0)
let fadeTime: Double = 0.5
override func didMove(to view: SKView) {
//adding background music!
//let backgroundMusic = SKAudioNode(fileNamed: "background-music-aac.caf")
//backgroundMusic.autoplayLooped = true
//addChild(backgroundMusic)
physicsWorld.gravity = CGVector.zero
physicsWorld.contactDelegate = self
gameStart()
}
func gameStart(){
removeAllChildren()
surgesCountered = 0
birthInterval = 0.8 //starting delay between spawns
surgeTravelDuration = 3.0 //how long it takes for surges to travel top -> bottom
self.scene?.view?.isPaused = false
}
func random() -> CGFloat {
return CGFloat(Float(arc4random()) / 0xFFFFFFFF)
}
func random(min: CGFloat, max: CGFloat) -> CGFloat {
return random() * (max - min) + min
}
func addMonster() {
// Create sprite
let surge = SKSpriteNode(imageNamed: "game-surge")
surge.physicsBody = SKPhysicsBody(rectangleOf: surge.size)
surge.physicsBody?.isDynamic = true
surge.physicsBody?.categoryBitMask = PhysicsCategory.Surge
surge.physicsBody?.contactTestBitMask = PhysicsCategory.Counter
surge.physicsBody?.collisionBitMask = PhysicsCategory.None
let rDistributer = GKRandomDistribution(forDieWithSideCount: 5)
let rNumber = rDistributer.nextInt() - 1
let rSurger = gameController.surgers[rNumber]
let rSurgerFrame = rSurger.frame
//let surgeRect = gameController.view.convert(rSurgerFrame, to: rSurger.superview)
let surgeRect = gameController.spriteView.convert(rSurgerFrame, from: rSurger.superview)
let actualX = (surgeRect.midX)
//print("surger: \(rNumber), x: \(actualX)")
surge.position = CGPoint(x: actualX, y: size.height + surge.size.height/2)
// Add the surge to the scene
addChild(surge)
// Determine speed
//let actualDuration = random(min: CGFloat(2.0), max: CGFloat(3.0))
var dots: [FullRoundView]! = []
for dot in self.gameController.theDots {
if dot.tag == rNumber {
dots.append(dot)
}
}
run(SKAction.run {
self.gameController.surge(surger: rSurger)
})
// Create the actions
let actionMove = SKAction.move(to: CGPoint(x: actualX, y: 0 - surge.size.height/2), duration: TimeInterval(surgeTravelDuration))
let actionMoveDone = SKAction.removeFromParent()
let loseAction = SKAction.run(){
self.gameController.win = false
self.scene?.view?.isPaused = true
self.gameController.flashShooter(theDotTag: rNumber)
self.gameController.killIndicators(score: self.surgesCountered)
delay(2.0, closure: {
self.gameController.performSegue(withIdentifier: "gameEndSegue", sender: nil)
self.gameController.returnShooter(theDotTag: rNumber)
})
//self.view?.presentScene(nil)
}
surge.run(SKAction.sequence([actionMove, loseAction, actionMoveDone]))
}
override func update(_ currentTime: TimeInterval) {
// Called before each frame is rendered
if self.last_update_time == 0.0 {
self.delta = 0
} else {
self.delta = currentTime - self.last_update_time
}
self.birthTimer += self.delta
if self.birthTimer >= birthInterval {
run(SKAction.sequence([
SKAction.run(addMonster)
])
)
self.birthTimer = 0
}
self.last_update_time = currentTime
//self.yourSprite.update(self.delta)
}
func shoot(tag: Int){
//run(SKAction.playSoundFileNamed("pew-pew-lei.caf", waitForCompletion: false))
let counter = SKSpriteNode(imageNamed: "game-current-counter")
counter.physicsBody = SKPhysicsBody(rectangleOf: counter.size)
counter.physicsBody?.isDynamic = true
counter.physicsBody?.categoryBitMask = PhysicsCategory.Counter
counter.physicsBody?.contactTestBitMask = PhysicsCategory.Surge
counter.physicsBody?.collisionBitMask = PhysicsCategory.None
counter.physicsBody?.usesPreciseCollisionDetection = true
let rSurger = gameController.surgers[tag]
let rSurgerFrame = rSurger.frame
//let surgeRect = gameController.view.convert(rSurgerFrame, to: rSurger.superview)
let surgeRect = gameController.spriteView.convert(rSurgerFrame, from: rSurger.superview)
let actualX = (surgeRect.midX)
counter.position = CGPoint(x: actualX, y: 0 - counter.size.height/2)
addChild(counter)
let actualDuration = counterSpeed
let actionMove = SKAction.move(to: CGPoint(x: actualX, y: size.height + counter.size.height/2), duration: actualDuration)
let actionMoveDone = SKAction.removeFromParent()
let loseAction = SKAction.run(){
self.gameController.win = false
self.scene?.view?.isPaused = true
self.gameController.flashSurger(surger: rSurger)
self.gameController.killIndicators(score: self.surgesCountered)
delay(2.0, closure: {
self.gameController.performSegue(withIdentifier: "gameEndSegue", sender: nil)
self.gameController.returnSurger(rSurger: rSurger)
})
}
counter.run(SKAction.sequence([actionMove, loseAction, actionMoveDone]))
}
func didCounterSurge(surge: SKSpriteNode, counter: SKSpriteNode){
print("countered!")
surge.removeFromParent()
counter.removeFromParent()
surgesCountered += 1
if surgeTravelDuration > topSurgeSpeed {
surgeTravelDuration -= surgeSpeedIncrease
}
if birthInterval > topBirthSpeed {
self.birthInterval -= eachBirthSpeedIncrease
}
gameController.surgesLabel.text = "SURGES: \(surgesCountered)"
gameController.indicateScore(score: surgesCountered)
}
func didBegin(_ contact: SKPhysicsContact) {
var firstBody: SKPhysicsBody
var secondBody: SKPhysicsBody
if contact.bodyA.categoryBitMask < contact.bodyB.categoryBitMask {
firstBody = contact.bodyA
secondBody = contact.bodyB
} else {
firstBody = contact.bodyB
secondBody = contact.bodyA
}
if ((firstBody.categoryBitMask & PhysicsCategory.Surge != 0) &&
(secondBody.categoryBitMask & PhysicsCategory.Counter != 0)) {
didCounterSurge(surge: firstBody.node as! SKSpriteNode, counter: secondBody.node as! SKSpriteNode)
}
}
}
| [
-1
] |
b154a6320afc64cfca681c2ef89f92159bd10e71 | 8091b1f586f32d0917d3994ed50d0a4d451f91ec | /iOS 101/iOS 101/AppDelegate.swift | 0d1254e83d6e33f31cc4ca20016550c4995bd080 | [] | no_license | SilkSong/Boxue | dab484beabedfbe88ef02273c0022b80c907cca9 | 3518f16d356c61cca430f1912524d10e6a11f9a0 | refs/heads/master | 2022-02-28T09:12:01.733465 | 2022-02-14T23:12:53 | 2022-02-14T23:12:53 | 177,789,949 | 1 | 3 | null | 2022-02-14T23:12:54 | 2019-03-26T13:04:04 | Swift | UTF-8 | Swift | false | false | 1,694 | swift | //
// AppDelegate.swift
// iOS 101
//
// Created by Song Zixin on 2019/4/21.
// Copyright © 2019 SilkSong. All rights reserved.
//
import UIKit
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
var redView: MyView?
var yellowView: MyView?
var greenView: MyView?
private func makeMyView(frame: CGRect, bgColor: UIColor) -> MyView {
let view = MyView(frame: frame)
view.backgroundColor = bgColor
return view
}
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions:
[UIApplication.LaunchOptionsKey: Any]?) -> Bool {
self.window = UIWindow()
self.window!.backgroundColor = UIColor.brown
self.window!.rootViewController = UIViewController()
self.redView = makeMyView(frame: CGRect(x: 60, y: 60, width: 160, height: 280), bgColor: .red)
self.yellowView = makeMyView(frame: CGRect(x: 140, y: 135, width: 160, height: 280), bgColor: .yellow)
self.greenView = makeMyView(frame: self.redView!.bounds.insetBy(dx: 10, dy: 10), bgColor: .green)
self.redView?.addSubview(self.greenView!)
let rootView = self.window!.rootViewController?.view
rootView?.addSubview(self.redView!)
//rootView?.addSubview(self.yellowView!)
self.redView?.clipsToBounds = true
let greenViewCenter = rootView?.convert(
self.redView!.center,
to: self.redView)
print(greenViewCenter)
self.window!.makeKeyAndVisible()
return true
}
}
| [
-1
] |
4d6d373d18db2d68834d64b705968cb681780928 | b52a166afe9c3c0d2f8897b4787a0e6741ec73a8 | /Demo/ClassesDemo/ClassesDemo/Enemy.swift | b9bb6080099d5a25c3120c44164ad729f563b3bb | [] | no_license | 100seungho/iOS-Swift-Bootcamp | 66f9f3ad76f84bf0f63880589d9e698229d4837c | 5b8f3695c00258eff626fc0c0462ee1dbc20d08e | refs/heads/master | 2020-09-02T05:58:38.993928 | 2019-11-18T06:51:34 | 2019-11-18T06:51:34 | 219,148,983 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 214 | swift |
class Enemy {
var health = 100
var attackStrength = 10
func move() {
print("Walk forwards.")
}
func attack() {
print("Land a hit, does \(attackStrength) damange.")
}
}
| [
-1
] |
155c5618fdf38a31d52f0df9a3aa3b078a0a23aa | fa71ec9918ebc0430a092c4d0f5feedc334eef16 | /NavigateViewControllers/AppDelegate.swift | a6cdf6d0ef477ff808ba6be09fbb25eb5b2689c2 | [] | no_license | pratikzora/NavigateViewControllers | a0416bdd89a048dbe08d8d9bf8902fe31d2dd43b | 062cc16eb3f8bdd5ae1682d7c4bc23e2fbba1437 | refs/heads/main | 2022-12-28T02:47:55.637614 | 2020-10-16T03:15:14 | 2020-10-16T03:15:14 | 304,506,062 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,364 | swift | //
// AppDelegate.swift
// NavigateViewControllers
//
// Created by Pratik Zora on 2020-10-15.
//
import UIKit
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
// MARK: UISceneSession Lifecycle
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
}
| [
393222,
393224,
393230,
393250,
344102,
393261,
393266,
213048,
385081,
376889,
393275,
376905,
327756,
254030,
286800,
368727,
180313,
368735,
180320,
376931,
286831,
368752,
286844,
417924,
262283,
286879,
286888,
377012,
164028,
327871,
377036,
180431,
377046,
418007,
418010,
377060,
327914,
205036,
393456,
393460,
418043,
336123,
385280,
336128,
262404,
180490,
164106,
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,
197159,
377383,
352821,
418363,
188987,
369223,
385609,
385616,
352864,
369253,
262760,
352874,
352887,
254587,
377472,
148105,
377484,
352918,
98968,
344744,
361129,
336555,
385713,
434867,
164534,
336567,
328378,
164538,
328386,
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,
328519,
361288,
336711,
328522,
336714,
426841,
254812,
361309,
197468,
361315,
361322,
328573,
377729,
369542,
361360,
222128,
345035,
386003,
345043,
386011,
386018,
386022,
435187,
328702,
328714,
361489,
386069,
336921,
386073,
336925,
345118,
377887,
345133,
345138,
386101,
361536,
197707,
189520,
345169,
156761,
361567,
148578,
345199,
386167,
361593,
410745,
361598,
214149,
345222,
386186,
337047,
345246,
214175,
337071,
337075,
386258,
328924,
66782,
222437,
328941,
386285,
386291,
345376,
353570,
345379,
410917,
345382,
337205,
345399,
378169,
369978,
337222,
337229,
337234,
263508,
402791,
345448,
271730,
378227,
271745,
181638,
353673,
181643,
361868,
181649,
181654,
230809,
181670,
181673,
181678,
181681,
337329,
181684,
181690,
361917,
181696,
337349,
181703,
337365,
271839,
329191,
361960,
329194,
116210,
337398,
337415,
329226,
419339,
419343,
419349,
345625,
419355,
370205,
419359,
394786,
419362,
370213,
419368,
419376,
206395,
214593,
419400,
419402,
353867,
419406,
419410,
345701,
394853,
222830,
370297,
403075,
198280,
345736,
403091,
345749,
419483,
345757,
345762,
419491,
345765,
419497,
419501,
370350,
419506,
419509,
419512,
337592,
419517,
337599,
419527,
419530,
419535,
272081,
419542,
394966,
419544,
181977,
345818,
419547,
419550,
419559,
337642,
419563,
337645,
370415,
337659,
141051,
337668,
362247,
395021,
362255,
116509,
345887,
378663,
345905,
354106,
354111,
247617,
354117,
370503,
329544,
370509,
354130,
247637,
337750,
370519,
313180,
354142,
354150,
354156,
345967,
345970,
345974,
403320,
354172,
247691,
337808,
247700,
329623,
436126,
436132,
337833,
362413,
337844,
346057,
247759,
346063,
329697,
354277,
190439,
247789,
354313,
346139,
436289,
378954,
395339,
338004,
100453,
329832,
329855,
329867,
329885,
411805,
346272,
362660,
100524,
387249,
379066,
387260,
256191,
395466,
346316,
411861,
411864,
411868,
411873,
379107,
411876,
387301,
346343,
338152,
387306,
387312,
346355,
436473,
321786,
379134,
411903,
411916,
379152,
395538,
387349,
338199,
387352,
182558,
338211,
395566,
248111,
362822,
436555,
190796,
379233,
354673,
321910,
248186,
420236,
379278,
354727,
338352,
330189,
338381,
338386,
338403,
338409,
248308,
199164,
330252,
199186,
330267,
354855,
10828,
199249,
346721,
174695,
248425,
191084,
191092,
346742,
330383,
354974,
150183,
174774,
248504,
174777,
223934,
355024,
273108,
355028,
264918,
183005,
256734,
436962,
338660,
338664,
264941,
363251,
207619,
264964,
338700,
256786,
199452,
363293,
396066,
346916,
396069,
215853,
355122,
355131,
355140,
355143,
338763,
355150,
330580,
355166,
265055,
265058,
355175,
387944,
355179,
330610,
330642,
355218,
412599,
207808,
379848,
396245,
330710,
248792,
248798,
347105,
257008,
183282,
265207,
330748,
265214,
330760,
330768,
248862,
396328,
347176,
158761,
199728,
330800,
396336,
396339,
339001,
388154,
388161,
347205,
330826,
339036,
412764,
257120,
265320,
248951,
420984,
330889,
347287,
248985,
339097,
44197,
380070,
339112,
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,
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,
339420,
249308,
339424,
249312,
339428,
339434,
249328,
69113,
372228,
208398,
380432,
175635,
265778,
265795,
396872,
265805,
224853,
224857,
257633,
224870,
372327,
257646,
372337,
224884,
224887,
224890,
224894,
224897,
372353,
216707,
126596,
421508,
224904,
224909,
11918,
159374,
224913,
126610,
339601,
224916,
224919,
126616,
224922,
208538,
224926,
224929,
224932,
224936,
257704,
224942,
257712,
224947,
257716,
257720,
224953,
257724,
224959,
257732,
224965,
224969,
339662,
224975,
257747,
224981,
224986,
257761,
224993,
257764,
224999,
339695,
225012,
257787,
225020,
339710,
257790,
225025,
257794,
257801,
339721,
257804,
225038,
257807,
225043,
372499,
167700,
225048,
257819,
225053,
184094,
225058,
257833,
225066,
257836,
413484,
225070,
225073,
372532,
257845,
225079,
397112,
225082,
397115,
225087,
225092,
225096,
323402,
257868,
225103,
257871,
397139,
225108,
225112,
257883,
257886,
225119,
257890,
339814,
225127,
274280,
257896,
257901,
225137,
339826,
257908,
225141,
257912,
257916,
225148,
257920,
225155,
339844,
225165,
397200,
225170,
380822,
225175,
225180,
118691,
372664,
372702,
372706,
356335,
380918,
405533,
430129,
266294,
266297,
421960,
356439,
430180,
421990,
266350,
356466,
266362,
381068,
225423,
250002,
250004,
225429,
356506,
225437,
135327,
225441,
438433,
225444,
438436,
225447,
438440,
225450,
258222,
225455,
430256,
225458,
225461,
225466,
389307,
225470,
381120,
372929,
430274,
225475,
389320,
225484,
225487,
225490,
225493,
266453,
225496,
225499,
225502,
225505,
356578,
225510,
217318,
225514,
225518,
372976,
381176,
397571,
389380,
356637,
356640,
356643,
356646,
266536,
356649,
356655,
332080,
340275,
356660,
397622,
332090,
225597,
332097,
201028,
348488,
332106,
332117,
348502,
250199,
250202,
332125,
250210,
348522,
348525,
348527,
332152,
389502,
250238,
332161,
356740,
332172,
373145,
340379,
389550,
324030,
266687,
160234,
127471,
340472,
381436,
324094,
266754,
324099,
324102,
324111,
340500,
324117,
324131,
332324,
381481,
356907,
324139,
324142,
356916,
324149,
324155,
348733,
324164,
356934,
348743,
381512,
324170,
324173,
324176,
389723,
332380,
373343,
381545,
340627,
373398,
184982,
258721,
332453,
332459,
389805,
332463,
381617,
332471,
332483,
332486,
373449,
332493,
357069,
357073,
332511,
332520,
340718,
332533,
348924,
389892,
373510,
389926,
152370,
348978,
340789,
348982,
398139,
127814,
357201,
357206,
389978,
430939,
357211,
357214,
201579,
201582,
349040,
340849,
201588,
430965,
324472,
398201,
340858,
324475,
430972,
340861,
324478,
119674,
324481,
373634,
398211,
324484,
324487,
381833,
324492,
324495,
324498,
430995,
324501,
324510,
422816,
324513,
398245,
201637,
324524,
340909,
324533,
324538,
324541,
398279,
340939,
340941,
209873,
340957,
431072,
398306,
340963,
209895,
201711,
349172,
381946,
349180,
439294,
431106,
357410,
250914,
185380,
357418,
209965,
209968,
209975,
209979,
209987,
341071,
349267,
250967,
210010,
341091,
210025,
210027,
210030,
210036,
210039,
349308,
349311,
160895,
152703,
210052,
349319,
210055,
218247,
210067,
210071,
210077,
210080,
251044,
210084,
185511,
210088,
210098,
210107,
210115,
332997,
210127,
333009,
210131,
333014,
210138,
210143,
218354,
218360,
251128,
275706,
275712,
275715,
275721,
349459,
333078,
251160,
349484,
349491,
251189,
415033,
251210,
357708,
210260,
365911,
259421,
365921,
333154,
251235,
374117,
333162,
234866,
390516,
333175,
357755,
251271,
136590,
112020,
349590,
357792,
259515,
415166,
415185,
366034,
366038,
415191,
415193,
415196,
415199,
423392,
333284,
415207,
366056,
366061,
415216,
210420,
415224,
423423,
415257,
415263,
366117,
415270,
144939,
415278,
415281,
415285,
210487,
415290,
415293,
349761,
415300,
333386,
366172,
333413,
423528,
423532,
210544,
415353,
333439,
415361,
267909,
333498,
210631,
333511,
358099,
333534,
366307,
366311,
431851,
366318,
210672,
366321,
366325,
210695,
268041,
210698,
366348,
210706,
399128,
333594,
210719,
358191,
366387,
210739,
399159,
358200,
325440,
366401,
341829,
325446,
46920,
341834,
341838,
341843,
415573,
358234,
341851,
350045,
399199,
259938,
399206,
268143,
358255,
399215,
358259,
243579,
325504,
333698,
333708,
333724,
382890,
350146,
333774,
358371,
350189,
350193,
350202,
333818,
350206,
350213,
268298,
350224,
350231,
333850,
350237,
350240,
350244,
350248,
178218,
350251,
350256,
350259,
350271,
243781,
350285,
374864,
342111,
342133,
374902,
432271,
333997,
334011,
260289,
260298,
350410,
350416,
350422,
211160,
350425,
334045,
350445,
375026,
358644,
350458,
350461,
350464,
325891,
350467,
350475,
375053,
268559,
350480,
432405,
350486,
325914,
350490,
325917,
350493,
325919,
350498,
350504,
358700,
350509,
391468,
358704,
358713,
358716,
383306,
334161,
383321,
383330,
383333,
391530,
383341,
334203,
268668,
194941,
391563,
366990,
416157,
342430,
375208,
326058,
375216,
334262,
334275,
326084,
358856,
334304,
334311,
375277,
334321,
350723,
186897,
342545,
334358,
342554,
334363,
350761,
252461,
334384,
383536,
358961,
334394,
252482,
219718,
334407,
334420,
350822,
375400,
334465,
334468,
162445,
326290,
342679,
342683,
260766,
342710,
244409,
260797,
260801,
350917,
154317,
391894,
154328,
416473,
64230,
113388,
342766,
375535,
203506,
342776,
391937,
391948,
375568,
326416,
375571,
375574,
162591,
326441,
383793,
326451,
326454,
326460,
375612,
244540,
260924,
326467,
244551,
326473,
326477,
326485,
416597,
326490,
342874,
326502,
375656,
433000,
326507,
326510,
211825,
211831,
351097,
392060,
359295,
351104,
342915,
400259,
236430,
342930,
252822,
392091,
400285,
252836,
359334,
211884,
400306,
351168,
359361,
326598,
359366,
359382,
359388,
383967,
343015,
359407,
261108,
244726,
261111,
383997,
261129,
359451,
261147,
211998,
261153,
261159,
359470,
359476,
343131,
384098,
384101,
384107,
367723,
187502,
343154,
384114,
212094,
351364,
384135,
384139,
384143,
351381,
384160,
384168,
367794,
384181,
367800,
384191,
351423,
326855,
244937,
253130,
343244,
146642,
359649,
343270,
351466,
351479,
343306,
261389,
359694,
384269,
253200,
261393,
384275,
245020,
245029,
171302,
351534,
376110,
245040,
425276,
384323,
212291,
343365,
212303,
367965,
343393,
343398,
367980,
425328,
343409,
253303,
154999,
343417,
327034,
245127,
384397,
245136,
245142,
245145,
343450,
245148,
245151,
245154,
245157,
245162,
327084,
359865,
384443,
146876,
327107,
384453,
327110,
327115,
327117,
359886,
359890,
343507,
368092,
343534,
343539,
368119,
343544,
368122,
409091,
359947,
359955,
359983,
343630,
179802,
155239,
327275,
245357,
138864,
155254,
155273,
368288,
245409,
425638,
425649,
155322,
425662,
155327,
155351,
155354,
212699,
155363,
155371,
245483,
409335,
155393,
155403,
155422,
360223,
155438,
155442,
155447,
417595,
155461,
360261,
376663,
155482,
261981,
425822,
155487,
376671,
155490,
155491,
327531,
261996,
376685,
261999,
262002,
327539,
147317,
262005,
425845,
262008,
262011,
155516,
155521,
155525,
360326,
155531,
262027,
262030,
262033,
262036,
262039,
262042,
155549,
262045,
262048,
262051,
327589,
155559,
155562,
155565,
393150,
384977,
393169,
155611,
155619,
253923,
155621,
253926,
327654,
204784,
393203,
360438,
253943,
393206,
393212,
155646
] |
dfa70476e71609ba21603d702f2e412c6974c55e | 2de9bf5ad3552a029d1f6b318bad503ad11035ee | /grpc-swift-master/Plugin/Templates/server-session-clientstreaming.swift | 6dc80ea3fa1969126bc99541f974f43cf61472f5 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | jakezeal/lightning-ios-wallet | 4df0ff46200106a279abb760051c2fd1ef24dc94 | 130e5e252968762176c7faa36e71a0754f9e8475 | refs/heads/master | 2021-04-28T03:51:12.818287 | 2018-02-20T03:42:56 | 2018-02-20T03:42:56 | 122,148,495 | 3 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,788 | swift | // {{ method|methodDescriptorName }} (Client Streaming)
{{ access }} final class {{ .|session:file,service,method }} : {{ .|service:file,service }}Session {
private var provider : {{ .|provider:file,service }}
/// Create a session.
fileprivate init(handler:gRPC.Handler, provider: {{ .|provider:file,service }}) {
self.provider = provider
super.init(handler:handler)
}
/// Receive a message. Blocks until a message is received or the client closes the connection.
{{ access }} func receive() throws -> {{ method|input }} {
let sem = DispatchSemaphore(value: 0)
var requestMessage : {{ method|input }}?
try self.handler.receiveMessage() {(requestData) in
if let requestData = requestData {
requestMessage = try? {{ method|input }}(serializedData:requestData)
}
sem.signal()
}
_ = sem.wait(timeout: DispatchTime.distantFuture)
if requestMessage == nil {
throw {{ .|servererror:file,service }}.endOfStream
}
return requestMessage!
}
/// Send a response and close the connection.
{{ access }} func sendAndClose(_ response: {{ method|output }}) throws {
try self.handler.sendResponse(message:response.serializedData(),
statusCode:self.statusCode,
statusMessage:self.statusMessage,
trailingMetadata:self.trailingMetadata)
}
/// Run the session. Internal.
fileprivate func run(queue:DispatchQueue) throws {
try self.handler.sendMetadata(initialMetadata:initialMetadata) {
queue.async {
do {
try self.provider.{{ method|methodDescriptorName|lowercase }}(session:self)
} catch (let error) {
print("error \(error)")
}
}
}
}
}
| [
-1
] |
7428d0c250884256297794acb1a0516f57298b60 | 73bb1f07ecf1dae85881bebde56845efa2fe1a36 | /ParstagramUITests/ParstagramUITests.swift | 4186a9af2f63a810d467ccb18fa1dbd0f967469f | [] | no_license | destinymcdaniel245/parstagram2 | 9dfd40c9192dc7e441c4bd3b6c14c53dd8c4f0bd | c6d51b2171d382bcb0013fda977b0f73c5f8129d | refs/heads/master | 2020-09-23T06:55:20.222969 | 2019-12-02T18:57:29 | 2019-12-02T18:57:29 | 225,432,597 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,158 | swift | //
// ParstagramUITests.swift
// ParstagramUITests
//
// Created by cs_apple_05 on 11/18/19.
// Copyright © 2019 All rights reserved.
//
import XCTest
class ParstagramUITests: XCTestCase {
override func 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.
}
func testExample() {
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
}
| [
155665,
237599,
229414,
344106,
278571,
229425,
319543,
229431,
180279,
352314,
213051,
376892,
32829,
286787,
237638,
311373,
196687,
278607,
311377,
368732,
180317,
278637,
319599,
278642,
131190,
131199,
278669,
278676,
311447,
327834,
278684,
278690,
311459,
278698,
278703,
278707,
180409,
278713,
295099,
139459,
131270,
229591,
385240,
147679,
311520,
147680,
319719,
295147,
286957,
262403,
180494,
319764,
278805,
311582,
278817,
311596,
336177,
98611,
368949,
278843,
287040,
319812,
311622,
319816,
254285,
344402,
229716,
278895,
287089,
139641,
311679,
311692,
106893,
156069,
254373,
311723,
377265,
319931,
311739,
278974,
336319,
311744,
278979,
336323,
278988,
278992,
279000,
369121,
279009,
188899,
279014,
319976,
279017,
311787,
360945,
319986,
279030,
311800,
279033,
279042,
287237,
377352,
279053,
303634,
303635,
279060,
279061,
254487,
279066,
188954,
279092,
352831,
377419,
303693,
369236,
115287,
189016,
295518,
287327,
279143,
279150,
287345,
287348,
344697,
189054,
287359,
303743,
164487,
279176,
311944,
344714,
311948,
311950,
311953,
336531,
287379,
180886,
295575,
352921,
303772,
221853,
205469,
279207,
295591,
295598,
279215,
279218,
287412,
164532,
287418,
303802,
66243,
287434,
287438,
164561,
303826,
279249,
369365,
369366,
279253,
230105,
361178,
295653,
369383,
230120,
361194,
279278,
312046,
230133,
279293,
205566,
295688,
312076,
295698,
221980,
336678,
262952,
262953,
279337,
262957,
164655,
328495,
303921,
336693,
230198,
222017,
295745,
279379,
295769,
230238,
230239,
435038,
279393,
303973,
279398,
295797,
295799,
279418,
336765,
287623,
279434,
320394,
189327,
189349,
279465,
140203,
304050,
189373,
213956,
345030,
213961,
279499,
304086,
304104,
123880,
320492,
320495,
287730,
320504,
214009,
312313,
312317,
328701,
328705,
418819,
320520,
230411,
320526,
361487,
238611,
140311,
238617,
197658,
336930,
132140,
189487,
345137,
361522,
312372,
238646,
238650,
320571,
336962,
238663,
361547,
205911,
296023,
156763,
361570,
230500,
214116,
214119,
279659,
238706,
312435,
279666,
230514,
279686,
222344,
140426,
337037,
296091,
238764,
279729,
148674,
312519,
279752,
148687,
189651,
279766,
189656,
279775,
304352,
304353,
279780,
279789,
279803,
320769,
312588,
320795,
320802,
304422,
353581,
116014,
312628,
345397,
345398,
222523,
181568,
279872,
279874,
304457,
345418,
230730,
337228,
296269,
222542,
337226,
238928,
296274,
230757,
312688,
296304,
230772,
337280,
296328,
296330,
304523,
9618,
279955,
148899,
148900,
279979,
279980,
173492,
279988,
280003,
370122,
280011,
337359,
329168,
312785,
222674,
329170,
280020,
353751,
280025,
239069,
329181,
320997,
280042,
280043,
329198,
337391,
296434,
288248,
288252,
312830,
230922,
329231,
304655,
230933,
222754,
312879,
230960,
288305,
239159,
157246,
288319,
288322,
280131,
124486,
288328,
239192,
99937,
345697,
312937,
312941,
206447,
288377,
337533,
280193,
239238,
288391,
239251,
280217,
345753,
198304,
255651,
337590,
280252,
296636,
280253,
321217,
280259,
321220,
296649,
239305,
280266,
9935,
313042,
345813,
280279,
18139,
280285,
321250,
337638,
181992,
345832,
288492,
141037,
34547,
67316,
313082,
288508,
288515,
280326,
116491,
280333,
124691,
116502,
321308,
321309,
255781,
280367,
280373,
280377,
321338,
280381,
345918,
280386,
280391,
280396,
337746,
345942,
18263,
362326,
370526,
345950,
362336,
296807,
296815,
313200,
362351,
313204,
124795,
182145,
280451,
67464,
305032,
124816,
214936,
337816,
124826,
329627,
239515,
214943,
354210,
313257,
288698,
214978,
280517,
280518,
214983,
362442,
346066,
231382,
354268,
329696,
190437,
313322,
329707,
174058,
247786,
296942,
337899,
124912,
354283,
313338,
239610,
182277,
354312,
313356,
305173,
223269,
354342,
346153,
354346,
313388,
124974,
321589,
215095,
288829,
288835,
313415,
239689,
354386,
329812,
223317,
354394,
321632,
280676,
313446,
215144,
288878,
288890,
215165,
329884,
215204,
125108,
280761,
223418,
280767,
338118,
280779,
346319,
321744,
280792,
280803,
182503,
338151,
125166,
125170,
395511,
313595,
125180,
125184,
125192,
125197,
125200,
125204,
338196,
272661,
125215,
125216,
125225,
338217,
321839,
125236,
362809,
280903,
289109,
379224,
272730,
215395,
239973,
313703,
280938,
321901,
354671,
354672,
199030,
223611,
248188,
313726,
240003,
158087,
313736,
240020,
190870,
190872,
289185,
305572,
436644,
289195,
338359,
289229,
281038,
281039,
256476,
281071,
322057,
182802,
322077,
289328,
330291,
338491,
322119,
281165,
281170,
436831,
281200,
313970,
297600,
346771,
363155,
289435,
314020,
248494,
166581,
314043,
355006,
363212,
158424,
322269,
338658,
289511,
330473,
330476,
289517,
215790,
125683,
199415,
322302,
289534,
35584,
322312,
346889,
264971,
322320,
166677,
207639,
281378,
289580,
355129,
281407,
289599,
355136,
355138,
355147,
355148,
355153,
281426,
281434,
322396,
281444,
355173,
355174,
207735,
314240,
158594,
330627,
240517,
355216,
256920,
289691,
240543,
289699,
256934,
289704,
289720,
289723,
330688,
281541,
19398,
191445,
183254,
183258,
207839,
314343,
183276,
289773,
248815,
347122,
240631,
330759,
330766,
347150,
330789,
248871,
281647,
322609,
314437,
257093,
207954,
339031,
314458,
281698,
281699,
257126,
322664,
363643,
314493,
150656,
248960,
347286,
339101,
330912,
339106,
306339,
249003,
208044,
322733,
3243,
339131,
290001,
339167,
298209,
290030,
208123,
322826,
126229,
257323,
298290,
208179,
159033,
216387,
372039,
109899,
224591,
331091,
150868,
314708,
314711,
314721,
281958,
314727,
134504,
306541,
314734,
314740,
314742,
314745,
290170,
224637,
306558,
290176,
306561,
314752,
314759,
388488,
298378,
314765,
314771,
306580,
224662,
282008,
314776,
282013,
290206,
314788,
314790,
282023,
298406,
241067,
314797,
134586,
380350,
306630,
200136,
306634,
339403,
3559,
191980,
282097,
306678,
191991,
290304,
323079,
323083,
208397,
323088,
282132,
282135,
175640,
282147,
372261,
306730,
290359,
134715,
323132,
282182,
224848,
224852,
290391,
306777,
323171,
282214,
224874,
314997,
290425,
339579,
282244,
323208,
282248,
224907,
323226,
282272,
282279,
298664,
298666,
224951,
224952,
306875,
282302,
323262,
323265,
282309,
306891,
241360,
282321,
241366,
224985,
282330,
282336,
12009,
282347,
282349,
323315,
200444,
282366,
175874,
249606,
282375,
323335,
282379,
216844,
118549,
282390,
282399,
241440,
282401,
339746,
315172,
216868,
241447,
282418,
282424,
282428,
413500,
241471,
339782,
315209,
159563,
307024,
307030,
241494,
339799,
307038,
282471,
282476,
339840,
315265,
282503,
315272,
315275,
184207,
282517,
298912,
118693,
298921,
126896,
200628,
282572,
282573,
323554,
298987,
282634,
241695,
315431,
315433,
102441,
102446,
282671,
241717,
249912,
307269,
233548,
315468,
176209,
315477,
53334,
200795,
323678,
356446,
315488,
315489,
45154,
217194,
233578,
307306,
249976,
381071,
241809,
323730,
299166,
233635,
299176,
184489,
323761,
184498,
258233,
299197,
299202,
176325,
299208,
233678,
282832,
356575,
307431,
356603,
184574,
217352,
61720,
315674,
282908,
299294,
282912,
233761,
282920,
315698,
332084,
307514,
282938,
127292,
168251,
332100,
323914,
201037,
282959,
348499,
250196,
348501,
168280,
323934,
332128,
381286,
242027,
242028,
160111,
250227,
315768,
315769,
291194,
291193,
291200,
340356,
242059,
315798,
291225,
242079,
283039,
299449,
291266,
373196,
283088,
283089,
242138,
176602,
291297,
242150,
283138,
233987,
324098,
340489,
283154,
291359,
348709,
348710,
283185,
234037,
340539,
234044,
332379,
111197,
242274,
176751,
356990,
291455,
152196,
316044,
184974,
316048,
316050,
340645,
176810,
299698,
291529,
225996,
135888,
242385,
299737,
234216,
234233,
242428,
291584,
299777,
291591,
291605,
283418,
234276,
283431,
242481,
234290,
201534,
348999,
283466,
201562,
234330,
275294,
127840,
349025,
357219,
177002,
308075,
242540,
242542,
201590,
177018,
308093,
291713,
340865,
299912,
349066,
316299,
234382,
308111,
308113,
209820,
283551,
177074,
127945,
340960,
234469,
340967,
324587,
234476,
201721,
234499,
357380,
234513,
316441,
300087,
21567,
308288,
160834,
349254,
250955,
300109,
234578,
250965,
250982,
234606,
300145,
300147,
234626,
349317,
234635,
177297,
308375,
324761,
119965,
234655,
300192,
234662,
300200,
373937,
324790,
300215,
283841,
283846,
283849,
259275,
316628,
259285,
357594,
251124,
316661,
283894,
234741,
292092,
234756,
242955,
177420,
292145,
300342,
333114,
333115,
193858,
300354,
300355,
234830,
259408,
283990,
357720,
300378,
300379,
316764,
292194,
284015,
234864,
316786,
243073,
292242,
112019,
234902,
333224,
374189,
284086,
259513,
284090,
54719,
415170,
292291,
300488,
300490,
234957,
144862,
300526,
259569,
308722,
251379,
300539,
210429,
366081,
292359,
218632,
316951,
374297,
349727,
374327,
210489,
235069,
349764,
194118,
292424,
292426,
333389,
128589,
333394,
349780,
128600,
235096,
300643,
300645,
415334,
243306,
54895,
325246,
333438,
235136,
317102,
300729,
333508,
259780,
333522,
325345,
153318,
333543,
284410,
284425,
300810,
300812,
284430,
161553,
284436,
169751,
325403,
341791,
325411,
186148,
186149,
333609,
284460,
300849,
325444,
153416,
325449,
317268,
325460,
341846,
284508,
300893,
259937,
284515,
276326,
292713,
292719,
325491,
333687,
350072,
317305,
317308,
325508,
333700,
243590,
243592,
325514,
350091,
350092,
350102,
333727,
219046,
333734,
284584,
292783,
300983,
153553,
292835,
6116,
292838,
317416,
325620,
333827,
243720,
292901,
178215,
325675,
243763,
325695,
333902,
227432,
194667,
284789,
284790,
292987,
227459,
194692,
235661,
333968,
153752,
284827,
333990,
284840,
284843,
227517,
309443,
227525,
301255,
227536,
301270,
301271,
325857,
334049,
317676,
309504,
194832,
227601,
325904,
334104,
211239,
334121,
317738,
325930,
227655,
383309,
391521,
366948,
285031,
416103,
227702,
211327,
227721,
285074,
227730,
285083,
293275,
317851,
39323,
227743,
285089,
293281,
301482,
375211,
334259,
342454,
293309,
317889,
326083,
129484,
326093,
285152,
195044,
334315,
236020,
293368,
317949,
342537,
309770,
334345,
342560,
227881,
293420,
236080,
23093,
244279,
244280,
301635,
309831,
55880,
301647,
326229,
309847,
244311,
375396,
244326,
301688,
244345,
301702,
334473,
326288,
227991,
285348,
318127,
293552,
342705,
285362,
285360,
154295,
342714,
342757,
285419,
170735,
342775,
359166,
375552,
228099,
285443,
285450,
326413,
285457,
285467,
326428,
318247,
293673,
318251,
301872,
285493,
285496,
301883,
342846,
293702,
318279,
244569,
252766,
301919,
293729,
351078,
342888,
310132,
228214,
269179,
211835,
228232,
416649,
236427,
252812,
293780,
310166,
400282,
277404,
310177,
359332,
359333,
293801,
326571,
252848,
326580,
326586,
359365,
211913,
326602,
56270,
252878,
359380,
343020,
203758,
277493,
293894,
384015,
293911,
326684,
384031,
113710,
318515,
203829,
277600,
285795,
253028,
228457,
318571,
187508,
302202,
285819,
285823,
285833,
318602,
285834,
228492,
162962,
187539,
326803,
359574,
285850,
351389,
302239,
253098,
302251,
294069,
367798,
294075,
64699,
228541,
343230,
310496,
228587,
302319,
351475,
228608,
318732,
245018,
318746,
130342,
130344,
130347,
286012,
294210,
286019,
359747,
359748,
294220,
318804,
294236,
327023,
327030,
310650,
179586,
294278,
318860,
368012,
318876,
343457,
245160,
286128,
286133,
310714,
302523,
228796,
302530,
228804,
310725,
302539,
310731,
310735,
327122,
310747,
286176,
187877,
310758,
40439,
253431,
286201,
359931,
286208,
245249,
228868,
302602,
294413,
359949,
253456,
302613,
302620,
146976,
245291,
425534,
310853,
286281,
196184,
212574,
204386,
204394,
138862,
310896,
294517,
286344,
286351,
188049,
229011,
229021,
302751,
245413,
212649,
286387,
286392,
302778,
286400,
319176,
212684,
302798,
286419,
294621,
294629,
286457,
286463,
319232,
278273,
360194,
278292,
278294,
294699,
286507,
319289,
237397,
188250,
237411,
327556,
188293,
311183,
294806,
294808,
253851,
319393,
294820,
294824,
253868,
343993,
188349,
98240,
294849,
24531,
212953,
360416,
294887,
253930,
278507,
311277,
327666,
278515
] |
85aecd2e9e1abf57878dbbfde6fdb4d8cd0dae4a | 5511299fb113ea4e6fa614a5b5b6dbfc96890d5f | /On The Map/ListViewController.swift | 5b612b91551a736eaa2279379c62c9f7d195d734 | [] | no_license | davidiad/On_The_Map | 3e6dcb2562e5bec722e1b6cb0612a6ce57c10266 | 055fd91916c00186e96c629ccf1b29d46386187c | refs/heads/master | 2021-01-10T11:53:22.346192 | 2015-11-06T01:39:41 | 2015-11-06T01:39:41 | 44,855,422 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,854 | swift | //
// ListViewController.swift
// On The Map
//
// Created by David Fierstein on 9/29/15.
// Copyright (c) 2015 David Fierstein. All rights reserved.
//
import UIKit
class ListViewController: UITableViewController {
/* shared data model */
var model = OnTheMapData.sharedInstance
// MARK: - View lifecycle
override func viewDidLoad() {
super.viewDidLoad()
setupNav()
NSNotificationCenter.defaultCenter().addObserver(self, selector: "reload", name: refreshNotificationKey, object: nil)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// MARK: - Table view data source
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// Return the number of rows in the section.
if let dataCount = OnTheMapData.sharedInstance.studentInfoArray?.count {
return dataCount
} else {
return 7
}
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath)
// Configure the cell...
if let _studentInfo = OnTheMapData.sharedInstance.studentInfoArray?[indexPath.row] {
var name = " "
if let lastName = _studentInfo.lastName {
name = name + lastName
}
if let firstName = _studentInfo.firstName {
name = firstName + name
}
let location = _studentInfo.location
cell.detailTextLabel?.text = location
cell.textLabel?.text = name
}
return cell
}
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
if let _studentInfo = OnTheMapData.sharedInstance.studentInfoArray?[indexPath.row] {
if let url = _studentInfo.link{
UIApplication.sharedApplication().openURL(url)
}
}
}
// helper function for Refresh button
func reload() {
dispatch_async(dispatch_get_main_queue(), { () -> Void in
self.tableView.reloadData()
})
}
override func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
// set bg color here
// get a sequence of pastel colors
let hueValue = model.backgroundHue(indexPath.row)
let color = UIColor(hue: hueValue, saturation: 0.35, brightness: 0.9, alpha: 1)
cell.backgroundColor = color
let gradient = CAGradientLayer().gradientColor(hueValue)
gradient.frame = cell.bounds
cell.backgroundView = UIView()
cell.backgroundView!.layer.insertSublayer(gradient, atIndex: 0)
}
}
extension CAGradientLayer {
func gradientColor(hueValue: CGFloat) -> CAGradientLayer {
let lightestColor = UIColor(hue: hueValue, saturation: 0.23, brightness: 0.95, alpha: 1)
let lighterColor = UIColor(hue: hueValue, saturation: 0.33, brightness: 0.925, alpha: 1)
let darkerColor = UIColor(hue: hueValue, saturation: 0.4, brightness: 0.9, alpha: 1)
let gradientColors: Array <AnyObject> = [lightestColor.CGColor, lighterColor.CGColor, darkerColor.CGColor, lighterColor.CGColor, lightestColor.CGColor]
let gradientLayer: CAGradientLayer = CAGradientLayer()
gradientLayer.colors = gradientColors
gradientLayer.locations = [0.0, 0.15, 0.5, 0.85, 1.0]
return gradientLayer
}
}
| [
-1
] |
0dfe7907be53f5253bdc44f48524afaa0182de3a | de7c67a0d37466bec1e1998b513e194b5562b44d | /SARA/SessionViewController.swift | f326d3d13a59a391caae61463a0dc7c770190a05 | [] | no_license | lionwarriorjr/SARAV2 | 8a9e30c624b6586dde54a2a966c783e0a1cb9cba | 95b119fc8422f9533d55f4ad16f40e9e438d009c | refs/heads/master | 2021-01-12T13:47:33.284737 | 2016-09-24T21:35:48 | 2016-09-24T21:35:48 | 69,128,865 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 7,083 | swift | //
// SessionViewController.swift
// SARA
//
// Created by Srihari Mohan on 9/23/16.
// Copyright © 2016 Srihari Mohan. All rights reserved.
//
import UIKit
import AVKit
import AVFoundation
import CoreGraphics
class SessionViewController: UIViewController, SWRevealViewControllerDelegate, SessionViewDelegate {
@IBOutlet weak var contextView: SessionView!
@IBOutlet weak var navBar: UINavigationBar!
@IBOutlet weak var leave: UIButton!
@IBOutlet weak var tools: UIBarButtonItem!
@IBOutlet weak var risk: UIBarButtonItem!
@IBOutlet weak var riskLabel: UILabel!
@IBOutlet weak var score: UIButton!
@IBOutlet weak var divider: UIView!
var navTitle: String!
var player = AVPlayer()
var playerLayer = AVPlayerLayer()
let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
override func prefersStatusBarHidden() -> Bool {
return true;
}
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
let currentRisk = appDelegate.currentRisk
riskLabel.text = (currentRisk == "") ? "Risk: Tissue Perforation"
: "Risk: " + currentRisk
riskLabel.textColor = UIColor(red: 1, green: 104/255.0, blue: 102/255.0, alpha: 1)
score.setTitle("", forState: .Normal)
appDelegate.currentTool = "Grasping Forceps"
appDelegate.currentColor = UIColor(netHex: 0x1ca0de)
appDelegate.player = self.player
}
override func viewDidLoad() {
super.viewDidLoad()
contextView.delegate = self
self.revealViewController().delegate = self
self.navigationController?.navigationBarHidden = true
navBar.opaque = true
navBar.topItem?.title = navTitle
navBar.titleTextAttributes = [NSForegroundColorAttributeName : UIColor(red: 255/255.0, green: 255/255.0, blue: 255/255.0, alpha: 1.0), NSFontAttributeName : UIFont(name: "Helvetica Neue", size: 17)!]
leave.addTarget(self, action: #selector(SessionViewController.dismissView), forControlEvents: .TouchUpInside)
risk.target = self.revealViewController()
risk.action = #selector(SWRevealViewController.rightRevealToggle(_:))
tools.target = self.revealViewController()
tools.action = #selector(SWRevealViewController.revealToggle(_:))
let path = NSBundle.mainBundle().pathForResource(appDelegate.videoFeed, ofType: "mp4")
print(path)
let fileURL = NSURL(fileURLWithPath: path!)
player = AVPlayer(URL: fileURL)
playerLayer = AVPlayerLayer(player: player)
playerLayer.frame = self.view.frame
if appDelegate.videoFeed == "Capsular" {
playerLayer.videoGravity = AVLayerVideoGravityResizeAspectFill
} else {
playerLayer.videoGravity = AVLayerVideoGravityResize
}
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(SessionViewController.playerItemDidReachEnd), name: AVPlayerItemDidPlayToEndTimeNotification, object: player.currentItem)
self.contextView.backgroundColor = UIColor.clearColor()
self.view.layer.addSublayer(playerLayer)
self.view.bringSubviewToFront(contextView)
self.view.bringSubviewToFront(navBar)
self.view.bringSubviewToFront(leave)
self.view.bringSubviewToFront(score)
self.view.bringSubviewToFront(divider)
score.titleLabel?.adjustsFontSizeToFitWidth = true
riskLabel.adjustsFontSizeToFitWidth = true
score.addTarget(self, action: #selector(SessionViewController.showScorecard), forControlEvents: .TouchUpInside)
player.seekToTime(kCMTimeZero)
player.play()
}
func showScorecard() {
let scorecardVC = self.storyboard?.instantiateViewControllerWithIdentifier("ScoreCardVC")
as! ScoreCard
self.addChildViewController(scorecardVC)
scorecardVC.view.frame = self.view.frame
self.view.addSubview(scorecardVC.view)
scorecardVC.didMoveToParentViewController(self)
scorecardVC.composite.text = "\(appDelegate.currentScore)"
scorecardVC.targetDesc.text = appDelegate.currentRisk
scorecardVC.primary.text = appDelegate.primaryText
scorecardVC.secondary.text = appDelegate.secondaryText
scorecardVC.tertiary.text = appDelegate.tertiaryText
scorecardVC.summary.text = appDelegate.summaryText
scorecardVC.snapshot.image = appDelegate.snapshot
}
func makeDynamicChanges() {
score.setTitle("Risk: " + "\(appDelegate.currentScore)",
forState: .Normal)
score.titleLabel?.font = UIFont(name: "Helvetica-Bold", size: 20)
switch (appDelegate.currentScore) {
case 0...35: score.setTitleColor(UIColor(red: 30/255.0, green: 215/255.0, blue: 96/255.0, alpha: 1), forState: .Normal)
case 36...65: score.setTitleColor(UIColor(red: 240/255.0, green: 184/255.0, blue: 35/255.0, alpha: 1), forState: .Normal)
default: score.setTitleColor(UIColor(red: 255/255.0, green: 102/255.0, blue: 104/255.0, alpha: 1), forState: .Normal)
}
}
static func videoSnapshot() -> UIImage? {
let path = NSBundle.mainBundle().pathForResource((UIApplication.sharedApplication().delegate as! AppDelegate).videoFeed, ofType: "mp4")
let fileURL = NSURL(fileURLWithPath: path!)
let asset = AVURLAsset(URL: fileURL)
let generator = AVAssetImageGenerator(asset: asset)
generator.appliesPreferredTrackTransform = true
let currentTime = CMTimeGetSeconds(((UIApplication.sharedApplication().delegate as! AppDelegate).player.currentItem?.currentTime())!)
let timestamp = CMTime(seconds: currentTime, preferredTimescale: 60)
do {
let imageRef = try generator.copyCGImageAtTime(timestamp, actualTime: nil)
return UIImage(CGImage: imageRef)
}
catch let error as NSError
{
print("Image generation failed with error \(error)")
return nil
}
}
func revealController(revealController: SWRevealViewController!, willMoveToPosition position: FrontViewPosition) {
let rightVC = revealController.rightViewController as? UINavigationController
if rightVC == nil {
return;
}
if ((rightVC?.topViewController?.isKindOfClass(RiskViewController)) != nil) {
let riskVC = rightVC?.topViewController as! RiskViewController
riskVC.risks = appDelegate.selectedRisks
}
let currentRisk = appDelegate.currentRisk
riskLabel.text = (currentRisk == "") ? "" : "Risk: " + currentRisk
contextView.currentColor = appDelegate.currentColor
}
func playerItemDidReachEnd(notification: NSNotification) {
self.player.seekToTime(kCMTimeZero)
player.play()
}
func dismissView() {
self.navigationController?.popViewControllerAnimated(true)
}
}
| [
-1
] |
164633c2db2480757e5a50e39d52588e5e811960 | d131d93c0d68cfe55529862d96ec001eefd75a6d | /BeautySeats/ViewControllers/BeautyServiceViewController.swift | a3d11d891364a4007fa70a1d3301ceed0f7deb8f | [] | no_license | charmymehta/BeautySeats | e6f5132180941ed3aff4b44856dcc6afadea7c34 | 38fd96bb68c4b354af2d5380b3de1fe79c772920 | refs/heads/master | 2022-06-24T05:39:44.059189 | 2020-05-10T18:14:19 | 2020-05-10T18:14:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,956 | swift | //
// BeautyServiceViewController.swift
// BeautySeats
//
// Created by Charmy Mehta on 10/5/2563 BE.
// Copyright © 2563 Charmy Mehta. All rights reserved.
//
import RxCocoa
import RxSwift
import UIKit
class BeautyServiceViewController: UIViewController {
// MARK: - IBOutlets
@IBOutlet weak var tableView: UITableView!
@IBOutlet weak var indicatorView: UIActivityIndicatorView!
// MARK: - Properties
var viewModel: BeautyServiceDataSource = BeautyServiceViewModel()
// MARK: - Private properties
private let disposeBag = DisposeBag()
// MARK: - View life-cycle methods
override func viewDidLoad() {
super.viewDidLoad()
setupViewModel()
configureTableView()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
setupNavigationBar()
}
// MARK: - Data methods
private func setupNavigationBar() {
title = "Beauty Services"
navigationController?.isNavigationBarHidden = false
navigationController?.navigationBar.prefersLargeTitles = true
navigationController?.navigationItem.largeTitleDisplayMode = .always
navigationController?.navigationBar.barTintColor = UIColor.white // Red
navigationController?.navigationBar.tintColor = UIColor.systemBlue // White
navigationItem.largeTitleDisplayMode = .automatic
let barItemAttributes: [NSAttributedString.Key: Any] = [
.font: UIFont.systemFont(ofSize: 26, weight: .bold), NSAttributedString.Key.foregroundColor: UIColor.black
]
navigationController?.navigationBar.largeTitleTextAttributes = barItemAttributes // White
navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.black] // White
navigationController?.navigationBar.barStyle = .default
}
private func setupViewModel() {
viewModel.servicesRequestState
.observeOn(MainScheduler.instance)
.subscribe(onNext: { [weak self] state in
switch state {
case .success:
self?.tableView.reloadData()
case .failure:
self?.showAlertView("BeautySeat", message: "Something went wrong. Please try again later.")
}
})
.disposed(by: disposeBag)
viewModel.isLoading.bind(to: indicatorView.rx.isAnimating).disposed(by: disposeBag)
viewModel.fetchBeautyServices()
}
private func configureTableView() {
tableView.dataSource = self
tableView.tableFooterView = UIView(frame: CGRect.zero)
tableView.estimatedRowHeight = 65.0
tableView.rowHeight = UITableView.automaticDimension
tableView.hideEmptyCells()
}
}
// MARK: - UITableViewDataSource
extension BeautyServiceViewController: UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
return viewModel.numberOfSections()
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return viewModel.numberOfRowsInSection(section)
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = tableView.dequeueReusableCell(withIdentifier: BeautyServiceCell.reuseIdentifier) as? BeautyServiceCell else {
return UITableViewCell()
}
cell.configure(viewModel.beautyServiceAt(indexPath))
return cell
}
}
extension BeautyServiceViewController {
static func storyboardInstance() -> BeautyServiceViewController {
let beautyServiceViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "BeautyServiceViewController") as! BeautyServiceViewController
return beautyServiceViewController
}
}
| [
-1
] |
cf79ac9bbe10540f6bca7962f1096ff619344b42 | 3117bd705ac29e2dfbdd62eba6844b5bd2853e25 | /KPI Maps/DataBase.swift | 309dc71d365987aa100d7be1dc2fd1be5dccb9a0 | [] | no_license | scaaales/KPI-Maps | 66fb7802b758632d58b4bf1b2535de8a3aeadc5b | ef044e0df5233a21c47b349462a93a2621dac350 | refs/heads/master | 2021-01-21T19:01:32.520340 | 2019-11-11T16:40:10 | 2019-11-11T16:40:10 | 92,103,996 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,881 | swift | //
// DataBase.swift
// KPI Maps
//
// Created by scales on 20.05.17.
// Copyright © 2017 kpi. All rights reserved.
//
import GRDB
import UIKit
import GoogleMaps
protocol SearchName {
var name: String { get }
}
class Database: NSObject {
static var dbQueue: DatabaseQueue!
static func open() {
if let databasePath = Bundle.main.path(forResource: "KPIMaps", ofType: "db") {
do {
dbQueue = try DatabaseQueue(path: databasePath)
} catch {
print("error = \(error)")
}
}
}
static let allObjectsNames: [String] = {
var result: [String] = []
for building in allBuildings {
result.append(building.name)
}
for classroom in allClassrooms {
result.append(classroom.name)
}
return result
}()
static let allBuildings: [Building] = {
var result: [Building] = []
dbQueue.inDatabase { db in
do {
result = try Building.fetchAll(db)
} catch {
print("error = \(error)")
}
}
return result
}()
static let allClassrooms: [Classroom] = {
var result: [Classroom] = []
dbQueue.inDatabase { db in
do {
result = try Classroom.fetchAll(db)
} catch {
print("error = \(error)")
}
}
return result
}()
static func getClassroom(_ classroomNumber: String, inBuilding buildingNumber: Int) -> Classroom? {
for classroom in allClassrooms where ((classroom.buildingNumber == buildingNumber) && (classroom.number == classroomNumber)) {
return classroom
}
return nil
}
}
| [
-1
] |
48b74d3a3214473c778c9c771a14bf5ae54c5843 | 9838214195f36d878e67a5d857419e61a8905fac | /4.median-of-two-sorted-arrays.ac.swift | e2c292bf1ed86011b6d64d80da01e6ba1ca3c3e8 | [] | no_license | Rich86man/algorithms | b6a100cf508d41e61f6568e54cddb2278edec6cd | 093f1fe99ffe81c2fe54c7bc792f7a2769acd60a | refs/heads/master | 2021-09-04T09:51:37.803340 | 2018-01-17T20:16:00 | 2018-01-17T20:16:00 | 116,593,092 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,251 | swift | /*
* [4] Median of Two Sorted Arrays
*
* https://leetcode.com/problems/median-of-two-sorted-arrays/description/
*
* algorithms
* Hard (22.54%)
* Total Accepted: 221.5K
* Total Submissions: 982.8K
* Testcase Example: '[1,3]\n[2]'
*
* There are two sorted arrays nums1 and nums2 of size m and n respectively.
*
* Find the median of the two sorted arrays. The overall run time complexity
* should be O(log (m+n)).
*
* Example 1:
*
* nums1 = [1, 3]
* nums2 = [2]
*
* The median is 2.0
*
*
*
* Example 2:
*
* nums1 = [1, 2]
* nums2 = [3, 4]
*
* The median is (2 + 3)/2 = 2.5
*
*
*/
class Solution {
func findMedianSortedArrays(_ nums1: [Int], _ nums2: [Int]) -> Double {
let x = nums1.count
let y = nums2.count
guard x <= y else { return findMedianSortedArrays(nums2, nums1) }
var start = 0
var end = x
print("a")
while (start <= end) {
print(start, end)
let xPartition = (start + end) / 2
let yPartition = (x + y + 1) / 2 - xPartition
// print(start, end, xPartition, yPartition)
let xLeftValue = xPartition == 0 ? Int.min : nums1[xPartition - 1]
let xRightValue = xPartition == x ? Int.max : nums1[xPartition]
let yLeftValue = yPartition == 0 ? Int.min : nums2[yPartition - 1]
let yRightValue = yPartition == y ? Int.max : nums2[yPartition]
if (xLeftValue <= yRightValue && yLeftValue <= xRightValue) {
if (x + y) % 2 == 0 {
// print(xLeftValue, yLeftValue, xRightValue, yRightValue)
return Double(max(xLeftValue, yLeftValue) + min(xRightValue, yRightValue)) / 2.0
} else {
return Double(max(xLeftValue, yLeftValue))
}
} else if (xLeftValue > yRightValue) {
end = xPartition - 1
} else {
start = xPartition + 1
}
}
return 0.0
}
func median(_ array: [Int]) -> Double {
guard array.count > 0 else { return 0 }
guard array.count > 1 else { return Double(array[0]) }
if array.count % 2 == 0 {
return (Double(array[(array.count / 2) - 1]) + Double(array[array.count / 2])) / 2.0
} else {
return Double(array[array.count / 2])
}
}
func zipup(_ a: [Int], _ b: [Int]) -> [Int] {
var result: [Int] = []
var aptr = 0
var bptr = 0
while aptr < a.count || bptr < b.count {
if aptr >= a.count {
result.append(b[bptr])
bptr += 1
continue
}
if bptr >= b.count {
result.append(a[aptr])
aptr += 1
continue
}
if a[aptr] < b[bptr] {
result.append(a[aptr])
aptr += 1
} else {
result.append(b[bptr])
bptr += 1
}
}
return result
}
}
| [
-1
] |
6e5f44531cedc24167462cea296361468bfe36e5 | 07392f79d2ee8ae2d9e3d39c42b6b848686cdc3b | /XJPhotoBrower/XJPhotoBrower/Classes/Main/XJNavigationController.swift | 8520752139e33789aa71018a8b4f568cf689e6ea | [] | no_license | lishengbing/XJPhotoBrower | 91281de3a675b43abce9b0a4c5d5e8e9909c6fa3 | 698f3b42b088d6d9e7be2f3772918aa9fbb81d1f | refs/heads/master | 2021-01-23T13:16:46.459430 | 2018-03-21T07:08:00 | 2018-03-21T07:08:00 | 93,240,245 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,910 | swift | //
// XJNavigationController.swift
// Mortgage
//
// Created by 李胜兵 on 2017/5/16.
// Copyright © 2017年 善林(中国)金融信息服务有限公司. All rights reserved.
//
import UIKit
class XJNavigationController: UINavigationController {
override func viewDidLoad() {
super.viewDidLoad()
setupPanGes()
setupNavBarButtonItem()
}
}
extension XJNavigationController {
fileprivate func setupNavBarButtonItem() {
// 导航栏字体值
let attrs : [String : Any] = [NSFontAttributeName : UIFont.systemFont(ofSize: 18), NSForegroundColorAttributeName : UIColor.black]
navigationBar.titleTextAttributes = attrs
self.tabBarItem.titlePositionAdjustment = UIOffset(horizontal: 2, vertical: -5)
// 导航栏背景色: 如果没有图片会直接闪退
navigationBar.setBackgroundImage(UIImage(named: "Nav_bgImg"), for: .any, barMetrics: .default)
// 去掉导航栏下面线条的
// navigationBar.shadowImage = UIImage()
}
}
extension XJNavigationController {
func setupPanGes() {
guard let systemGes = interactivePopGestureRecognizer else { return }
guard let gesView = systemGes.view else { return }
let targets = systemGes.value(forKey: "_targets") as? [NSObject]
guard let targetObjc = targets?.first else { return }
guard let target = targetObjc.value(forKey: "target") else { return }
let action = Selector(("handleNavigationTransition:"))
let pan = UIScreenEdgePanGestureRecognizer(target: target, action: action)
pan.edges = UIRectEdge.left
//let pan = UIPanGestureRecognizer(target: target, action: action)
gesView.addGestureRecognizer(pan)
pan.delegate = self
self.interactivePopGestureRecognizer?.isEnabled = false
}
}
extension XJNavigationController {
override func pushViewController(_ viewController: UIViewController, animated: Bool) {
if childViewControllers.count > 0 {
viewController.navigationItem.leftBarButtonItem = UIBarButtonItem(image: UIImage(named: "Nav_back"), style: .done, target: self, action: #selector(XJNavigationController.backBtnClick))
viewController.hidesBottomBarWhenPushed = true
}
super.pushViewController(viewController, animated: animated)
}
@objc fileprivate func backClick() {
popViewController(animated: true)
}
}
extension XJNavigationController: UIGestureRecognizerDelegate {
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool {
self.view.endEditing(true)
if childViewControllers.count == 1 {
return false
}
return true
}
}
extension XJNavigationController {
func backBtnClick() {
popViewController(animated: true)
}
}
| [
-1
] |
a3d3e70fc9d1a847d49cd0171faee80befb7785f | 59c444a0148823421ef6c3404d7e66e711bd186c | /kakao_subject/ViewControllers/HomeViewController.swift | 6e03e984d3c2b432975aed7a453acab9151e8ab0 | [] | no_license | PineLover/ios_public_api_project | 836bf35c05f89b7e76f431fdf530bc39b60c2de3 | 6e63bcc3ebbc9525af4c3254e8c6acef39b7f514 | refs/heads/master | 2021-03-17T07:14:59.948792 | 2020-03-13T02:35:31 | 2020-03-13T02:35:31 | 246,973,050 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,610 | swift | //
// HomeViewController.swift
// kakao_subject
//
// Created by 김동환 on 2020/03/05.
// Copyright © 2020 김동환. All rights reserved.
//
import UIKit
class HomeViewController: UIViewController {
@IBOutlet weak var weatherStateLabel: UILabel!;
@IBOutlet weak var tourListTV: UITableView!
@IBOutlet weak var addressLB: UILabel!
private let CELL_NAME : String = "DetailCell"
private var currentLocation = CLocation.locationInstance.getCurrentLocation()
override func viewDidLoad() {
super.viewDidLoad()
showCurrentAddress()
showWeatherInfo()
showCurrentTourList()
}
private func showWeatherInfo(){
let group : DispatchGroup = DispatchGroup()
Weather.weatherInstance.receiveWeatherDataFromServer(group: group, language: "ko", latitude: self.currentLocation.latitude , longitude: self.currentLocation.longitude)
group.notify(queue: .main, execute: { [unowned self] in
let weatherINF = Weather.weatherInstance.getWeatherData()
//more datas
//print(weatherINF.weatherForecast)
self.weatherStateLabel.text = weatherINF.weatherForecast
self.weatherStateLabel.sizeToFit()
})
}//showWeatherInfo
private func showCurrentTourList(){
/*
let cellNib : UINib = UINib(nibName: "DetailCell", bundle: nil)
tourListTV.register(cellNib, forCellReuseIdentifier: "DetailCell")
*/
let group: DispatchGroup = DispatchGroup()
let location : CLocation.CurrentLocation = CLocation.locationInstance.getCurrentLocation()
Tour.tourInstance.getTourInformationFromServer(group: group, latitude: location.latitude, longitude: location.longitude)
group.notify(queue: .main, execute: { [unowned self] in
self.tourListTV.delegate = self
self.tourListTV.dataSource = self
//이걸 부르니까 테이블 뷰가 다시 그려지는건가, 데이터를 다시 가져오는건가?
self.tourListTV.reloadData()
// print("tour delegate set")
})
/* dynamic rowHeight
tourListTV.estimatedRowHeight = 70
tourListTV.rowHeight = UITableView.automaticDimension
*/
}
private func showCurrentAddress(){
let group : DispatchGroup = DispatchGroup()
CLocation.locationInstance.getCurrentAddress(group: group)
group.notify(queue : .main , execute : { [unowned self] in
self.addressLB.text = CLocation.locationInstance.getCurrentAddress()
self.addressLB.sizeToFit()
})
}
}
extension HomeViewController : UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
let count : Int = Tour.tourInstance.getTourInformation().count
// for testing
//count = 2
print("count: \(count)")
return count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
/*
let cell : DetailCell = self.tourListTV.dequeueReusableCell(withIdentifier: CELL_NAME, for: indexPath) as! DetailCell
//do something
cell.settingTourInformation(name: "test", summary: "testing", keyword: "testing", image: "not yet")
*/
let cell : prototypeDetailCell = tableView.dequeueReusableCell(withIdentifier: "testCell", for: indexPath) as! prototypeDetailCell
let inf = Tour.tourInstance.getTourInformation()[indexPath.row]
/* Fatal error: Index out of range */
//cell.settingTourInformation(name: inf.name, summary: inf.address, keyword: inf.tel, image: inf.imageURL[0] )
/* there is no inf.imageURL[0]? somecase */
if let image : String = inf.imageURL.first{
cell.settingTourInformation(name: inf.name, summary: inf.address, keyword: inf.tel, image: image)
}else{
print("no instance")
}
return cell
}
//why only this worked?
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat
{
//inspector and this what's first
return 120 //or whatever you need
}
}
//
extension HomeViewController : UITableViewDelegate {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
//why use guard?
//instantiateInitialViewController? what is it?
guard let nextController = UIStoryboard(name : "Detail", bundle:nil).instantiateInitialViewController() else{
fatalError("could not load UIStoryBoard")
}
self.present(nextController, animated: true){
//근데 이 부분이 뷰디드로드 되기 전에 수행되는거 아닌가?
//여기서 api로 받은 관광 이름을 웹 클래스로 넘긴다.
//여기서는 존재하는 값이니까 optional을 고려안해도 되는거 같다.
//이 부분이 신기하다, 뷰로드 되기 전부터 뷰컨은 미리 존재한다는 점...,왜 델리게이트를 굳이 디테일뷰컨으로 정했을까?
print("webSearch is called \(webSearch.webSearchInstance.delegate)")
webSearch.webSearchInstance.delegate?.transmitData(parameter: Tour.tourInstance.getTourInformation()[indexPath.row].name)
}
}
}
| [
-1
] |
81dfdbcad611a01346e6d6c8dc63e6d9e580cce9 | 77bbfe5e9c42940d0ba38ded13d8f28186abaeff | /Moonshot/Models/Astronaut.swift | 938c72b9b081901ce372b9fcbaaaec170628b687 | [] | no_license | NateLeee/Moonshot | 86950ddb21453990cbcb495f46f56d6e00d1f6c7 | 82d71387ad2bf4b3da174514e44a7b9c765a49c2 | refs/heads/master | 2022-11-19T05:53:30.248209 | 2020-07-14T07:11:38 | 2020-07-14T07:11:38 | 279,193,718 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 329 | swift | //
// Astronaut.swift
// Moonshot
//
// Created by Nate Lee on 7/13/20.
// Copyright © 2020 Nate Lee. All rights reserved.
//
import Foundation
struct Astronaut: Codable, Identifiable {
var id: String // 'cause here is an id field, protocal Identifiable is allowed!
var name: String
var description: String
}
| [
-1
] |
b7513722b8d9873805aacb1be949620a407bcf28 | 0e5f7c1f074077023fccc4fe9542d2d9aa9c0f3b | /002-Swift面向对象Demo/003-闭包的定义/003-闭包的定义/AppDelegate.swift | 56d6bb4636830c7390b6f5d077c2401a6722d53c | [] | no_license | daodaidao/SwiftIntroductionDemo | 7a7461481a5b3fd7a02870f530a348f611760bc2 | 01e2bebeb85dfe5e46dcd29ea39bd8730ecb8c4f | refs/heads/master | 2020-03-12T13:20:54.652164 | 2018-06-06T02:02:02 | 2018-06-06T02:02:02 | 130,639,943 | 2 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,181 | swift | //
// AppDelegate.swift
// 003-闭包的定义
//
// Created by caihongguang on 2018/4/27.
// Copyright © 2018年 SYJ. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
| [
229380,
229383,
229385,
294924,
229388,
229391,
327695,
229394,
229397,
229399,
229402,
229405,
229408,
278564,
294950,
229415,
229417,
327722,
237613,
229422,
360496,
229426,
237618,
229428,
311349,
286774,
286776,
319544,
286778,
229432,
204856,
352318,
286791,
237640,
286797,
278605,
311375,
163920,
237646,
196692,
319573,
311383,
319590,
311400,
278635,
303212,
278639,
131192,
278648,
237693,
303230,
327814,
303241,
131209,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
131264,
286916,
295110,
286922,
286924,
286926,
319694,
131281,
278743,
278747,
295133,
155872,
319716,
237807,
303345,
286962,
303347,
131314,
229622,
327930,
278781,
278783,
278785,
237826,
319751,
278792,
286987,
319757,
311569,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
295220,
287032,
155966,
319809,
319810,
278849,
319814,
311623,
319818,
311628,
229709,
319822,
287054,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
319879,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
278980,
98756,
278983,
319945,
278986,
319947,
278990,
278994,
279003,
279006,
188895,
172512,
287202,
279010,
279015,
172520,
319978,
279020,
172526,
311791,
279023,
172529,
279027,
319989,
172534,
180727,
164343,
311804,
287230,
279040,
303617,
287234,
279045,
172550,
303623,
172552,
287238,
320007,
279051,
172558,
279055,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
279082,
311850,
279084,
172591,
172598,
279095,
172607,
172609,
172612,
377413,
172614,
213575,
172618,
303690,
33357,
287309,
303696,
279124,
172634,
262752,
254563,
172644,
311911,
189034,
295533,
172655,
172656,
352880,
295538,
189039,
172660,
287349,
189040,
189044,
287355,
287360,
295553,
172675,
295557,
287365,
311942,
303751,
352905,
279178,
287371,
311946,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
172702,
164509,
303773,
172705,
287394,
172707,
303780,
287390,
287398,
205479,
279208,
287400,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
328384,
172737,
279231,
287427,
312005,
312006,
172748,
287436,
107212,
172751,
287440,
295633,
172755,
303827,
279255,
172760,
287450,
303835,
279258,
189149,
303838,
213724,
312035,
279267,
295654,
279272,
230128,
312048,
312050,
230131,
189169,
205564,
303871,
230146,
328453,
295685,
230154,
33548,
312077,
295695,
295701,
230169,
369433,
295707,
328476,
295710,
230175,
295720,
303914,
279340,
205613,
279353,
230202,
312124,
328508,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
279390,
230241,
279394,
303976,
336744,
303981,
303985,
328563,
303987,
279413,
303991,
303997,
295806,
295808,
295813,
304005,
320391,
213895,
304007,
304009,
304011,
230284,
304013,
295822,
279438,
189325,
189329,
295825,
304019,
189331,
58262,
304023,
304027,
279452,
410526,
279461,
279462,
304042,
213931,
230327,
304055,
287675,
197564,
230334,
304063,
304065,
213954,
189378,
156612,
295873,
213963,
197580,
234657,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
312321,
295945,
230413,
295949,
197645,
320528,
140312,
295961,
238620,
197663,
304164,
304170,
304175,
238641,
312374,
238652,
238655,
230465,
238658,
336964,
296004,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
205931,
279661,
205934,
164973,
312432,
279669,
337018,
189562,
279679,
304258,
279683,
222340,
66690,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
238766,
165038,
230576,
238770,
304311,
230592,
312518,
279750,
230600,
230607,
148690,
320727,
279769,
304348,
279777,
304354,
296163,
320740,
279781,
304360,
320748,
279788,
279790,
304370,
296189,
320771,
312585,
296202,
296205,
230674,
320786,
230677,
296213,
296215,
320792,
230681,
230679,
214294,
230689,
173350,
312622,
296243,
312630,
222522,
296253,
222525,
296255,
312639,
230718,
296259,
378181,
296262,
230727,
238919,
296264,
320840,
296267,
296271,
222545,
230739,
312663,
222556,
337244,
230752,
312676,
230760,
173418,
148843,
410987,
230763,
230768,
296305,
312692,
230773,
304505,
304506,
181626,
181631,
148865,
312711,
312712,
296331,
288140,
288144,
230800,
304533,
337306,
288154,
288160,
288162,
288164,
279975,
304555,
370092,
279983,
173488,
288176,
312755,
296373,
312759,
279991,
288185,
337335,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
288210,
370130,
222676,
288212,
148946,
280021,
239064,
288217,
329177,
280027,
288220,
288214,
239070,
288218,
288224,
280034,
288226,
280036,
288229,
280038,
288230,
288232,
370146,
320998,
288234,
288236,
288238,
288240,
288242,
296435,
288244,
288250,
296446,
321022,
402942,
148990,
296450,
206336,
230916,
230919,
214535,
230923,
304651,
304653,
370187,
402969,
230940,
222752,
108066,
296486,
296488,
157229,
239152,
230961,
157236,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
288344,
280152,
239194,
280158,
403039,
181854,
370272,
239202,
370279,
312938,
280183,
280185,
280188,
280191,
116354,
280194,
280208,
280211,
288408,
280218,
280222,
419489,
190118,
198310,
321195,
296622,
321200,
337585,
296634,
296637,
419522,
313027,
280260,
419525,
206536,
280264,
206539,
206541,
206543,
263888,
313044,
280276,
321239,
280283,
313052,
18140,
288478,
313055,
419555,
321252,
313066,
288494,
280302,
280304,
313073,
321266,
288499,
419570,
288502,
280314,
288510,
124671,
67330,
280324,
198405,
288519,
280331,
198416,
280337,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
296767,
288576,
345921,
280388,
337732,
304968,
280393,
280402,
173907,
313171,
313176,
280419,
321381,
296809,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280464,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
280487,
313258,
321458,
296883,
124853,
214966,
296890,
10170,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
354265,
354270,
239586,
313320,
354281,
231404,
124913,
165876,
321528,
239612,
313340,
288764,
239617,
313347,
288773,
313358,
305176,
321560,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
149599,
280671,
149601,
321634,
149603,
223327,
329830,
280681,
313451,
223341,
280687,
149618,
215154,
313458,
280691,
313464,
329850,
321659,
280702,
288895,
321670,
215175,
141446,
141455,
141459,
280725,
313498,
100520,
288936,
280747,
288940,
288947,
280755,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
313548,
321740,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
157930,
280811,
280817,
125171,
157940,
280819,
182517,
280823,
280825,
280827,
280830,
280831,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
305464,
280888,
280891,
289087,
108865,
280897,
280900,
305480,
239944,
280906,
239947,
305485,
305489,
379218,
280919,
248153,
215387,
354653,
354656,
313700,
280937,
313705,
190832,
280946,
223606,
313720,
280956,
239997,
280959,
313731,
199051,
240011,
289166,
240017,
297363,
190868,
240021,
297365,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
289210,
305594,
281024,
289218,
289221,
289227,
436684,
281045,
281047,
215526,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
240132,
281095,
223752,
150025,
338440,
330244,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
289317,
281127,
150066,
158262,
158266,
289342,
281154,
322115,
281163,
281179,
338528,
338532,
281190,
199273,
281196,
19053,
158317,
313973,
297594,
281210,
158347,
264845,
182926,
133776,
182929,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
199364,
297671,
158409,
256716,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322314,
322318,
281361,
281372,
322341,
215850,
281388,
289593,
281401,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
281442,
174955,
224110,
207733,
207737,
158596,
183172,
240519,
322440,
314249,
338823,
183184,
142226,
289687,
224151,
240535,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
420829,
281567,
289762,
322534,
297961,
183277,
281581,
322550,
134142,
322563,
314372,
330764,
175134,
322599,
322610,
314421,
281654,
314427,
314433,
207937,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
289912,
248995,
306341,
306344,
306347,
322734,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
126190,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
257334,
216376,
380226,
298306,
224584,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
290171,
314747,
298365,
290174,
306555,
224641,
281987,
298372,
314756,
281990,
224647,
265604,
298377,
314763,
142733,
298381,
314768,
224657,
306581,
314773,
314779,
314785,
314793,
282025,
282027,
241068,
241070,
241072,
282034,
241077,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
290291,
282101,
241142,
191992,
290298,
151036,
290302,
282111,
290305,
175621,
306694,
192008,
323084,
257550,
290321,
282130,
323090,
290325,
282133,
241175,
290328,
282137,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
282186,
224849,
282195,
282199,
282201,
306778,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
282255,
282261,
175770,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
306856,
196133,
282295,
282300,
323260,
323266,
282310,
323273,
282319,
306897,
241362,
306904,
282328,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
241450,
282410,
306988,
306991,
315184,
323376,
315190,
241464,
159545,
282425,
298811,
118593,
307009,
413506,
307012,
241475,
298822,
315211,
282446,
307027,
315221,
323414,
315223,
241496,
241498,
307035,
307040,
110433,
241509,
110438,
298860,
110445,
282478,
315249,
110450,
315251,
282481,
315253,
315255,
339838,
315267,
282499,
315269,
241544,
282505,
241546,
241548,
298896,
298898,
282514,
241556,
44948,
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,
299003,
241661,
299006,
282623,
315396,
241669,
315397,
282632,
307211,
282639,
290835,
282645,
241693,
282654,
241701,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
192596,
176213,
307287,
307290,
217179,
315482,
192605,
315483,
233567,
299105,
200801,
217188,
299109,
307303,
315495,
356457,
45163,
307307,
315502,
192624,
307314,
323700,
299126,
233591,
299136,
307329,
315524,
307338,
233613,
241813,
307352,
299164,
241821,
299167,
315552,
184479,
184481,
315557,
184486,
307370,
307372,
184492,
307374,
307376,
299185,
323763,
184503,
299191,
176311,
307385,
307386,
307388,
258235,
307390,
176316,
299200,
184512,
307394,
299204,
307396,
184518,
307399,
323784,
233679,
307409,
307411,
176343,
299225,
233701,
307432,
184572,
184579,
184586,
282893,
323854,
291089,
282906,
291104,
233766,
299304,
176435,
307508,
315701,
332086,
307510,
307512,
168245,
307515,
307518,
282942,
282947,
323917,
110926,
282957,
233808,
323921,
315733,
323926,
233815,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299388,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
315801,
291226,
242075,
283033,
61855,
291231,
283042,
291238,
291241,
127403,
127405,
291247,
299440,
127407,
299444,
127413,
291254,
283062,
127417,
291260,
127421,
283069,
127424,
299457,
127429,
127434,
315856,
127440,
176592,
315860,
176597,
127447,
283095,
299481,
127449,
176605,
242143,
127455,
127457,
291299,
340454,
127463,
242152,
291305,
127466,
176620,
127469,
127474,
291314,
291317,
127480,
135672,
291323,
233979,
127485,
291330,
127490,
127494,
283142,
127497,
233994,
135689,
127500,
291341,
233998,
127506,
234003,
127509,
234006,
127511,
152087,
242202,
234010,
135707,
242206,
135710,
242208,
291361,
242220,
291378,
234038,
152118,
234041,
315961,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
291456,
135808,
373383,
299655,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
225948,
135839,
299680,
225954,
299684,
135844,
242343,
209576,
242345,
373421,
299706,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
119509,
226005,
226008,
299740,
242396,
201444,
299750,
283368,
234219,
283372,
185074,
226037,
283382,
316151,
234231,
234236,
242431,
234239,
209665,
234242,
299778,
242436,
226053,
234246,
226056,
291593,
234248,
242443,
234252,
242445,
234254,
291601,
234258,
242450,
242452,
234261,
201496,
234264,
234266,
234269,
283421,
234272,
234274,
152355,
299814,
234278,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
160572,
283452,
234302,
234307,
242499,
234309,
292433,
316233,
234313,
316235,
234316,
283468,
234319,
242511,
234321,
234324,
185173,
201557,
234329,
234333,
308063,
234336,
242530,
349027,
234338,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
234364,
291711,
234368,
291714,
234370,
291716,
234373,
201603,
226182,
234375,
308105,
324490,
226185,
234384,
234388,
234390,
324504,
234393,
209818,
308123,
234396,
324508,
291742,
226200,
234401,
291747,
291748,
234405,
291750,
234407,
324520,
324518,
324522,
234410,
291756,
226220,
291754,
324527,
291760,
234417,
201650,
324531,
234414,
234422,
226230,
275384,
324536,
234428,
291773,
242623,
324544,
234431,
234434,
324546,
324548,
226245,
234437,
234439,
226239,
234443,
291788,
234446,
275406,
193486,
234449,
316370,
193488,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234478,
316400,
234481,
316403,
234484,
234485,
234487,
324599,
234490,
234493,
316416,
234496,
308226,
234501,
308231,
234504,
234507,
234515,
300054,
316439,
234520,
234519,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
144430,
234543,
234546,
275508,
300085,
234549,
300088,
234553,
234556,
234558,
316479,
234561,
316483,
160835,
234563,
308291,
234568,
234570,
316491,
234572,
300108,
234574,
300115,
234580,
234581,
242777,
234585,
275545,
234590,
234593,
234595,
234597,
300133,
234601,
300139,
234605,
160879,
234607,
275569,
234610,
316530,
300148,
234614,
398455,
144506,
234618,
234620,
275579,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
308373,
226453,
234647,
234648,
275606,
234650,
275608,
324757,
300189,
324766,
119967,
234653,
308379,
324768,
283805,
242852,
300197,
234661,
283813,
234664,
177318,
275626,
234667,
316596,
308414,
234687,
300223,
300226,
308418,
234692,
300229,
308420,
308422,
226500,
283844,
300234,
283850,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
300267,
161003,
300270,
300272,
120053,
300278,
275703,
316663,
300284,
275710,
300287,
292097,
300289,
161027,
300292,
300294,
275719,
234760,
177419,
300299,
242957,
300301,
283917,
177424,
349451,
275725,
349464,
415009,
283939,
259367,
292143,
283951,
300344,
226617,
243003,
226628,
300357,
283973,
177482,
283983,
316758,
357722,
316766,
292192,
316768,
218464,
292197,
316774,
243046,
218473,
284010,
136562,
275834,
333178,
275836,
275840,
316803,
316806,
226696,
316811,
226699,
316814,
226703,
300433,
234899,
300436,
226709,
357783,
316824,
316826,
144796,
300448,
144807,
144810,
144812,
144814,
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,
227440,
316917,
308727,
292343,
300537,
316933,
316947,
308757,
308762,
284191,
316959,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
194101,
284213,
316983,
194103,
284215,
308790,
284218,
226877,
292414,
284223,
284226,
284228,
292421,
226886,
284231,
128584,
243268,
284234,
276043,
317004,
366155,
284238,
226895,
284241,
194130,
284243,
300628,
284245,
276053,
284247,
317015,
284249,
243290,
284251,
235097,
284253,
300638,
284255,
243293,
284258,
292452,
292454,
284263,
177766,
284265,
292458,
284267,
292461,
284272,
284274,
284278,
292470,
276086,
292473,
284283,
276093,
284286,
292479,
284288,
292481,
284290,
325250,
284292,
292485,
325251,
276098,
284297,
317066,
284299,
317068,
284301,
276109,
284303,
284306,
276114,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
284329,
317098,
284331,
276137,
284333,
284335,
284337,
284339,
300726,
284343,
284346,
284350,
276160,
358080,
284354,
358083,
284358,
276166,
358089,
284362,
276170,
284365,
276175,
284368,
276177,
284370,
358098,
284372,
317138,
284377,
276187,
284379,
284381,
284384,
358114,
284386,
358116,
276197,
317158,
358119,
284392,
325353,
358122,
284394,
358126,
276206,
358128,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
300819,
317207,
284440,
300828,
300830,
276255,
300832,
325408,
300834,
317221,
227109,
358183,
186151,
276268,
300845,
243504,
300850,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
300872,
292681,
153417,
358224,
284499,
276308,
178006,
317271,
284502,
276315,
292700,
317279,
284511,
227175,
292715,
300912,
292721,
284529,
300915,
284533,
292729,
317306,
284540,
292734,
325512,
169868,
276365,
317332,
358292,
284564,
399252,
350106,
284572,
276386,
284579,
276388,
358312,
317353,
292776,
284585,
276395,
292784,
276402,
358326,
161718,
358330,
276410,
276411,
276418,
276425,
301009,
301011,
301013,
292823,
358360,
301017,
301015,
292828,
276446,
153568,
276452,
292839,
276455,
350186,
292843,
292845,
276464,
178161,
227314,
325624,
350200,
317435,
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,
292934,
243785,
350293,
350295,
309337,
194649,
227418,
350299,
350302,
227423,
350304,
178273,
309346,
194657,
194660,
350308,
309350,
309348,
292968,
309352,
227426,
276579,
227430,
276583,
309354,
301167,
276590,
350321,
350313,
350316,
284786,
350325,
252022,
276595,
350328,
292985,
301178,
350332,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
350366,
276638,
284837,
153765,
350375,
350379,
350381,
350383,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
301258,
309450,
276685,
309455,
276689,
309462,
301272,
276699,
194780,
309468,
309471,
301283,
317672,
317674,
325867,
243948,
194801,
309491,
309494,
243960,
276735,
227583,
227587,
276739,
211204,
276742,
227593,
227596,
325910,
309530,
342298,
211232,
317729,
276775,
211241,
325937,
325943,
211260,
260421,
285002,
276811,
235853,
276816,
235858,
276829,
276833,
391523,
276836,
293227,
276843,
293232,
276848,
186744,
211324,
285061,
366983,
317833,
178572,
285070,
178583,
227738,
317853,
276896,
317858,
342434,
285093,
317864,
285098,
276907,
235955,
276917,
293304,
293307,
293314,
309707,
293325,
129486,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
227810,
293346,
276964,
293352,
236013,
293364,
301562,
293370,
317951,
309764,
301575,
121352,
293387,
236043,
342541,
317963,
113167,
55822,
309779,
317971,
309781,
55837,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
285236,
23094,
277054,
244288,
219714,
129603,
301636,
318020,
301639,
301643,
277071,
285265,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
309871,
121458,
277106,
170618,
170619,
309885,
309888,
277122,
227975,
277128,
285320,
301706,
318092,
326285,
334476,
318094,
277136,
277139,
227992,
334488,
318108,
285340,
318110,
227998,
137889,
383658,
285357,
318128,
277170,
293555,
342707,
154292,
318132,
277173,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
342745,
137946,
342747,
342749,
113378,
203491,
228069,
277223,
342760,
56041,
285417,
56043,
56045,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
228113,
285459,
277273,
293659,
326430,
285474,
293666,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
285494,
301880,
285499,
301884,
293696,
310080,
277317,
277322,
293706,
277329,
162643,
310100,
301911,
277337,
301921,
400236,
236397,
162671,
326514,
310134,
236408,
15224,
277368,
416639,
416640,
113538,
310147,
416648,
39817,
187274,
277385,
301972,
424853,
277405,
277411,
310179,
293798,
293802,
236460,
277426,
293811,
293817,
293820,
203715,
326603,
342994,
276586,
293849,
293861,
228327,
228328,
318442,
228330,
228332,
326638,
277486,
351217,
318450,
293876,
293877,
285686,
302073,
121850,
293882,
302075,
244731,
285690,
293887,
277504,
277507,
277511,
293899,
277519,
293908,
302105,
293917,
293939,
318516,
277561,
277564,
310336,
7232,
293956,
277573,
228422,
293960,
310344,
277577,
277583,
203857,
293971,
310355,
310359,
236632,
277594,
138332,
277598,
203872,
277601,
285792,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
367737,
285817,
302205,
285821,
392326,
285831,
294026,
285835,
302218,
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,
204026,
228606,
204031,
64768,
310531,
285958,
138505,
228617,
318742,
204067,
130345,
277801,
113964,
277804,
384302,
285999,
285997,
277807,
113969,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
417086,
277822,
286016,
302403,
294211,
384328,
277832,
277836,
294221,
146765,
294223,
326991,
277839,
277842,
277847,
277850,
179547,
277853,
277857,
302436,
277860,
294246,
327015,
310632,
327017,
351594,
277864,
277869,
277872,
351607,
310648,
277880,
310651,
277884,
277888,
310657,
351619,
294276,
310659,
327046,
277892,
253320,
310665,
318858,
277894,
277898,
277903,
310672,
351633,
277905,
277908,
277917,
310689,
277921,
130468,
277928,
277932,
310703,
277937,
310710,
130486,
310712,
277944,
310715,
277947,
302526,
228799,
277950,
277953,
302534,
310727,
64966,
245191,
163272,
277959,
277963,
302541,
277966,
302543,
310737,
277971,
228825,
277978,
310749,
277981,
277984,
310755,
277989,
277991,
187880,
277995,
310764,
286188,
278000,
228851,
310772,
278003,
278006,
40440,
212472,
278009,
40443,
286203,
40448,
228864,
286214,
302603,
65038,
302614,
286233,
302617,
302621,
286240,
146977,
187936,
187939,
40484,
294435,
40486,
286246,
294440,
40488,
294439,
294443,
40491,
294445,
278057,
310831,
245288,
286248,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
327240,
40521,
286283,
40525,
40527,
212560,
400976,
228944,
40533,
147032,
40537,
40539,
40541,
278109,
40544,
40548,
40550,
40552,
286313,
40554,
310892,
40557,
40560,
188022,
122488,
294521,
343679,
294537,
310925,
286354,
278163,
302740,
278168,
179870,
327333,
229030,
212648,
278188,
302764,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
294601,
302793,
343757,
212690,
319187,
278227,
286420,
229076,
286425,
319194,
278235,
301163,
278238,
229086,
286432,
294625,
294634,
302838,
319226,
286460,
278274,
302852,
278277,
302854,
294664,
311048,
352008,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
278320,
319280,
319290,
229192,
302925,
188247,
188252,
237409,
229233,
294776,
360317,
294785,
327554,
360322,
40840,
40851,
294803,
188312,
294811,
237470,
319390,
40865,
319394,
294817,
294821,
311209,
180142,
343983,
188340,
40886,
319419,
294844,
294847,
393177,
294876,
294879,
294883,
393190,
294890,
311279,
278513,
237555,
278516,
311283,
237562
] |
d95da6e62097c0ff54c2114e9e56714bc918d9fb | 7e08dd9d57d2d0483f82f020cdfb1b78990848d7 | /mInventory/Supplier+CoreDataClass.swift | b6172c12af344264d7576b42775c4be66a5ffce3 | [] | no_license | zielony8080/inventory | 089b33555db33819f60ea8e4e3220b581191ce38 | 714e6b9351eafe25555a281c652b55c0309f4d07 | refs/heads/master | 2021-01-21T20:53:52.833155 | 2017-05-24T12:11:27 | 2017-05-24T12:11:27 | 92,270,543 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 248 | swift | //
// Supplier+CoreDataClass.swift
// mInventory
//
// Created by Łukasz Zielony on 09.05.2017.
// Copyright © 2017 Lukasz Zielony. All rights reserved.
//
import Foundation
import CoreData
public class Supplier: NSManagedObject {
}
| [
-1
] |
31b98644f50dfef5aa358c9c75595e243a0b9564 | ac759cb40142e92cb52d102bf09f4780c4973e97 | /iOS/HPHC/HPHC/Models/Database/DBHandler.swift | a7c2fb82914caec0d55c01ec6ac3e6499d068277 | [
"MIT"
] | permissive | ashokr8142/phanitest | b128f5f21043ad68858e57c4183aa23a992d04a5 | 04ca2cd502fd953e64971292480fd2261dd0be17 | refs/heads/master | 2023-03-03T06:31:10.344379 | 2021-01-13T07:42:28 | 2021-01-13T07:42:28 | 340,147,907 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 80,162 | swift | // License Agreement for FDA MyStudies
// Copyright © 2017-2019 Harvard Pilgrim Health Care Institute (HPHCI) and its Contributors.
// Copyright 2020 Google LLC
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
// documentation files (the "Software"), to deal in the Software without restriction, including without
// limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
// Software, and to permit persons to whom the Software is furnished to do so, subject to the following
// conditions:
// The above copyright notice and this permission notice shall be included in all copies or substantial
// portions of the Software.
// Funding Source: Food and Drug Administration (“Funding Agency”) effective 18 September 2014 as
// Contract no. HHSF22320140030I/HHSF22301006T (the “Prime Contract”).
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
// OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
import RealmSwift
import UIKit
class DBHandler: NSObject {
private static var realm: Realm = {
let key = FDAKeychain.shared[kRealmEncryptionKeychainKey]
let data = Data.init(base64Encoded: key!)
let encryptionConfig = Realm.Configuration(encryptionKey: data)
return try! Realm(configuration: encryptionConfig)
}()
class func getRealmObject() -> Realm? {
return DBHandler.realm
}
/// Used to save user details like userid, authkey, first name , last name etc
func saveCurrentUser(user: User) {
let realm = DBHandler.getRealmObject()!
let dbUsers = realm.objects(DBUser.self)
var dbUser = dbUsers.last
if dbUser == nil {
dbUser = DBUser()
dbUser?.userType = (user.userType?.rawValue)!
dbUser?.emailId = user.emailId!
dbUser?.userId = user.userId
dbUser?.verified = user.verified
dbUser?.clientToken = user.clientToken
try? realm.write {
realm.add(dbUser!, update: .all)
}
} else {
let user = User.currentUser
do {
try realm.write {
dbUser?.userType = (user.userType?.rawValue)!
dbUser?.emailId = user.emailId!
dbUser?.authToken = user.authToken
dbUser?.clientToken = user.clientToken
dbUser?.verified = user.verified
dbUser?.refreshToken = user.refreshToken
}
} catch let error {
Logger.sharedInstance.error(error)
}
}
}
// Used to initialize the current logged in user
func initilizeCurrentUser() -> Bool {
let realm = DBHandler.getRealmObject()!
let dbUsers = realm.objects(DBUser.self)
let dbUser = dbUsers.last
if dbUser != nil {
let currentUser = User.currentUser
currentUser.firstName = dbUser?.firstName
currentUser.lastName = dbUser?.lastName
currentUser.verified = dbUser?.verified
currentUser.userId = dbUser?.userId
currentUser.emailId = dbUser?.emailId
currentUser.clientToken = dbUser?.clientToken
currentUser.userType = (dbUser?.userType).map { UserType(rawValue: $0) }!
let settings = Settings()
settings.localNotifications = dbUser?.localNotificationEnabled
settings.passcode = dbUser?.passcodeEnabled
settings.remoteNotifications = dbUser?.remoteNotificationEnabled
currentUser.settings = settings
return true
}
return false
}
/// This method will save new user App settings like passcode & notifications.
class func saveUserSettingsToDatabase() {
let realm = DBHandler.getRealmObject()!
let dbUsers = realm.objects(DBUser.self)
let dbUser = dbUsers.last
try? realm.write {
let user = User.currentUser
dbUser?.passcodeEnabled = (user.settings?.passcode)!
dbUser?.localNotificationEnabled = (user.settings?.localNotifications)!
dbUser?.remoteNotificationEnabled = (user.settings?.remoteNotifications)!
}
}
class func resetAuthToken() {
let realm = try! Realm()
let dbUsers = realm.objects(DBUser.self)
let dbUser = dbUsers.last
try? realm.write {
dbUser?.authToken = ""
dbUser?.userType = UserType.AnonymousUser.rawValue
}
}
/// Used to delete current logged in user
class func deleteCurrentUser() {
let realm = DBHandler.getRealmObject()!
let dbUsers = realm.objects(DBUser.self)
let dbUser = dbUsers.last
try? realm.write {
realm.delete(dbUser!)
}
}
// MARK: - Study
/// Save studies objects in Database.
///
/// - Parameter studies: Ordered collection of Study Instances.
func saveStudies(studies: [Study]) {
let realm = DBHandler.getRealmObject()!
let dbStudiesArray = realm.objects(DBStudy.self)
var dbStudies: [DBStudy] = []
for study in studies {
// Some studies are already present in db
var dbStudy: DBStudy?
if dbStudiesArray.count > 0 {
dbStudy = dbStudiesArray.filter({ $0.studyId == study.studyId }).last
}
if dbStudy == nil {
dbStudy = DBHandler.getDBStudy(study: study)
dbStudies.append(dbStudy!)
} else {
try? realm.write({
dbStudy?.category = study.category
dbStudy?.name = study.name
dbStudy?.sponserName = study.sponserName
dbStudy?.tagLine = study.description
dbStudy?.logoURL = study.logoURL
dbStudy?.startDate = study.startDate
dbStudy?.endEnd = study.endEnd
dbStudy?.status = study.status.rawValue
dbStudy?.enrolling = study.studySettings.enrollingAllowed
dbStudy?.rejoin = study.studySettings.rejoinStudyAfterWithdrawn
dbStudy?.platform = study.studySettings.platform
if let studyStatus = study.userParticipateState {
dbStudy?.participatedStatus = studyStatus.status.rawValue
dbStudy?.participatedId = studyStatus.participantId
dbStudy?.siteID = studyStatus.siteID
dbStudy?.tokenIdentifier = studyStatus.tokenIdentifier
dbStudy?.joiningDate = studyStatus.joiningDate
dbStudy?.completion = studyStatus.completion
dbStudy?.adherence = studyStatus.adherence
dbStudy?.bookmarked = studyStatus.bookmarked
}
if dbStudy?.participatedStatus
== UserStudyStatus.StudyStatus.inProgress
.rawValue
{
dbStudy?.updatedVersion = study.version
} else {
dbStudy?.updatedVersion = study.version
}
})
}
}
try? realm.write {
realm.add(dbStudies, update: .modified)
}
}
/// Creates an instance of DBStudy.
///
/// - Parameter study: Ordered collection of Study Objects.
/// - Returns: Realm object of `DBStudy`
private class func getDBStudy(study: Study) -> DBStudy {
let dbStudy = DBStudy()
dbStudy.studyId = study.studyId
dbStudy.category = study.category
dbStudy.name = study.name
dbStudy.sponserName = study.sponserName
dbStudy.tagLine = study.description
dbStudy.version = study.version
dbStudy.updatedVersion = study.version
dbStudy.logoURL = study.logoURL
dbStudy.startDate = study.startDate
dbStudy.endEnd = study.endEnd
dbStudy.enrolling = study.studySettings.enrollingAllowed
dbStudy.rejoin = study.studySettings.rejoinStudyAfterWithdrawn
dbStudy.platform = study.studySettings.platform
dbStudy.status = study.status.rawValue
if let userStudyStatus = study.userParticipateState {
dbStudy.participatedStatus = userStudyStatus.status.rawValue
dbStudy.participatedId = userStudyStatus.participantId
dbStudy.siteID = userStudyStatus.siteID
dbStudy.tokenIdentifier = userStudyStatus.tokenIdentifier
dbStudy.joiningDate = userStudyStatus.joiningDate
dbStudy.completion = userStudyStatus.completion
dbStudy.adherence = userStudyStatus.adherence
dbStudy.bookmarked = userStudyStatus.bookmarked
}
dbStudy.withdrawalConfigrationMessage = study.withdrawalConfigration?.message
dbStudy.withdrawalConfigrationType = study.withdrawalConfigration?.type?.rawValue
return dbStudy
}
/// Fetches list of Studies from DB.
///
/// - Parameter completionHandler: Completion handler with array of studies and returns nothing
class func loadStudyListFromDatabase(completionHandler: @escaping ([Study]) -> Void) {
let realm = DBHandler.getRealmObject()!
let dbStudies = realm.objects(DBStudy.self)
User.currentUser.participatedStudies.removeAll()
var studies: [Study] = []
for dbStudy in dbStudies {
let study = Study()
study.studyId = dbStudy.studyId
study.category = dbStudy.category
study.name = dbStudy.name
study.sponserName = dbStudy.sponserName
study.description = dbStudy.tagLine
study.version = dbStudy.version
study.newVersion = dbStudy.updatedVersion
study.logoURL = dbStudy.logoURL
study.startDate = dbStudy.startDate
study.endEnd = dbStudy.endEnd
study.status = StudyStatus(rawValue: dbStudy.status!)!
study.signedConsentVersion = dbStudy.signedConsentVersion
study.signedConsentFilePath = dbStudy.signedConsentFilePath
study.activitiesLocalNotificationUpdated = dbStudy.activitiesLocalNotificationUpdated
// Settings
let studySettings = StudySettings()
studySettings.enrollingAllowed = dbStudy.enrolling
studySettings.rejoinStudyAfterWithdrawn = dbStudy.rejoin
studySettings.platform = dbStudy.platform ?? ""
study.studySettings = studySettings
// Status
let participatedStatus = UserStudyStatus()
participatedStatus.status = UserStudyStatus.StudyStatus(
rawValue: dbStudy.participatedStatus
)!
participatedStatus.bookmarked = dbStudy.bookmarked
participatedStatus.studyId = dbStudy.studyId
participatedStatus.participantId = dbStudy.participatedId
participatedStatus.siteID = dbStudy.siteID ?? ""
participatedStatus.tokenIdentifier = dbStudy.tokenIdentifier ?? ""
participatedStatus.adherence = dbStudy.adherence
participatedStatus.completion = dbStudy.completion
participatedStatus.joiningDate = dbStudy.joiningDate
study.userParticipateState = participatedStatus
// Append to user class participatesStudies also
User.currentUser.participatedStudies.append(participatedStatus)
// AnchorDate
let anchorDate = StudyAnchorDate()
anchorDate.anchorDateActivityId = dbStudy.anchorDateActivityId
anchorDate.anchorDateQuestionKey = dbStudy.anchorDateType
anchorDate.anchorDateActivityVersion = dbStudy.anchorDateActivityVersion
anchorDate.anchorDateQuestionKey = dbStudy.anchorDateQuestionKey
anchorDate.anchorDateType = dbStudy.anchorDateType
anchorDate.date = dbStudy.anchorDate
study.anchorDate = anchorDate
let withdrawalInfo = StudyWithdrawalConfigration()
withdrawalInfo.message = dbStudy.withdrawalConfigrationMessage
if dbStudy.withdrawalConfigrationType != nil {
withdrawalInfo.type = StudyWithdrawalConfigrationType(
rawValue: dbStudy.withdrawalConfigrationType!
)
} else {
withdrawalInfo.type = .notAvailable
}
study.withdrawalConfigration = withdrawalInfo
studies.append(study)
}
completionHandler(studies)
}
/// Save study overview.
///
/// - Parameters:
/// - overview: Object of `Overview`
/// - studyId: StudyID to query `DBStudy` object from DB
class func saveStudyOverview(overview: Overview, studyId: String) {
let realm = DBHandler.getRealmObject()!
let studies = realm.objects(DBStudy.self).filter("studyId == %@", studyId)
let dbStudy = studies.last
//save overview
let dbStudies = List<DBOverviewSection>()
for sectionIndex in 0...(overview.sections.count - 1) {
let section = overview.sections[sectionIndex]
let dbOverviewSection = DBOverviewSection()
dbOverviewSection.title = section.title
dbOverviewSection.link = section.link
dbOverviewSection.imageURL = section.imageURL
dbOverviewSection.text = section.text
dbOverviewSection.type = section.type
dbOverviewSection.studyId = studyId
dbOverviewSection.sectionId = studyId + "screen\(sectionIndex)"
dbStudies.append(dbOverviewSection)
}
try? realm.write {
realm.add(dbStudies, update: .all)
dbStudy?.websiteLink = overview.websiteLink
}
}
/// Saves withdrawal configration to DB.
///
/// - Parameters:
/// - withdrawalConfigration: instance of StudyWithdrawalConfigration.
/// - studyId: study for which configrations are to be updated.
class func saveWithdrawalConfigration(
withdrawalConfigration: StudyWithdrawalConfigration,
studyId: String
) {
let realm = DBHandler.getRealmObject()!
let studies = realm.objects(DBStudy.self).filter("studyId == %@", studyId)
let dbStudy = studies.last
try? realm.write {
dbStudy?.withdrawalConfigrationMessage = withdrawalConfigration.message
dbStudy?.withdrawalConfigrationType = withdrawalConfigration.type?.rawValue
}
}
/// Saves anchor date to DB.
///
/// - Parameters:
/// - anchorDate: Instance of StudyAnchorDate.
/// - studyId: Study for which anchorDate are to be updated.
class func saveAnchorDateDetail(anchorDate: StudyAnchorDate, studyId: String) {
let realm = DBHandler.getRealmObject()!
let studies = realm.objects(DBStudy.self).filter("studyId == %@", studyId)
let dbStudy = studies.last
try? realm.write {
dbStudy?.anchorDateActivityId = anchorDate.anchorDateActivityId
dbStudy?.anchorDateType = anchorDate.anchorDateType
dbStudy?.anchorDateActivityVersion = anchorDate.anchorDateActivityVersion
dbStudy?.anchorDateQuestionKey = anchorDate.anchorDateQuestionKey
}
}
/// Saves anchor date to DB.
///
/// - Parameters:
/// - date: New date of Anchor.
/// - studyId: Study for which configrations are to be updated.
class func saveAnchorDate(date: Date, studyId: String) {
let realm = DBHandler.getRealmObject()!
let studies = realm.objects(DBStudy.self).filter("studyId == %@", studyId)
let dbStudy = studies.last
try? realm.write {
dbStudy?.anchorDate = date
}
}
/// Fetches overview from DB.
///
/// - Parameters:
/// - studyId: StudyID for which overview needs to be fetched.
/// - completionHandler: completion handler with instance of overview.
class func loadStudyOverview(studyId: String, completionHandler: @escaping (Overview?) -> Void) {
let realm = DBHandler.getRealmObject()!
let studies = realm.objects(DBOverviewSection.self).filter("studyId == %@", studyId)
let study = realm.objects(DBStudy.self).filter("studyId == %@", studyId).last
if studies.count > 0 {
/// initialize OverviewSection from database
var overviewSections: [OverviewSection] = []
for dbSection in studies {
let section = OverviewSection()
section.title = dbSection.title
section.imageURL = dbSection.imageURL
section.link = dbSection.link
section.type = dbSection.type
section.text = dbSection.text
overviewSections.append(section)
}
// Create Overview object
let overview = Overview()
overview.type = .study
overview.websiteLink = study?.websiteLink
overview.sections = overviewSections
completionHandler(overview)
} else {
completionHandler(nil)
}
}
/// Updates `StudyUpdates` to DB.
///
/// - Parameters:
/// - studyId: StudyID for which overview needs to be fetched.
/// - completionHandler: completion handler with instance of overview.
class func updateMetaDataToUpdateForStudy(study: Study, updateDetails: StudyUpdates?) {
let realm = DBHandler.getRealmObject()!
let studies = realm.objects(DBStudy.self).filter("studyId == %@", study.studyId ?? "")
let dbStudy = studies.last
try? realm.write {
dbStudy?.updateResources = StudyUpdates.studyResourcesUpdated
dbStudy?.updateConsent = StudyUpdates.studyConsentUpdated
dbStudy?.updateActivities = StudyUpdates.studyActivitiesUpdated
dbStudy?.updateInfo = StudyUpdates.studyInfoUpdated
if StudyUpdates.studyVersion != nil {
dbStudy?.version = StudyUpdates.studyVersion
} else {
dbStudy?.version = dbStudy?.updatedVersion
}
}
}
/// This method will update the participation status of the study.
/// - Parameter study: Instance of the study participated.
class func updateStudyParticipationStatus(study: Study) {
let realm = DBHandler.getRealmObject()!
let studies = realm.objects(DBStudy.self).filter("studyId == %@", study.studyId ?? "")
let dbStudy = studies.last
try? realm.write {
if let studyStatus = study.userParticipateState {
dbStudy?.participatedStatus = studyStatus.status.rawValue
dbStudy?.participatedId = studyStatus.participantId
dbStudy?.siteID = studyStatus.siteID
dbStudy?.tokenIdentifier = studyStatus.tokenIdentifier
dbStudy?.joiningDate = studyStatus.joiningDate
dbStudy?.completion = studyStatus.completion
dbStudy?.adherence = studyStatus.adherence
}
}
}
/// Fetches StudyDetails from DB.
/// - Parameters:
/// - studyId: ID of the Study to fetch details from Database.
/// - completionHandler: Bool to indicate if the Study detail available in Database or not.
class func loadStudyDetailsToUpdate(
studyId: String,
completionHandler: @escaping (Bool) -> Void
) {
let realm = DBHandler.getRealmObject()!
let studies = realm.objects(DBStudy.self).filter("studyId == %@", studyId)
let dbStudy = studies.last
StudyUpdates.studyActivitiesUpdated = (dbStudy?.updateActivities)!
StudyUpdates.studyConsentUpdated = (dbStudy?.updateConsent)!
StudyUpdates.studyResourcesUpdated = (dbStudy?.updateResources)!
StudyUpdates.studyInfoUpdated = (dbStudy?.updateInfo)!
completionHandler(true)
}
/// Saves study consent Info to DB.
/// - Parameter study: Instance of the study for which consent information to be saved.
class func saveConsentInformation(study: Study) {
let realm = DBHandler.getRealmObject()!
let studies = realm.objects(DBStudy.self).filter("studyId == %@", study.studyId ?? "")
let dbStudy = studies.last
try? realm.write {
dbStudy?.signedConsentFilePath = study.signedConsentFilePath
dbStudy?.signedConsentVersion = study.signedConsentVersion
}
}
/// Updates local Notification scheduled status for the `Activity`.
/// - Parameters:
/// - studyId: ID of the Study to query `DBStudy` object from Database.
/// - status: Boolean value to indicate the Local notification scheduled.
class func updateLocalNotificationScheduleStatus(studyId: String, status: Bool) {
let realm = DBHandler.getRealmObject()!
let study = realm.object(ofType: DBStudy.self, forPrimaryKey: studyId)
try? realm.write {
study?.activitiesLocalNotificationUpdated = status
}
}
// MARK: - Activity
/// Saves Activities to DB.
/// - Parameter activities: Collection of `Activity` instances.
class func saveActivities(activities: [Activity]) {
let realm = DBHandler.getRealmObject()!
let study = Study.currentStudy
let dbActivityArray = realm.objects(DBActivity.self).filter({ $0.studyId == study?.studyId })
var dbActivities: [DBActivity] = []
var activityUpdated = false
for activity in activities {
var dbActivity: DBActivity?
if dbActivityArray.count != 0 {
dbActivity = dbActivityArray.filter({ $0.actvityId == activity.actvityId! }).last
if dbActivity == nil { // newly added activity
dbActivity = DBHandler.getDBActivity(activity: activity)
dbActivities.append(dbActivity!)
activityUpdated = true
} else {
// check if version is updated
if dbActivity?.version != activity.version {
try? realm.write {
realm.delete((dbActivity?.activityRuns)!)
realm.delete(dbActivity!)
}
let updatedActivity = DBHandler.getDBActivity(activity: activity)
dbActivities.append(updatedActivity)
DBHandler.deleteMetaDataForActivity(
activityId: activity.actvityId!,
studyId: activity.studyId!
)
activityUpdated = true
} else {
try? realm.write {
dbActivity?.currentRunId =
activity.userParticipationStatus
.activityRunId
dbActivity?.participationStatus =
activity.userParticipationStatus
.status.rawValue
dbActivity?.completedRuns =
activity.userParticipationStatus
.compeltedRuns
dbActivity?.state = activity.state
}
}
}
} else {
dbActivity = DBHandler.getDBActivity(activity: activity)
dbActivities.append(dbActivity!)
activityUpdated = true
}
}
// keys for alerts
if activityUpdated {
let ud = UserDefaults.standard
let halfCompletionKey = "50pcShown" + (Study.currentStudy?.studyId)!
let fullCompletionKey = "100pcShown" + (Study.currentStudy?.studyId)!
ud.set(false, forKey: halfCompletionKey)
ud.set(false, forKey: fullCompletionKey)
}
if dbActivities.count > 0 {
try? realm.write {
realm.add(dbActivities, update: .all)
}
}
}
/// Fetches DBActivity object from Database.
/// - Parameter activity: Instance of Activity to query from Database.
private class func getDBActivity(activity: Activity) -> DBActivity {
let dbActivity = DBActivity()
dbActivity.studyId = activity.studyId
dbActivity.actvityId = activity.actvityId
dbActivity.type = activity.type?.rawValue
dbActivity.name = activity.name
dbActivity.startDate = activity.startDate
dbActivity.endDate = activity.endDate
dbActivity.version = activity.version
dbActivity.state = activity.state
dbActivity.branching = activity.branching!
dbActivity.frequencyType = activity.frequencyType.rawValue
dbActivity.schedulingType = activity.schedulingType.rawValue
dbActivity.currentRunId = activity.userParticipationStatus.activityRunId
dbActivity.participationStatus = activity.userParticipationStatus.status.rawValue
dbActivity.completedRuns = activity.userParticipationStatus.compeltedRuns
dbActivity.id = activity.studyId! + activity.actvityId!
dbActivity.taskSubType = activity.taskSubType
let activityFrequencyDict = ["data": activity.frequencyRuns]
let frequencyRunsData = try? JSONSerialization.data(
withJSONObject: activityFrequencyDict,
options: JSONSerialization.WritingOptions.prettyPrinted
)
dbActivity.frequencyRunsData = frequencyRunsData
let activityAnchorDict = ["data": activity.anchorRuns]
let anchorRunsdata = try? JSONSerialization.data(
withJSONObject: activityAnchorDict,
options: JSONSerialization.WritingOptions.prettyPrinted
)
dbActivity.anchorRunsData = anchorRunsdata
// save overview
let dbActivityRuns = List<DBActivityRun>()
for activityRun in activity.activityRuns {
let dbActivityRun = DBActivityRun()
dbActivityRun.startDate = activityRun.startDate
dbActivityRun.endDate = activityRun.endDate
dbActivityRun.activityId = activity.actvityId
dbActivityRun.studyId = activity.studyId
dbActivityRun.runId = activityRun.runId
dbActivityRun.isCompleted = activityRun.isCompleted
dbActivityRuns.append(dbActivityRun)
}
// save anchor date
dbActivity.sourceType = activity.anchorDate?.sourceType
dbActivity.sourceActivityId = activity.anchorDate?.sourceActivityId
dbActivity.sourceKey = activity.anchorDate?.sourceKey
dbActivity.sourceFormKey = activity.anchorDate?.sourceFormKey
dbActivity.startDays = activity.anchorDate?.startDays ?? 0
dbActivity.startTime = activity.anchorDate?.startTime
dbActivity.endDays = activity.anchorDate?.endDays ?? 0
dbActivity.repeatInterval = activity.anchorDate?.repeatInterval ?? 0
dbActivity.endTime = activity.anchorDate?.endTime
dbActivity.activityRuns.append(objectsIn: dbActivityRuns)
return dbActivity
}
/// Updates Activity restoration data for the questionnaire.
/// - Parameters:
/// - activity: Activity instance for which restoration data to be updated.
/// - studyId: Study ID to query `Activity` object from DB.
/// - restortionData: Restoration data for the questionnaire.
class func updateActivityRestortionDataFor(
activity: Activity,
studyId: String,
restortionData: Data?
) {
let realm = DBHandler.getRealmObject()!
let dbActivities = realm.objects(DBActivityRun.self).filter {
$0.activityId == activity.actvityId
&& $0.studyId == studyId
&& $0.runId == activity.currentRun.runId
}
let dbActivity = dbActivities.last
try? realm.write {
dbActivity?.restortionData = restortionData
}
}
/// Updates activities lifetime from anchor date received from source activity questionnaire response.
/// - Parameters:
/// - studyId: StudyID to filter `DBActivity`.
/// - activityId: ActivityId to query target `DBActivity`.
/// - response: Response of the questionnaire.
/// - Returns: Boolean status of Activity lifetime update.
class func updateTargetActivityAnchorDateDetail(
studyId: String,
activityId: String,
response: [String: Any]
) -> Bool {
let realm = DBHandler.getRealmObject()!
let dbActivities = realm.objects(DBActivity.self)
.filter {
$0.sourceActivityId == activityId
&& $0.studyId == studyId
&& $0.startDate == nil
}
guard let dbActivity = dbActivities.last else {
return false
}
// get source question value and key
let results = response["results"] as! [[String: Any]]
var quesStepKey: String
var dictionary: [String: Any] = [:]
let sourceKey = (dbActivity.sourceKey)!
if dbActivity.sourceFormKey != nil && dbActivity.sourceFormKey!.count > 0 {
quesStepKey = dbActivity.sourceFormKey!
let quesResults = results.filter { $0["key"] as! String == quesStepKey }.first
let resultsArray = ((quesResults!["value"] as? [[Any]])?.first) as? [[String: Any]]
dictionary = resultsArray!.filter { $0["key"] as! String == sourceKey }.first!
} else {
dictionary = results.filter { $0["key"] as! String == sourceKey }.first!
}
guard let userInputDate = dictionary["value"] as? String else {
return false
}
let date = Utilities.getDateFromString(dateString: userInputDate)
for activity in dbActivities {
if let anchorDate = date {
self.updateActivityLifeTimeFor(activity, anchorDate: anchorDate)
}
}
if let anchorDate = date {
DBHandler.updateResourceLifeTime(
studyId,
activityId: activityId,
questionKey: sourceKey,
anchorDateValue: anchorDate
)
return true
}
return false
}
/// Updates anchor date in the Database for `DBActivity`.
/// - Parameters:
/// - dbActivity: Instance of `DBActivity` for which anchor date will be updated.
/// - anchorDate: Calculated anchor date.
class func updateActivityLifeTimeFor(_ dbActivity: DBActivity, anchorDate: Date) {
var date = anchorDate
let realm = DBHandler.getRealmObject()!
// update start date
var startDateStringEnrollment = Utilities.formatterShort?.string(from: date)
let startTimeEnrollment = "00:00:00"
startDateStringEnrollment = (startDateStringEnrollment ?? "") + " " + startTimeEnrollment
date = Utilities.findDateFromString(dateString: startDateStringEnrollment ?? "")!
let frequency = Frequency(rawValue: (dbActivity.frequencyType)!)!
let lifeTime = DBHandler.getLifeTime(
date,
frequency: frequency,
startDays: (dbActivity.startDays),
endDays: (dbActivity.endDays),
repeatInterval: (dbActivity.repeatInterval)
)
// update start date
var startDateString = Utilities.formatterShort?.string(from: lifeTime.0!)
let startTime = (dbActivity.startTime == nil) ? "00:00:00" : (dbActivity.startTime)!
startDateString = (startDateString ?? "") + " " + startTime
let startdate = Utilities.findDateFromString(dateString: startDateString ?? "")
// update end date
var endDateString = Utilities.formatterShort?.string(from: lifeTime.1!)
let endTime = (dbActivity.endTime == nil) ? "23:59:59" : (dbActivity.endTime)!
endDateString = (endDateString ?? "") + " " + endTime
let endDate = Utilities.findDateFromString(dateString: endDateString ?? "")
if startdate != nil && endDate != nil {
// calcuate runs for activity
let currentDate = DBHandler.getCurrentDateWithTimeDifference()
let activity = DBHandler.getActivityFromDBActivity(dbActivity, runDate: currentDate)
activity.startDate = startdate
activity.endDate = endDate
activity.anchorDate?.anchorDateValue = date
Schedule().getRunsForActivity(
activity: activity,
handler: { (runs) in
activity.activityRuns = runs
// save overview
let dbActivityRuns = List<DBActivityRun>()
for activityRun in activity.activityRuns {
let dbActivityRun = DBActivityRun()
dbActivityRun.startDate = activityRun.startDate
dbActivityRun.endDate = activityRun.endDate
dbActivityRun.activityId = activity.actvityId
dbActivityRun.studyId = activity.studyId
dbActivityRun.runId = activityRun.runId
dbActivityRun.isCompleted = activityRun.isCompleted
dbActivityRuns.append(dbActivityRun)
}
try? realm.write {
dbActivity.activityRuns.append(objectsIn: dbActivityRuns)
dbActivity.startDate = startdate
dbActivity.endDate = endDate
dbActivity.anchorDateValue = date
}
}
)
}
}
/// This method will calculate lifetime of Activity.
/// - Parameters:
/// - date: Anchor date of the `Activity`.
/// - frequency: Frequency of `Activity`.
/// - startDays: Number of days to calculate start date from Anchor date.
/// - endDays: Number of days to calculate end date for **OneTime frequency** `Activity` from Anchor date.
/// - repeatInterval: To calculate end date for **Daily, Weekly, Monthly** frequencies `Activity` from Anchor date.
/// - Returns: Start date and End date.
private class func getLifeTime(
_ date: Date,
frequency: Frequency,
startDays: Int,
endDays: Int,
repeatInterval: Int
) -> (Date?, Date?) {
var startDate: Date!
var endDate: Date!
switch frequency {
case .One_Time:
let startDateInterval = TimeInterval(60 * 60 * 24 * (startDays))
let endDateInterval = TimeInterval(60 * 60 * 24 * (endDays))
startDate = date.addingTimeInterval(startDateInterval)
endDate = date.addingTimeInterval(endDateInterval)
case .Daily:
let startDateInterval = TimeInterval(60 * 60 * 24 * (startDays))
let endDateInterval = TimeInterval(60 * 60 * 24 * (repeatInterval))
startDate = date.addingTimeInterval(startDateInterval)
endDate = startDate.addingTimeInterval(endDateInterval)
case .Weekly:
let startDateInterval = TimeInterval(60 * 60 * 24 * (startDays))
let endDateInterval = TimeInterval(60 * 60 * 24 * 7 * (repeatInterval))
startDate = date.addingTimeInterval(startDateInterval)
endDate = startDate.addingTimeInterval(endDateInterval)
case .Monthly:
let startDateInterval = TimeInterval(60 * 60 * 24 * (startDays))
startDate = date.addingTimeInterval(startDateInterval)
let calender = Calendar.current
endDate = calender.date(byAdding: .month, value: (repeatInterval), to: startDate)
case .Scheduled:
let startDateInterval = TimeInterval(60 * 60 * 24 * (startDays))
let endDateInterval = TimeInterval(60 * 60 * 24 * (endDays))
startDate = date.addingTimeInterval(startDateInterval)
endDate = date.addingTimeInterval(endDateInterval)
}
return (startDate, endDate)
}
/// This method will calculate the collection of `Activity` with `nil` anchor date.
/// - Parameter studyId: StudyID to query `DBActivity` objects.
class func getActivitiesWithEmptyAnchorDateValue(_ studyId: String) -> [DBActivity] {
let realm = DBHandler.getRealmObject()!
let dbActivities: [DBActivity] = realm.objects(DBActivity.self)
.filter {
$0.studyId == studyId
&& $0.anchorDateValue == nil
&& $0.sourceType == "ActivityResponse"
}
return dbActivities
}
/// Updates `Activity` meta data to DB.
/// - Parameter activity: Instance of `Activity` to query `DBActivity` object.
class func updateActivityMetaData(activity: Activity) {
let realm = DBHandler.getRealmObject()!
let dbActivities = realm.objects(DBActivity.self)
.filter {
$0.actvityId == activity.actvityId
&& $0.studyId == activity.studyId
}
let dbActivity = dbActivities.last
try? realm.write {
dbActivity?.shortName = activity.shortName
}
}
/// Loads activity collection from DB for the study provided.
/// - Parameters:
/// - studyId: StudyID to query related `DBActivity` object.
/// - completionHandler: Returns the collection of `Activity` instances.
class func loadActivityListFromDatabase(
studyId: String,
completionHandler: @escaping ([Activity]) -> Void
) {
let realm = DBHandler.getRealmObject()!
let dbActivities = realm.objects(DBActivity.self)
.filter {
$0.studyId == studyId
&& $0.startDate != nil
}
let date = DBHandler.getCurrentDateWithTimeDifference()
var activities: [Activity] = []
dbActivities.forEach { (activity) in
let activity = DBHandler.getActivityFromDBActivity(activity, runDate: date)
activities.append(activity)
}
completionHandler(activities)
}
private class func getCurrentDateWithTimeDifference() -> Date {
var date = Date().utcDate()
let difference = UserDefaults.standard.value(forKey: "offset") as? Int
if difference != nil {
date = date.addingTimeInterval(TimeInterval(difference!))
}
return date
}
/// This method is the query unmanaged `Activity` instance from `DBActivity` object for particular run date.
/// - Parameters:
/// - dbActivity: Instance of `DBActivity`.
/// - date: Run data,
private class func getActivityFromDBActivity(_ dbActivity: DBActivity, runDate date: Date)
-> Activity
{
// create activity instance
let activity = Activity()
activity.actvityId = dbActivity.actvityId
activity.studyId = dbActivity.studyId
activity.name = dbActivity.name
activity.startDate = dbActivity.startDate
activity.endDate = dbActivity.endDate
activity.type = ActivityType(rawValue: dbActivity.type!)
activity.frequencyType = Frequency(rawValue: dbActivity.frequencyType!)!
activity.schedulingType = ActivityScheduleType(rawValue: dbActivity.schedulingType!)!
activity.totalRuns = dbActivity.activityRuns.count
activity.version = dbActivity.version
activity.branching = dbActivity.branching
activity.state = dbActivity.state
activity.taskSubType = dbActivity.taskSubType
let frequencyRuns =
try? JSONSerialization.jsonObject(
with: dbActivity.frequencyRunsData!,
options: []
) as? JSONDictionary
activity.frequencyRuns = frequencyRuns?["data"] as? [JSONDictionary]
let anchorRuns =
try? JSONSerialization.jsonObject(
with: dbActivity.anchorRunsData!,
options: []
) as? JSONDictionary
activity.anchorRuns = anchorRuns?["data"] as? [JSONDictionary]
if activity.totalRuns != 0 {
// create activity run
var runs: [ActivityRun] = []
dbActivity.activityRuns.forEach { runs.append(ActivityRun(dbActivityRun: $0)) }
activity.activityRuns = runs
var runsBeforeToday: [ActivityRun]! = []
var run: ActivityRun!
if activity.frequencyType == Frequency.One_Time && activity.endDate == nil {
run = runs.last
} else {
runsBeforeToday = runs.filter({ $0.endDate <= date })
run =
runs.filter {
$0.startDate <= date
&& $0.endDate > date
}.first // current run
}
let completedRuns = runs.filter { $0.isCompleted == true }
activity.compeltedRuns = completedRuns.count
activity.currentRunId = (run != nil) ? (run?.runId)! : runsBeforeToday.count
activity.currentRun = run
activity.compeltedRuns = dbActivity.completedRuns
}
let userStatus = UserActivityStatus()
userStatus.activityId = dbActivity.actvityId
userStatus.activityRunId = String(activity.currentRunId)
userStatus.studyId = dbActivity.studyId
if String(activity.currentRunId) == dbActivity.currentRunId {
userStatus.status = UserActivityStatus.ActivityStatus(
rawValue: dbActivity.participationStatus
)!
}
userStatus.compeltedRuns = activity.compeltedRuns
userStatus.incompletedRuns = activity.incompletedRuns
userStatus.totalRuns = activity.totalRuns
let incompleteRuns = activity.currentRunId - activity.compeltedRuns
activity.incompletedRuns =
((incompleteRuns < 0) || activity.totalRuns == 0)
? 0 : incompleteRuns
if activity.currentRun == nil {
userStatus.status = UserActivityStatus.ActivityStatus.abandoned
} else {
if userStatus.status != UserActivityStatus.ActivityStatus.completed {
var incompleteRuns = activity.currentRunId - activity.compeltedRuns
incompleteRuns -= 1
activity.incompletedRuns = (incompleteRuns < 0) ? 0 : incompleteRuns
}
}
activity.userParticipationStatus = userStatus
// append to user class participatesStudies also
let activityStatus = User.currentUser.participatedActivites.filter({
$0.activityId == activity.actvityId && $0.studyId == activity.studyId
}).first
let index = User.currentUser.participatedActivites
.firstIndex(
where: {
$0.activityId == activity.actvityId
&& $0.studyId == activity.studyId
})
if activityStatus != nil {
User.currentUser.participatedActivites[index!] = userStatus
} else {
User.currentUser.participatedActivites.append(userStatus)
}
// save anchor date
let anchorDate = AnchorDate()
anchorDate.sourceType = dbActivity.sourceType
anchorDate.sourceActivityId = dbActivity.sourceActivityId
anchorDate.sourceKey = dbActivity.sourceKey
anchorDate.sourceFormKey = dbActivity.sourceFormKey
anchorDate.startDays = dbActivity.startDays
anchorDate.startTime = dbActivity.startTime
anchorDate.endDays = dbActivity.endDays
anchorDate.repeatInterval = dbActivity.repeatInterval
anchorDate.endTime = dbActivity.endTime
activity.anchorDate = anchorDate
return activity
}
/// Loads studyRuns and returns completion and adherence for the runs.
/// - Parameters:
/// - studyId: studyId to query runs from DB.
/// - completionHandler: completionHandler description.
class func loadAllStudyRuns(
studyId: String,
completionHandler: @escaping (_ completion: Int, _ adherence: Int) -> Void
) {
let date = Date()
let realm = DBHandler.getRealmObject()!
let studyRuns = realm.objects(DBActivityRun.self).filter("studyId == %@", studyId)
let completedRuns = studyRuns.filter({ $0.isCompleted == true })
let runsBeforeToday = studyRuns.filter({ ($0.endDate == nil) || ($0.endDate <= date) })
var incompleteRuns = runsBeforeToday.count - completedRuns.count
if incompleteRuns < 0 {
incompleteRuns = 0
}
let completion = ceil(
Double(
self.divide(lhs: (completedRuns.count + incompleteRuns) * 100, rhs: studyRuns.count)
)
)
let adherence = ceil(
Double(
self.divide(
lhs: (completedRuns.count) * 100,
rhs: (completedRuns.count + incompleteRuns)
)
)
)
completionHandler(Int(completion), Int(adherence))
}
static func divide(lhs: Int, rhs: Int) -> Int {
if rhs == 0 {
return 0
}
return lhs / rhs
}
/// Saves ActivityRuns to DB
/// - Parameters:
/// - activityId: ActivityID of the `DBActivity` for which `ActivityRun` to be updated.
/// - studyId: StudyIdID of the `DBActivity` for which `ActivityRun` to be updated.
/// - runs: Collection of `ActivityRun` to save in DB.
class func saveActivityRuns(activityId: String, studyId: String, runs: [ActivityRun]) {
let realm = DBHandler.getRealmObject()!
let dbActivities = realm.objects(DBActivity.self).filter(
"studyId == %@ && actvityId == %@",
studyId,
activityId
)
let dbActivity = dbActivities.last
// save overview
let dbActivityRuns = List<DBActivityRun>()
for sectionIndex in 0...(runs.count - 1) {
let activityRun = runs[sectionIndex]
let dbActivityRun = DBActivityRun()
dbActivityRun.startDate = activityRun.startDate
dbActivityRun.endDate = activityRun.endDate
dbActivityRun.activityId = activityId
dbActivityRun.studyId = studyId
dbActivityRun.runId = activityRun.runId
dbActivityRun.isCompleted = activityRun.isCompleted
dbActivityRuns.append(dbActivityRun)
}
try? realm.write {
dbActivity?.activityRuns.append(objectsIn: dbActivityRuns)
}
}
/// This method marks the `DBActivityRun` object status as completed.
/// - Parameters:
/// - runId: RunID to query corresponding `DBActivityRun`.
/// - activityId: ActivityID to query corresponding `DBActivityRun`.
/// - studyId: StudyID to query corresponding `DBActivityRun`.
class func updateRunToComplete(runId: Int, activityId: String, studyId: String) {
let realm = DBHandler.getRealmObject()!
let dbRuns = realm.objects(DBActivityRun.self).filter(
"studyId == %@ && activityId == %@ && runId == %d",
studyId,
activityId,
runId
)
let dbRun = dbRuns.last
try? realm.write {
dbRun?.isCompleted = true
}
}
/// This method will update the participation status of `Activity` in DB.
/// - Parameter activity: Instance of `Activity` to query related `DBActivity` object from DB..
class func updateParticipationStatus(for activity: Activity) {
let realm = DBHandler.getRealmObject()!
let studies = realm.objects(DBActivity.self)
.filter {
$0.actvityId == activity.actvityId
&& $0.studyId == activity.studyId
}
let dbActivity = studies.last
try? realm.write {
dbActivity?.currentRunId = activity.userParticipationStatus.activityRunId
dbActivity?.participationStatus = activity.userParticipationStatus.status.rawValue
dbActivity?.completedRuns = activity.compeltedRuns
}
}
/// Saves the Request Information for the missed requests due to network failure for offline support.
/// - Parameters:
/// - params: Request params.
/// - headers: Request Headers.
/// - method: Method type.
/// - server: Server endpoint.
class func saveRequestInformation(
params: [String: Any]?,
headers: [String: Any]?,
method: String,
server: String
) {
let realm = DBHandler.getRealmObject()!
let dataSync = DBDataOfflineSync()
if params != nil {
let paramData = try? JSONSerialization.data(
withJSONObject: params!,
options: JSONSerialization.WritingOptions.prettyPrinted
)
dataSync.requestParams = paramData
}
if headers != nil {
let headerData = try? JSONSerialization.data(
withJSONObject: headers!,
options: JSONSerialization.WritingOptions.prettyPrinted
)
dataSync.headerParams = headerData
}
dataSync.method = method
dataSync.server = server
dataSync.date = Date()
try? realm.write {
realm.add(dataSync)
}
}
/// This method queries if there's any failed request exist in the DB.
/// - Parameter completionHandler: Boolean to indicate failed request in the DB.
class func isDataAvailableToSync(completionHandler: @escaping (Bool) -> Void) {
let realm = DBHandler.getRealmObject()!
let dbRuns = realm.objects(DBDataOfflineSync.self)
if dbRuns.count > 0 {
completionHandler(true)
} else {
completionHandler(false)
}
}
/// fetches completion and adherence for the Study Id from DB.
/// - Parameters:
/// - studyId: studyId description.
/// - completionHandler: completionHandler description.
class func getCompletion(
studyId: String,
completionHandler: @escaping (_ completion: Int, _ adherence: Int) -> Void
) {
let realm = DBHandler.getRealmObject()!
let dbActivities = realm.objects(DBActivity.self).filter("studyId == %@", studyId)
if dbActivities.count <= 0 {
completionHandler(-1, -1)
return
}
var date = Date().utcDate()
let difference = UserDefaults.standard.value(forKey: "offset") as? Int
if difference != nil {
date = date.addingTimeInterval(TimeInterval(difference!))
}
var totalStudyRuns = 0
var totalCompletedRuns = 0
var totalIncompletedRuns = 0
for dbActivity in dbActivities {
let runs = dbActivity.activityRuns
var run: DBActivityRun!
var runsBeforeToday: [DBActivityRun]! = []
if dbActivity.endDate == nil {
run = runs.last
} else {
runsBeforeToday = runs.filter({ $0.endDate <= date })
let firstRun: [DBActivityRun] = runs.filter {
$0.startDate <= date && $0.endDate > date
}
run = firstRun.first
}
let currentRunId = (run != nil) ? (run?.runId)! : runsBeforeToday.count
let completedRuns = dbActivity.completedRuns
var incompleteRuns = currentRunId - completedRuns
incompleteRuns = (incompleteRuns < 0) ? 0 : incompleteRuns
var participationStatus: UserActivityStatus.ActivityStatus = .yetToJoin
if String(currentRunId) == dbActivity.currentRunId {
participationStatus = UserActivityStatus.ActivityStatus(
rawValue: dbActivity.participationStatus
)!
}
if participationStatus != UserActivityStatus.ActivityStatus.completed && run != nil {
incompleteRuns = currentRunId - completedRuns
incompleteRuns -= 1
incompleteRuns = (incompleteRuns < 0) ? 0 : incompleteRuns
}
let totalRuns = runs.count
// update values
totalStudyRuns += totalRuns
totalIncompletedRuns += incompleteRuns
totalCompletedRuns += completedRuns
}
let completion = ceil(
Double(
self.divide(
lhs: (totalCompletedRuns + totalIncompletedRuns) * 100,
rhs: totalStudyRuns
)
)
)
completionHandler(Int(completion), 0)
}
// MARK: - Activity MetaData
/// This method will add Meta Data for `Activity` in DB.
/// - Parameters:
/// - activity: Instance of `Activity` for which the Meta Data is going to be added in DB.
/// - data: Data in form of `JSONDictionary`,
class func saveActivityMetaData(activity: Activity, data: [String: Any]) {
let realm = DBHandler.getRealmObject()!
let dbMetaData = DBActivityMetaData()
dbMetaData.actvityId = activity.actvityId
dbMetaData.studyId = activity.studyId
let metaData = try? JSONSerialization.data(
withJSONObject: data,
options: JSONSerialization.WritingOptions.prettyPrinted
)
dbMetaData.metaData = metaData
try? realm.write {
realm.add(dbMetaData)
}
}
/// Fetches activityMeta data from DB, updates the activityBuilder instance and returns a Bool.
/// - Parameters:
/// - activity: Instance of `Activity` to query `DBActivityMetaData` object from DB.
/// - completionHandler: Returns Bool indicating meta data availability in DB.
class func loadActivityMetaData(activity: Activity, completionHandler: @escaping (Bool) -> Void) {
let realm = DBHandler.getRealmObject()!
let dbMetaData = realm.objects(DBActivityMetaData.self)
.filter {
$0.actvityId == activity.actvityId
&& $0.studyId == activity.studyId
}.last
if let metaData = dbMetaData?.metaData,
let response = try? JSONSerialization.jsonObject(with: metaData, options: [])
as? [String: Any]
{
Study.currentActivity?.setActivityMetaData(
activityDict: response[kActivity] as! [String: Any]
)
if Utilities.isValidObject(someObject: Study.currentActivity?.steps as AnyObject?) {
ActivityBuilder.currentActivityBuilder = ActivityBuilder()
ActivityBuilder.currentActivityBuilder.initWithActivity(
activity: Study.currentActivity!
)
}
completionHandler(true)
} else {
completionHandler(false)
}
}
/// This method will delete the meta data from Db for `Activity`.
/// - Parameters:
/// - activityId: ActivityId to query `DBActivityMetaData` from DB.
/// - studyId: SudyID to query `DBActivityMetaData` from DB.
class func deleteMetaDataForActivity(activityId: String, studyId: String) {
let realm = DBHandler.getRealmObject()!
let dbMetaDataList = realm.objects(DBActivityMetaData.self)
.filter { $0.actvityId == activityId && $0.studyId == studyId }
if let metaData = dbMetaDataList.last {
try? realm.write {
realm.delete(metaData)
}
}
}
// MARK: - Dashboard - Statistics
/// Saves the dashboard Stats to Database.
/// - Parameters:
/// - studyId: StudyID which contains `Activity`.
/// - statistics: Collection of `DashboardStatistics` instances which is to be added to DB.
class func saveDashBoardStatistics(studyId: String, statistics: [DashboardStatistics]) {
let realm = DBHandler.getRealmObject()!
let dbStatisticsArray = realm.objects(DBStatistics.self)
.filter { $0.studyId == studyId }
var oldStatsDict = dbStatisticsArray.reduce(into: [DBStatistics: Bool]()) {
$0[$1] = false // Consider them not active here.
}
for stat in statistics {
if let dbStat = dbStatisticsArray.first(where: { $0.statisticsId == stat.statisticsId }) {
let updatedStat = DBHandler.getDBStatistics(stats: stat)
oldStatsDict[dbStat] = true // Stat is still active.
let statData = dbStat.statisticsData
try? realm.write {
updatedStat.statisticsData = statData
realm.add(updatedStat, update: .modified)
}
} else {
let newDbStat = DBHandler.getDBStatistics(stats: stat)
try? realm.write {
realm.add(newDbStat, update: .all)
}
}
}
// Remove the deleted stats from database.
let inactiveStats = oldStatsDict.filter({ $0.value == false }).compactMap({ $0.key })
inactiveStats.forEach { (dbStat) in
try? realm.write {
realm.delete(dbStat.statisticsData)
realm.delete(dbStat)
}
}
}
/// Creates an managed instance of DBStatistics from DashboardStatistics.
/// - Parameter stats: Instance of `DashboardStatistics` to update properties of `DBStatistics`.
private class func getDBStatistics(stats: DashboardStatistics) -> DBStatistics {
let dbStatistics = DBStatistics()
dbStatistics.activityId = stats.activityId
dbStatistics.activityVersion = stats.activityVersion
dbStatistics.calculation = stats.calculation
dbStatistics.dataSourceKey = stats.dataSourceKey
dbStatistics.dataSourceType = stats.dataSourceType
dbStatistics.displayName = stats.displayName
dbStatistics.title = stats.title
dbStatistics.statType = stats.statType
dbStatistics.studyId = stats.studyId
dbStatistics.unit = stats.unit
dbStatistics.statisticsId = stats.studyId! + stats.title!
return dbStatistics
}
/// Fetches stats for the study provided and returns collection of DashboardStatistics
/// - Parameters:
/// - studyId: studyId to query `DBStatistics` object from DB.
/// - completionHandler: Returns collection of `DashboardStatistics`instances.
class func loadStatisticsForStudy(
studyId: String,
completionHandler: @escaping ([DashboardStatistics]) -> Void
) {
let realm = DBHandler.getRealmObject()!
let dbStatisticsList = realm.objects(DBStatistics.self).filter("studyId == %@", studyId)
var statsList: [DashboardStatistics] = []
dbStatisticsList.forEach { statsList.append(DashboardStatistics(dbStatistics: $0)) }
completionHandler(statsList)
}
// MARK: - Dashboard - Charts
/// Adds/Updates `DBCharts` for the study in DB.
/// - Parameters:
/// - studyId: StudyID for the Charts.
/// - charts: Collection of `DashboardCharts` instances to create/update objects of `DBCharts` in DB.
class func saveDashBoardCharts(studyId: String, charts: [DashboardCharts]) {
let realm = DBHandler.getRealmObject()!
let dbChartsArray = realm.objects(DBCharts.self).filter { $0.studyId == studyId }
var oldChartsDict = dbChartsArray.reduce(into: [DBCharts: Bool]()) {
$0[$1] = false // Consider them not active here.
}
for chart in charts {
if let dbChart = dbChartsArray.first(where: { $0.chartId == chart.chartId }) {
let chartData = dbChart.statisticsData
let updatedChart = DBHandler.getDBChart(chart: chart)
oldChartsDict[dbChart] = true // Chart is still active.
try? realm.write {
updatedChart.statisticsData = chartData
realm.add(updatedChart, update: .modified)
}
} else {
let newDbChart = DBHandler.getDBChart(chart: chart)
try? realm.write {
realm.add(newDbChart, update: .all)
}
}
}
// Remove the deleted charts from database.
let inactiveCharts = oldChartsDict.filter({ $0.value == false }).compactMap({ $0.key })
inactiveCharts.forEach { (dbChart) in
try? realm.write {
realm.delete(dbChart.statisticsData)
realm.delete(dbChart)
}
}
}
/// Creates an instance of DBCharts from DashboardCharts.
/// - Parameter chart: Instance of `DashboardCharts`.
private class func getDBChart(chart: DashboardCharts) -> DBCharts {
let dbChart = DBCharts()
dbChart.activityId = chart.activityId
dbChart.activityVersion = chart.activityVersion
dbChart.chartType = chart.chartType
dbChart.chartSubType = chart.chartSubType
dbChart.dataSourceTimeRange = chart.dataSourceTimeRange
dbChart.dataSourceKey = chart.dataSourceKey
dbChart.dataSourceType = chart.dataSourceType
dbChart.displayName = chart.displayName
dbChart.title = chart.title
dbChart.scrollable = chart.scrollable
dbChart.studyId = chart.studyId
dbChart.chartId =
chart.studyId! + (chart.activityId ?? "") + chart
.dataSourceKey!
return dbChart
}
/// Loads `DashboardCharts` for Study from DB.
/// - Parameters:
/// - studyId: StudyID to query `DBCharts` object from DB.
/// - completionHandler: Returns Instance of DashboardCharts.
class func loadChartsForStudy(
studyId: String,
completionHandler: @escaping ([DashboardCharts]) -> Void
) {
let realm = DBHandler.getRealmObject()!
let dbChartList = realm.objects(DBCharts.self).filter("studyId == %@", studyId)
var chartList: [DashboardCharts] = []
dbChartList.forEach { chartList.append(DashboardCharts(dbChart: $0)) }
completionHandler(chartList)
}
/// Saves Statistics data for actvity into DB.
/// - Parameters:
/// - activityId: ActivityID for which stats to be saved.
/// - key: Key for which the stats to be saved.
/// - data: Data value to be stored.
/// - fkDuration: Exclusively to be used for fetal kick task.
/// - date: Date of submission of response.
class func saveStatisticsDataFor(
activityId: String,
key: String,
data: Float,
fkDuration: Int,
date: Date
) {
let realm = DBHandler.getRealmObject()!
let dbStatisticsList = realm.objects(DBStatistics.self).filter(
"activityId == %@ && dataSourceKey == %@",
activityId,
key
)
let dbChartsList = realm.objects(DBCharts.self).filter(
"activityId == %@ && dataSourceKey == %@",
activityId,
key
)
let dbStatistics = dbStatisticsList.last
let dbChart = dbChartsList.last
//save data
let statData = DBStatisticsData()
statData.startDate = date
statData.data = data
statData.fkDuration = fkDuration
try? realm.write {
if dbStatistics != nil {
dbStatistics?.statisticsData.append(statData)
}
if dbChart != nil {
dbChart?.statisticsData.append(statData)
}
}
}
/// Fetches data source keys needed to get DBstats from Server.
/// - Parameters:
/// - studyId: studyId to query corresponding`DBStatistics` objects from DB.
/// - completionHandler: `Array` of ActivityId and Keys value stored in `Dictionary`.
class func getDataSourceKeyForActivity(
studyId: String,
completionHandler: @escaping ([[String: String]]) -> Void
) {
let realm = DBHandler.getRealmObject()!
let dbStatisticsList = realm.objects(DBStatistics.self).filter { $0.studyId == studyId }
let dbChartsList = realm.objects(DBCharts.self).filter { $0.studyId == studyId }
let statActivities: [String] = dbStatisticsList.compactMap { $0.activityId! }
let chartActivities: [String] = dbChartsList.compactMap { $0.activityId! }
let set1 = Set(statActivities)
let set2 = Set(chartActivities)
let allActivities = set1.union(set2)
var activityAndQuestionKeys: [[String: String]] = []
for activityId in allActivities {
let statList = dbStatisticsList.filter({ $0.activityId == activityId })
let chatList = dbChartsList.filter({ $0.activityId == activityId })
let statsKeys = statList.compactMap { $0.dataSourceKey }
let chartKeys = chatList.compactMap { $0.dataSourceKey }
var keys: [String] = []
for key in statsKeys {
if !keys.contains(key) {
keys.append(key)
}
}
for key in chartKeys {
if !keys.contains(key) {
keys.append(key)
}
}
let keyString = keys.joined(separator: ",")
let dict =
[
"activityId": activityId,
"keys": keyString,
] as [String: String]
activityAndQuestionKeys.append(dict)
}
return completionHandler(activityAndQuestionKeys)
}
// MARK: - RESOURCES
/// Saves Resources for Study To DB
/// - Parameters:
/// - studyId: StudyId of the `Resource`.
/// - resources: Collection of `Resource` instances to create `DBResources` objects in DB.
class func saveResourcesForStudy(studyId: String, resources: [Resource]) {
let realm = DBHandler.getRealmObject()!
let dbResourcesArray = realm.objects(DBResources.self).filter { $0.studyId == studyId }
var dbResourcesList: [DBResources] = []
for resource in resources {
var dbResource: DBResources?
if dbResourcesArray.count != 0 {
dbResource = dbResourcesArray.filter { $0.resourceId == resource.resourcesId }.last
if dbResource == nil {
dbResource = DBHandler.getDBResource(resource: resource)
dbResource?.studyId = studyId
dbResourcesList.append(dbResource!)
} else {
try? realm.write {
dbResource?.title = resource.title
dbResource?.audience = resource.audience?.rawValue
dbResource?.endDate = resource.endDate
dbResource?.startDate = resource.startDate
dbResource?.key = resource.key
dbResource?.povAvailable = resource.povAvailable
dbResource?.serverUrl = resource.file?.link
dbResource?.level = resource.level?.rawValue
dbResource?.notificationMessage = resource.notificationMessage
if resource.povAvailable {
dbResource?.anchorDateEndDays = resource.anchorDateEndDays!
dbResource?.anchorDateStartDays = resource.anchorDateStartDays!
}
}
}
} else {
dbResource = DBHandler.getDBResource(resource: resource)
dbResource?.studyId = studyId
dbResourcesList.append(dbResource!)
}
}
let newlist = resources
let dbResourceIds: [String] = dbResourcesArray.compactMap { $0.resourceId! }
let resourceIds: [String] = newlist.compactMap { $0.resourcesId! }
let dbset: Set<String> = Set(dbResourceIds)
let set: Set<String> = Set(resourceIds)
let toBeDelete = dbset.subtracting(set)
for aId in toBeDelete {
let dbResource = dbResourcesArray.filter { $0.resourceId == aId }.last
try? realm.write {
realm.delete(dbResource!)
}
}
if dbResourcesList.count > 0 {
try? realm.write {
realm.add(dbResourcesList, update: .all)
}
}
}
/// This method will create object of `DBResources`.
/// - Parameter resource: Instance of `Resource` to initialize `DBResources` properties in DB.
/// - Returns: Instance of managed `DBResources` object.
private class func getDBResource(resource: Resource) -> DBResources {
let dbResource = DBResources()
dbResource.resourceId = resource.resourcesId
dbResource.resourceType = resource.resourceType
dbResource.title = resource.title
dbResource.audience = resource.audience?.rawValue
dbResource.endDate = resource.endDate
dbResource.startDate = resource.startDate
dbResource.key = resource.key
dbResource.povAvailable = resource.povAvailable
dbResource.serverUrl = resource.file?.link
dbResource.level = resource.level?.rawValue
dbResource.type = resource.type
dbResource.notificationMessage = resource.notificationMessage
if resource.povAvailable {
dbResource.anchorDateEndDays = resource.anchorDateEndDays!
dbResource.anchorDateStartDays = resource.anchorDateStartDays!
}
dbResource.availabilityType = resource.availabilityType.rawValue
dbResource.sourceType = resource.sourceType?.rawValue
dbResource.sourceActivityId = resource.sourceActivityId
dbResource.sourceKey = resource.sourceKey
dbResource.sourceFormKey = resource.sourceFormKey
dbResource.startTime = resource.startTime
dbResource.endTime = resource.endTime
return dbResource
}
/// This method will query `DBResources` objects from DB with no Anchor Dates.
/// - Parameter studyId: StudyId to query associated `DBResources` from DB.
class func getResourceWithEmptyAnchorDateValue(_ studyId: String) -> [DBResources] {
let realm = DBHandler.getRealmObject()!
let dbResources: [DBResources] = realm.objects(DBResources.self)
.filter {
$0.studyId == studyId
&& $0.startDate == nil
&& $0.sourceType == "ActivityResponse"
}
return dbResources
}
/// This method checks if any Activity is available in DB from a Study.
/// - Parameter studyId: StudyId to query `DBActivity` objects in DB.
/// - Returns: Boolean indicating activity in DB for passed StudyID.
class func isActivitiesEmpty(_ studyId: String) -> Bool {
let realm = DBHandler.getRealmObject()!
return
realm.objects(DBActivity.self)
.filter { $0.studyId == studyId }.count == 0
}
/// This method checks if any Resource is available in DB from a Study.
/// - Parameter studyId: StudyId to query `DBResources` objects in DB.
/// - Returns: Boolean indicating `Resource` in DB for passed StudyID.
class func isResourcesEmpty(_ studyId: String) -> Bool {
let realm = DBHandler.getRealmObject()!
return realm.objects(DBResources.self).filter({ $0.studyId == studyId }).count == 0
}
/// Loads resources for study from DB
/// - Parameters:
/// - studyId: StudyId to query `DBResources` objects in DB.
/// - completionHandler: Returns Collection of unmanaged `Resource` instances.
class func loadResourcesForStudy(
studyId: String,
completionHandler: @escaping ([Resource]) -> Void
) {
let realm = DBHandler.getRealmObject()!
let dbResourceList = realm.objects(DBResources.self)
.filter {
$0.studyId == studyId
&& ($0.povAvailable == false
|| $0.startDate != nil)
}
var resourceList: [Resource] = []
dbResourceList.forEach { resourceList.append(Resource(dbResource: $0)) }
completionHandler(resourceList)
}
/// This method queries `DBResources` objects from DB with Anchor date != nil.
/// - Parameters:
/// - studyId: StudyID to query associated Resources from DB.
/// - completionHandler: Returns collection of `DBResources` instances.
class func getResourcesWithAnchorDateAvailable(
studyId: String,
completionHandler: @escaping ([DBResources]) -> Void
) {
let realm = DBHandler.getRealmObject()!
let dbResourceList: [DBResources] = realm.objects(DBResources.self)
.filter { $0.studyId == studyId && $0.povAvailable == true }
completionHandler(dbResourceList)
}
/// This method queries resources with availablity and no startDate.
/// - Parameters:
/// - studyId: StudyID to query associated Resources from DB.
/// - activityId: activityId to query associated Resources from DB.
/// - questionKey: questionKey description
class func resourceListFor(_ studyId: String, activityId: String?, questionKey: String?)
-> [DBResources]
{
let realm = DBHandler.getRealmObject()!
var dbResourceList: [DBResources] = realm.objects(DBResources.self)
.filter {
$0.studyId == studyId
&& $0.povAvailable == true
&& $0.startDate == nil
}
if activityId != nil {
dbResourceList = dbResourceList.filter { $0.sourceActivityId == activityId }
}
if questionKey != nil {
dbResourceList = dbResourceList.filter { $0.sourceKey == questionKey }
}
return dbResourceList
}
/// This method will update
/// - Parameters:
/// - studyId:
/// - activityId:
/// - questionKey:
/// - anchorDateValue:
@discardableResult
class func updateResourceLifeTime(
_ studyId: String,
activityId: String?,
questionKey: String?,
anchorDateValue: Date
) -> (Bool) {
let resourceList = DBHandler.resourceListFor(
studyId,
activityId: activityId,
questionKey: questionKey
)
var startDateStringEnrollment = Utilities.formatterShort?.string(from: anchorDateValue)
let startTimeEnrollment = "00:00:00"
startDateStringEnrollment = (startDateStringEnrollment ?? "") + " " + startTimeEnrollment
let anchorDate = Utilities.findDateFromString(dateString: startDateStringEnrollment ?? "")
var resourceUpdatedStatus = false
for resource in resourceList {
resourceUpdatedStatus = true
self.saveLifeTimeFor(resource: resource, anchorDate: anchorDate!)
}
return resourceUpdatedStatus
}
class func saveLifeTimeFor(resource: DBResources, anchorDate: Date) {
let realm = DBHandler.getRealmObject()!
let startDateInterval = TimeInterval(60 * 60 * 24 * (resource.anchorDateStartDays)) // start of day
let endDateInterval = TimeInterval(60 * 60 * 24 * (resource.anchorDateEndDays + 1) - 1) // end of day
var startDate = anchorDate.addingTimeInterval(startDateInterval)
var endDate = anchorDate.addingTimeInterval(endDateInterval)
// update start date
var startDateString = Utilities.formatterShort?.string(from: startDate)
let startTime = (resource.startTime == nil) ? "00:00:00" : (resource.startTime)!
startDateString = (startDateString ?? "") + " " + startTime
startDate = Utilities.findDateFromString(dateString: startDateString ?? "")!
// update end date
var endDateString = Utilities.formatterShort?.string(from: endDate)
let endTime = (resource.endTime == nil) ? "23:59:59" : (resource.endTime)!
endDateString = (endDateString ?? "") + " " + endTime
endDate = Utilities.findDateFromString(dateString: endDateString ?? "")!
try? realm.write {
resource.startDate = startDate
resource.endDate = endDate
}
}
class func activitiesWithAnchorDateAvailable(
studyId: String,
completionHandler: @escaping (Bool) -> Void
) {
let realm = DBHandler.getRealmObject()!
let dbActivities = realm.objects(DBActivity.self).filter({
$0.studyId == studyId && $0.startDate != nil && $0.anchorDateValue != nil
})
var anchorDateAvailable = false
for activity in dbActivities {
anchorDateAvailable = DBHandler.updateResourceLifeTime(
studyId,
activityId: activity.sourceActivityId,
questionKey: activity.sourceKey,
anchorDateValue: activity.anchorDateValue!
)
}
completionHandler(anchorDateAvailable)
}
class func updateResourceLocalPath(resourceId: String, path: String) {
let realm = DBHandler.getRealmObject()!
let dbResource = realm.objects(DBResources.self).filter("resourcesId == %@", resourceId)
.last!
try? realm.write({
dbResource.localPath = path
})
}
// MARK: - NOTIFICATION
/// Saves notification to DB
/// - Parameter notifications: Collection of `AppNotification` instances.
func saveNotifications(notifications: [AppNotification]) {
let realm = DBHandler.getRealmObject()!
var dbNotificationList: [DBNotification] = []
for notification in notifications {
let dbNotification = DBNotification()
dbNotification.id = notification.id!
dbNotification.title = notification.title
dbNotification.message = notification.message
dbNotification.studyId = notification.studyId ?? ""
dbNotification.activityId = notification.activityId ?? ""
dbNotification.isRead = notification.read!
dbNotification.notificationType = notification.type.rawValue
dbNotification.subType = notification.subType.rawValue
dbNotification.audience = notification.audience!.rawValue
dbNotification.date = notification.date!
dbNotificationList.append(dbNotification)
}
try? realm.write {
realm.add(dbNotificationList, update: .all)
}
}
/// Loads notification list from DB
/// - Parameter completionHandler: Returns the Array of `AppNotification` instances.
class func loadNotificationListFromDatabase(
completionHandler: @escaping ([AppNotification]) -> Void
) {
let realm = DBHandler.getRealmObject()!
let dbNotifications = realm.objects(DBNotification.self).sorted(
byKeyPath: "date",
ascending: false
)
var notificationList: [AppNotification] = []
for dbnotification in dbNotifications {
let notification = AppNotification()
notification.id = dbnotification.id
notification.title = dbnotification.title
notification.message = dbnotification.message
notification.studyId = dbnotification.studyId
notification.activityId = dbnotification.activityId
notification.type = AppNotification.NotificationType(
rawValue: dbnotification.notificationType!
)!
notification.subType = AppNotification.NotificationSubType(
rawValue: dbnotification.subType!
)!
notification.audience = Audience(rawValue: dbnotification.audience!)!
notification.date = dbnotification.date
notification.read = dbnotification.isRead
notificationList.append(notification)
}
completionHandler(notificationList)
}
class func saveRegisteredLocaNotifications(notificationList: [AppLocalNotification]) {
for notification in notificationList {
DBHandler.saveLocalNotification(notification: notification)
}
}
/// Saves scheduled `DBLocalNotification` to DB.
/// - Parameter notification: Array of `AppLocalNotification` instances to be stored in DB.
class func saveLocalNotification(notification: AppLocalNotification) {
let realm = DBHandler.getRealmObject()!
let dbNotification = DBLocalNotification()
dbNotification.id = notification.id
dbNotification.title = notification.title
dbNotification.message = notification.message
dbNotification.studyId = notification.studyId ?? ""
dbNotification.activityId = notification.activityId ?? ""
dbNotification.isRead = notification.read!
dbNotification.notificationType = notification.type.rawValue
dbNotification.subType = notification.subType.rawValue
dbNotification.audience = notification.audience!.rawValue
dbNotification.startDate = notification.startDate
dbNotification.endDate = notification.endDate
try? realm.write {
realm.add(dbNotification, update: .all)
}
}
/// Fetches list of `DBLocalNotification` from DB.
/// - Parameter completionHandler: Pass array of `AppLocalNotification` in completion handler.
class func getLocalNotification(completionHandler: @escaping ([AppLocalNotification]) -> Void) {
let realm = DBHandler.getRealmObject()!
let todayDate = Date()
let dbNotifications = realm.objects(DBLocalNotification.self).sorted(
byKeyPath: "startDate",
ascending: false
).filter({ $0.startDate! <= todayDate && $0.endDate! >= todayDate })
var notificationList: [AppLocalNotification] = []
for dbnotification in dbNotifications {
let notification = AppLocalNotification()
notification.id = dbnotification.id
notification.title = dbnotification.title
notification.message = dbnotification.message
notification.studyId = dbnotification.studyId
notification.activityId = dbnotification.activityId
notification.type = AppNotification.NotificationType(
rawValue: dbnotification.notificationType!
)!
notification.subType = AppNotification.NotificationSubType(
rawValue: dbnotification.subType!
)!
notification.audience = Audience(rawValue: dbnotification.audience!)!
notification.read = dbnotification.isRead
notification.startDate = dbnotification.startDate
notification.endDate = dbnotification.endDate
notificationList.append(notification)
}
completionHandler(notificationList)
}
/// Fetches the sorted top most 50 `DBLocalNotification` from DB.
/// - Parameter completionHandler: Pass array of `AppLocalNotification` instances in completion handler.
class func getRecentLocalNotification(
completionHandler: @escaping ([AppLocalNotification]) -> Void
) {
let realm = DBHandler.getRealmObject()!
let todayDate = Date()
let dbNotifications = realm.objects(DBLocalNotification.self).sorted(
byKeyPath: "startDate",
ascending: true
).filter({ $0.startDate! >= todayDate })
var notificationList: [AppLocalNotification] = []
for (i, dbnotification) in dbNotifications.enumerated() {
if i == 50 {
break
}
let notification = AppLocalNotification()
notification.id = dbnotification.id
notification.title = dbnotification.title
notification.message = dbnotification.message
notification.studyId = dbnotification.studyId
notification.activityId = dbnotification.activityId
notification.type = AppNotification.NotificationType(
rawValue: dbnotification.notificationType!
)!
notification.subType = AppNotification.NotificationSubType(
rawValue: dbnotification.subType!
)!
notification.audience = Audience(rawValue: dbnotification.audience!)!
notification.read = dbnotification.isRead
notification.startDate = dbnotification.startDate
notification.endDate = dbnotification.endDate
notificationList.append(notification)
}
completionHandler(notificationList)
}
class func isNotificationSetFor(
notification: String,
completionHandler: @escaping (Bool) -> Void
) {
let realm = DBHandler.getRealmObject()!
let dbNotifications = realm.object(
ofType: DBLocalNotification.self,
forPrimaryKey: notification
)
if dbNotifications == nil {
completionHandler(false)
}
completionHandler(true)
}
// MARK: - DELETE
/// This method will delete all the data from Realm Default configuration.
class func deleteAll() {
let realm = DBHandler.getRealmObject()!
try? realm.write {
realm.deleteAll()
}
}
/// This method will delete Study activity runs, MetaData, Charts & Stats.
/// - Parameter studyId: StudyId to query Study from the DB.
class func deleteStudyData(studyId: String) {
let realm = DBHandler.getRealmObject()!
// delete activites and its metadata
let dbActivities = realm.objects(DBActivity.self).filter("studyId == %@", studyId)
dbActivities.forEach { (dbActivity) in
DBHandler.deleteMetaDataForActivity(
activityId: (dbActivity.actvityId)!,
studyId: (dbActivity.studyId)!
)
try? realm.write {
realm.delete((dbActivity.activityRuns))
realm.delete(dbActivity)
}
}
// delete stats
let dbStatisticsArray = realm.objects(DBStatistics.self).filter({ $0.studyId == studyId })
dbStatisticsArray.forEach { (stat) in
try? realm.write {
realm.delete((stat.statisticsData))
realm.delete(stat)
}
}
// delete chart
let dbChartsArray = realm.objects(DBCharts.self).filter { $0.studyId == studyId }
dbChartsArray.forEach { (chart) in
try? realm.write {
realm.delete(chart.statisticsData)
realm.delete(chart)
}
}
// delete resource
let dbResourcesArray = realm.objects(DBResources.self)
.filter { $0.studyId == studyId }
try? realm.write {
realm.delete(dbResourcesArray)
}
}
/// This method will delete the objects of `DBNotification` from DB associate with activity and study.
/// - Parameters:
/// - activityId: ActivityID associated with the Notification in DB.
/// - studyId: StudyID associated with the Notification in DB.
class func deleteDBLocalNotification(activityId: String, studyId: String) {
let realm = DBHandler.getRealmObject()!
let dbNotifications = realm.objects(DBLocalNotification.self).filter(
"activityId == %@ && studyId == %@",
activityId,
studyId
)
if dbNotifications.count > 0 {
try? realm.write {
realm.delete(dbNotifications)
}
}
}
/// This method will delete the objects of `DBLocalNotification` from DB associate with study.
/// - Parameters:
/// - studyId: StudyID associated with the Notification in DB.
class func deleteStudyDBLocalNotifications(for studyId: String) {
let realm = DBHandler.getRealmObject()!
let dbNotifications = realm.objects(DBLocalNotification.self).filter(
"studyId == %@",
studyId
)
try? realm.write {
realm.delete(dbNotifications)
}
}
}
| [
-1
] |
270d7438bb6f4dc6958e2452e1f4759ac76e4ed7 | 0a44646a4fdaa0931461deef228c3fdb2112db14 | /CoreDataStudent/CoreDataManager/FetchRequestController.swift | 0de99f5501d4168a4f58ec38db463a69506e1312 | [] | no_license | Santhosh-MS/CoreData-Ref | d509eb7924cf0ad6eb72055595ad88674bf6b2ae | 2092e1bb3072b92fcf3101aa695ed269b0c5ae93 | refs/heads/master | 2020-12-08T18:34:07.735903 | 2020-01-10T13:51:19 | 2020-01-10T13:51:19 | 233,061,376 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,707 | swift | //
// FetchRequestController.swift
// CoreDataStudent
//
// Created by Ducont on 04/01/20.
// Copyright © 2020 Ducont. All rights reserved.
//
import UIKit
import CoreData
class FetchRequestController: UIViewController {
@IBOutlet weak var frcTableview: UITableView!
var fetchController : NSFetchedResultsController<Book>!
override func viewDidLoad() {
super.viewDidLoad()
loadData()
frcTableview.tintColor = #colorLiteral(red: 0.4666666687, green: 0.7647058964, blue: 0.2666666806, alpha: 1)
}
@IBAction func addButtonPressed(_ sender: Any) {
self.AddTextData()
}
func loadData(){
let BookFetchRequest = NSFetchRequest<Book>(entityName: "Book")
//let BookFetchRequest : NSFetchRequest<Book> = Book.fetchRequest()
let sortDescription = NSSortDescriptor(key: #keyPath(Book.author), ascending: true, selector: #selector(NSString.caseInsensitiveCompare(_:)))
BookFetchRequest.sortDescriptors = [sortDescription]
fetchController = NSFetchedResultsController(fetchRequest: BookFetchRequest, managedObjectContext: CoreDataManager.shared.manageObjectContext, sectionNameKeyPath: "author", cacheName: nil)
do{
try fetchController.performFetch()
}catch {
print("Error loading error :\(error)")
}
self.frcTableview.reloadData()
}
func AddTextData(){
let authoreText = UITextField()
let titleText = UITextField()
let alert = UIAlertController(title: "Create new book", message: "", preferredStyle: .alert)
let action = UIAlertAction(title: "Add Book", style: .default) { (action) in
// guard let BookEntity = NSEntityDescription.entity(forEntityName: "Book", in: CoreDataManager.shared.manageObjectContext) else{
// return
// }
// let newBook = NSManagedObject(entity:
// BookEntity, insertInto: CoreDataManager.shared.manageObjectContext) as! Book
let newBook = Book(context: CoreDataManager.shared.manageObjectContext)
newBook.author = alert.textFields?[0].text
newBook.title = alert.textFields?[1].text
do{
try CoreDataManager.shared.manageObjectContext.save()
//self.frcTableview.reloadData()
self.loadData()
}catch let err as NSError{
print("err--->:\(err.localizedDescription)")
}
}
alert.addAction(action)
alert.addTextField { (auth) in
auth.placeholder = "New Author Name Here"
authoreText.text = auth.text
}
alert.addTextField { (title) in
title.placeholder = "Book title"
titleText.text = title.text
}
present(alert,animated : true,completion : nil)
}
}
extension FetchRequestController : UITableViewDataSource,UITableViewDelegate {
func numberOfSections(in tableView: UITableView) -> Int {
if let frc = fetchController{
return frc.sections!.count
}
return 0
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// return fetchController.sections!.count
guard let sections = self.fetchController.sections else{
fatalError("No Such in fetchRequest Controller ?")
}
let sectionInfo = sections[section]
return sectionInfo.numberOfObjects
}
func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
guard let sessionInfo = fetchController?.sections?[section] else {
return "Add items"
}
let title = sessionInfo.name
return title
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "bookCell", for: indexPath) as! BookTableViewCell
let entity = fetchController.object(at: indexPath)
cell.bookTiTle.text = entity.title ?? "ADD Book"
return cell
}
func sectionIndexTitles(for tableView: UITableView) -> [String]? {
return fetchController.sectionIndexTitles
}
//func tableView(_ tableView: UITableView, sectionForSectionIndexTitle title: String, at index: Int) -> Int {
// guard let result = fetchController.section(forSectionIndexTitle: title,at : index ) else {
// fatalError("Unable to locate Section for \(title) at :\(index)")
// }
//
// return result
//
// }
}
| [
-1
] |
252f00291a3796b3103d72a73962477db0ff5c24 | 4c1baf130d5d63c44ca775c56b7b96e2d7e25943 | /macos/Flutter/GeneratedPluginRegistrant.swift | b700dcdae7cbb9d38f9f094454c7eca28db88e05 | [] | no_license | Zhengzhouhao/flutter_mobile_command_tools | b22e14af64d97488fe865f1c67a8ba99323998a6 | 614cb8542f07ffa5febd54da943eebd3ac05a2fd | refs/heads/master | 2023-08-21T11:26:21.709835 | 2021-10-25T04:40:50 | 2021-10-25T04:40:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 379 | swift | //
// Generated file. Do not edit.
//
import FlutterMacOS
import Foundation
import file_selector_macos
import path_provider_macos
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
}
| [
-1
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.