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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
47d825f662d0abe2f052c00f74ee579402349341 | d45c37640570617540cfd9b2f3425b6a9048bc17 | /Providers/Twitter/TwitterWebProvider.swift | 9001a5ae89e01b3b6f2442e5f4f5d708d5a6a4ad | [
"MIT"
] | permissive | maaged/authorize-me | 6ecaf5123dbb5aa6f021dd5e9f69b7ff04b84c63 | f321cb2a1ce4511cd0afbed00872f58ad27dc3f3 | refs/heads/master | 2021-01-26T04:59:02.975396 | 2019-04-16T12:43:03 | 2019-04-16T12:43:03 | 243,317,380 | 1 | 0 | MIT | 2020-02-26T17:00:31 | 2020-02-26T17:00:30 | null | UTF-8 | Swift | false | false | 6,285 | swift | //
// TwitterProvider.swift
// Authorizer
//
// Created by Radislav Crechet on 5/4/17.
// Copyright © 2017 RubyGarage. All rights reserved.
//
import Foundation
public class TwitterWebProvider: TwitterProvider {
public override func authorize(_ completion: @escaping Providing.Completion) {
requestToken { [unowned self] requestToken, error in
guard let requestToken = requestToken as? String else {
completion(nil, error)
return
}
self.verifierToken(withRequestToken: requestToken) { [unowned self] verifierToken, error in
guard let verifierToken = verifierToken as? String else {
completion(nil, error)
return
}
self.accessToken(withRequestToken: requestToken,
verifierToken: verifierToken) { [unowned self] accessToken, error in
guard let accessToken = accessToken as? [String: String] else {
completion(nil, error)
return
}
self.account(withAccessToken: accessToken, completion: completion)
}
}
}
}
private func requestToken(_ completion: @escaping URLRequest.Completion) {
let url = URL(string: "https://api.twitter.com/oauth/request_token")!
let parameters = ["oauth_callback": redirectUri]
let request = URLRequest(url: url, httpMethod: .POST, parameters: parameters, consumer: consumer)
URLSession.resumeDataTask(with: request) { data, error in
guard let data = data,
let parameters = String(data: data, encoding: .utf8),
let token = parameters.dictionary["oauth_token"] else {
if error == nil {
DebugService.output(AuthorizeError.parseMessage)
}
completion(nil, error ?? AuthorizeError.parse)
return
}
completion(token, nil)
}
}
private func verifierToken(withRequestToken requestToken: String, _ completion: @escaping URLRequest.Completion) {
let parameters = ["oauth_token": requestToken, "force_login": "true"]
let url = "https://api.twitter.com/oauth/authenticate?\(parameters.string)"
let request = URLRequest(url: URL(string: url)!)
WebRequestService.load(request, ofProvider: self) { url, error in
guard error == nil else {
completion(nil, error)
return
}
if let parameters = url!.absoluteString.components(separatedBy: "?").last,
parameters.dictionary["denied"] != nil {
completion(nil, AuthorizeError.cancel)
} else if let parameters = url!.absoluteString.components(separatedBy: "?").last,
let token = parameters.dictionary["oauth_verifier"] {
completion(token, nil)
} else {
DebugService.output(AuthorizeError.parseMessage)
completion(nil, AuthorizeError.parse)
}
}
}
private func accessToken(withRequestToken requestToken: String,
verifierToken: String,
_ completion: @escaping URLRequest.Completion) {
let url = URL(string: "https://api.twitter.com/oauth/access_token")!
let parameters = ["oauth_verifier": verifierToken]
let access: URLRequest.Access = (token: requestToken, secret: nil)
let request = URLRequest(url: url,
httpMethod: .POST,
parameters: parameters,
consumer: consumer,
access: access)
URLSession.resumeDataTask(with: request) { data, error in
guard let data = data,
let parameters = String(data: data, encoding: .utf8),
let token = parameters.dictionary["oauth_token"],
let secret = parameters.dictionary["oauth_token_secret"] else {
if error == nil {
DebugService.output(AuthorizeError.parseMessage)
}
completion(nil, error ?? AuthorizeError.parse)
return
}
completion(["oauth_token": token, "oauth_token_secret": secret], nil)
}
}
private func account(withAccessToken accessToken: [String: String], completion: @escaping Providing.Completion) {
let url = URL(string: "https://api.twitter.com/1.1/account/verify_credentials.json")!
let access: URLRequest.Access = (token: accessToken["oauth_token"]!, secret: accessToken["oauth_token_secret"]!)
let request = URLRequest(url: url, httpMethod: .GET, consumer: consumer, access: access)
URLSession.resumeDataTask(with: request) { data, error in
guard let data = data,
let account = try? JSONSerialization.jsonObject(with: data) as? [String: Any] else {
if error == nil {
DebugService.output(AuthorizeError.parseMessage)
}
completion(nil, error ?? AuthorizeError.parse)
return
}
let user = User(id: "\(account["id"]!)",
name: account["screen_name"] as! String,
additions: account)
let session = Session(token: accessToken["oauth_token"]!,
user: user,
additions: accessToken)
completion(session, nil)
}
}
}
| [
-1
] |
e008c1af4b530dc798c20954b00f3e934847271b | cf830f1f5f06b97dc5bb7c3a354f8542abf50d7f | /Package.swift | 1aec084bb240902d5b321967658a501aef29a02a | [
"Beerware",
"MIT"
] | permissive | Bored0ne/vapor-unit-test-sample | 2fd13b36a36eb5940cf5551067e18adf464743aa | ffcb17597783a821874b5011a3efee93ad8362f7 | refs/heads/master | 2021-01-11T00:02:20.547944 | 2016-10-13T04:22:51 | 2016-10-13T04:22:51 | 70,768,063 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 396 | swift | import PackageDescription
let package = Package(
name: "testExample",
targets: [
Target(name: "App", dependencies: ["Library"]),
],
dependencies: [
.Package(url: "https://github.com/vapor/vapor.git", majorVersion: 1, minor: 0)
],
exclude: [
"Config",
"Database",
"Localization",
"Public",
"Resources",
]
)
| [
289764,
293941,
293174,
299407
] |
518def079e6532cbcf3cf3c36c41f02116b06554 | d09030cdcf778baee1a3d555128c01ce73ecf9df | /Cosmostation/Model/NeutronModel.swift | e70de492fecfa8d264f5bbeb06a94674006913f4 | [
"MIT"
] | permissive | cosmostation/cosmostation-ios | fb9555104adb209b887f67c5c18bba13969a6956 | 44804dc57bca599714763498fefbecb352a7c6d8 | refs/heads/master | 2023-08-20T14:14:30.591945 | 2023-08-20T07:42:08 | 2023-08-20T07:42:08 | 423,346,509 | 30 | 25 | MIT | 2023-09-13T09:26:40 | 2021-11-01T05:21:00 | Swift | UTF-8 | Swift | false | false | 5,018 | swift | //
// NeutronModel.swift
// Cosmostation
//
// Created by yongjoo jung on 2023/04/24.
// Copyright © 2023 wannabit. All rights reserved.
//
import Foundation
import SwiftyJSON
public struct NeutronVault {
var name: String?
var description: String?
var address: String?
var owner: String?
var manager: String?
var denom: String?
init(_ dictionary: NSDictionary?) {
self.name = dictionary?["name"] as? String
self.description = dictionary?["description"] as? String
self.address = dictionary?["address"] as? String
self.owner = dictionary?["owner"] as? String
self.manager = dictionary?["manager"] as? String
self.denom = dictionary?["denom"] as? String
}
}
public struct NeutronDao {
var name: String?
var description: String?
var dao_uri: String?
var address: String?
var voting_module: String?
var group_contract_address: String?
var proposal_modules = Array<NeutronProposalModule>()
init(_ dictionary: NSDictionary?) {
self.name = dictionary?["name"] as? String
self.description = dictionary?["description"] as? String
self.dao_uri = dictionary?["dao_uri"] as? String
self.address = dictionary?["address"] as? String
self.voting_module = dictionary?["voting_module"] as? String
self.group_contract_address = dictionary?["group_contract_address"] as? String
if let rawModules = dictionary?["proposal_modules"] as? Array<NSDictionary> {
rawModules.forEach { rawModule in
self.proposal_modules.append(NeutronProposalModule(rawModule))
}
}
}
}
public struct NeutronProposalModule {
var name: String?
var description: String?
var allow_revoting: Bool?
var address: String?
var prefix: String?
var status: Bool?
init(_ dictionary: NSDictionary?) {
self.name = dictionary?["name"] as? String
self.description = dictionary?["description"] as? String
self.allow_revoting = dictionary?["allow_revoting"] as? Bool
self.address = dictionary?["address"] as? String
self.prefix = dictionary?["prefix"] as? String
if let rawStatus = dictionary?["status"] as? String {
if (rawStatus == "Enabled") { self.status = true }
}
}
}
public struct NeutronSwapPool {
var id: Int64?
var chain: String?
var router_address: String?
var factory_address: String?
var contract_address: String?
var total_share: NSDecimalNumber?
var pairs = Array<NeutronSwapPoolPair>()
init(_ dictionary: NSDictionary?) {
self.id = dictionary?["id"] as? Int64
self.chain = dictionary?["chain"] as? String
self.router_address = dictionary?["router_address"] as? String
self.factory_address = dictionary?["factory_address"] as? String
self.contract_address = dictionary?["contract_address"] as? String
if let rawShare = dictionary?["total_share"] as? String {
self.total_share = NSDecimalNumber(string: rawShare)
}
if let rawPairs = dictionary?["pairs"] as? Array<NSDictionary> {
rawPairs.forEach { rawPair in
self.pairs.append(NeutronSwapPoolPair.init(rawPair))
}
}
}
}
public struct NeutronSwapPoolPair {
var type: String?
var address: String?
var denom: String?
var amount: String?
init(_ dictionary: NSDictionary?) {
self.type = dictionary?["type"] as? String
self.address = dictionary?["address"] as? String
self.denom = dictionary?["denom"] as? String
self.amount = dictionary?["amount"] as? String
}
}
public struct NeutronOfferAsset {
var amount: String?
}
public struct NeutronAskAsset {
var native_token: NeutronNativeToken?
var token: NeutronToken?
init(_ nativeToken: String?, _ token: String?) {
if let nativeToken = nativeToken {
self.native_token = NeutronNativeToken.init(nativeToken)
}
if let token = token {
self.token = NeutronToken.init(token)
}
}
init(_ dictionary: NSDictionary?) {
if let rawNativeToken = dictionary?["native_token"] as? NSDictionary {
self.native_token = NeutronNativeToken.init(rawNativeToken)
}
if let rawToken = dictionary?["token"] as? NSDictionary {
self.token = NeutronToken.init(rawToken)
}
}
}
public struct NeutronSwapAsset {
}
public struct NeutronNativeToken {
var denom: String?
init(_ string: String?) {
self.denom = string
}
init(_ dictionary: NSDictionary?) {
self.denom = dictionary?["denom"] as? String
}
}
public struct NeutronToken {
var denom: String?
init(_ string: String?) {
self.denom = string
}
init(_ dictionary: NSDictionary?) {
self.denom = dictionary?["denom"] as? String
}
}
| [
-1
] |
337baf91fea6b5d0a36ee82630bac1e68d34f934 | adce22d797e39c07d6e5a89099e36f51d872a63e | /Schedulo/View Controllers/Plans/PlanSchedulesViewController.swift | 60a93c5e4c61d49343ad22d65ea7693ffa87b456 | [] | no_license | rizadh/Schedulo | 47da109161f8a8c504912be7bf90260baec99c9f | 581d9b74bf3f83ee665121aaf8481cd2726086b0 | refs/heads/master | 2020-12-02T16:23:41.705656 | 2017-10-23T12:55:09 | 2017-10-23T12:55:09 | 96,545,426 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,271 | swift | //
// PlanSchedulesViewController.swift
// Schedulo
//
// Created by Rizadh Nizam on 2017-10-04.
// Copyright © 2017 Rizadh Nizam. All rights reserved.
//
import UIKit
class PlanSchedulesViewController: UITableViewController {
// MARK: State Management
var stateController: StateController!
var planIndex: Int!
var schedules: [Schedule] {
return stateController.plans[planIndex].schedules
}
override func viewDidLoad() {
super.viewDidLoad()
title = "Schedules"
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return schedules.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = UITableViewCell()
cell.accessoryType = .disclosureIndicator
cell.textLabel?.text = "Schedule \(indexPath.row + 1)"
return cell
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let schedule = self.schedules[indexPath.row]
let scheduleViewController = ScheduleViewController(for: schedule)
navigationController?.pushViewController(scheduleViewController, animated: true)
}
}
| [
-1
] |
c71f4b3b038073be32673d2c3fb0fb8351e09410 | 915cfb85fc99eaed58abcf64aaaaf0b2fef6876c | /DealStack/DealView.swift | a6b03911a86e3b440560b61b3cd26566898571f3 | [
"BSD-2-Clause"
] | permissive | insidegui/DealStack | 8abde903fad91a078464e7ce473482bb5b0c7fdd | 032bbc6afe6b1f75b985bace00bd001cd1ff968d | refs/heads/master | 2020-06-15T08:55:01.461940 | 2019-07-04T14:09:02 | 2019-07-04T14:09:02 | 195,253,612 | 117 | 6 | null | null | null | null | UTF-8 | Swift | false | false | 1,492 | swift | //
// DealView.swift
// DealStack
//
// Created by Guilherme Rambo on 04/07/19.
// Copyright © 2019 Guilherme Rambo. All rights reserved.
//
import SwiftUI
struct DealView: View {
@State var deal: Deal
var body: some View {
ZStack {
Image(self.deal.imageName)
.cornerRadius(8)
VStack {
HStack {
Spacer()
PriceView(formattedPrice: self.deal.formattedPrice).shadow(radius: 10)
}
.padding()
Spacer()
ZStack {
Text(deal.title)
.font(.headline)
.color(.white)
.lineLimit(nil)
.padding()
.shadow(color: .init(.displayP3, red: 0, green: 0, blue: 0, opacity: 0.5), radius: 2, x: 0, y: 1)
}
.frame(minWidth: 0, maxWidth: .infinity)
.background(
Rectangle()
.fill(LinearGradient(gradient: Gradient(colors: [Color.clear, Color.black]), startPoint: .top, endPoint: .bottom))
.blendMode(.overlay)
)
}
}
}
}
#if DEBUG
struct DealView_Previews : PreviewProvider {
static var previews: some View {
DealView(deal: Deal.previewContent[0])
.previewLayout(.fixed(width: 338, height: 220))
}
}
#endif
| [
-1
] |
90139964ee5f34b598a9a75871559ce182ce5846 | 99c13d64dce21cfcf399204026eb99c14fc94c6b | /Swift UI ProjectTests/Swift_UI_ProjectTests.swift | 1fe4d2e992874f993af6deb605532831e33fbbec | [] | no_license | dunahee12/swift-ui-demo | 377240daeeddb61749f96c128297067317f28727 | dafb2d9cc4c34f9829c8af25057bda73b860f3a6 | refs/heads/master | 2021-01-16T08:27:53.499686 | 2020-02-25T20:23:05 | 2020-02-25T20:23:05 | 243,041,443 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 940 | swift | //
// Swift_UI_ProjectTests.swift
// Swift UI ProjectTests
//
// Created by Jake Dunahee on 2/24/20.
// Copyright © 2020 Jake Dunahee. All rights reserved.
//
import XCTest
@testable import Swift_UI_Project
class Swift_UI_ProjectTests: 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.
}
}
}
| [
360462,
229413,
204840,
344107,
155694,
229424,
229430,
163896,
180280,
376894,
352326,
254027,
196691,
180311,
180312,
385116,
237663,
254048,
319591,
221290,
319598,
204916,
131191,
278677,
196760,
426138,
278704,
377009,
295098,
139479,
229597,
311519,
205035,
385262,
286958,
327929,
344313,
147717,
368905,
254226,
319763,
368916,
262421,
377114,
237856,
237857,
278816,
311597,
98610,
180535,
336183,
278842,
344401,
377169,
368981,
155990,
368984,
106847,
98657,
270701,
270706,
139640,
311685,
106888,
385417,
385422,
213403,
246178,
385454,
377264,
311738,
33211,
319930,
336320,
311745,
254406,
188871,
328152,
369116,
287198,
319981,
254456,
377338,
377343,
254465,
287241,
139792,
303636,
393751,
377376,
377386,
197167,
385588,
115270,
385615,
426576,
369235,
295519,
139872,
344680,
279146,
287346,
139892,
287352,
344696,
311941,
336518,
311945,
369289,
344715,
311949,
287374,
377489,
311954,
352917,
295576,
230040,
271000,
303771,
221852,
377500,
377497,
205471,
344738,
139939,
205487,
295599,
303793,
336564,
164533,
287417,
287422,
377539,
164560,
385747,
361176,
418520,
287452,
369385,
312052,
172792,
344827,
221948,
205568,
295682,
197386,
434957,
295697,
426774,
197399,
426775,
197411,
295724,
197422,
353070,
164656,
295729,
197431,
336702,
353109,
377686,
230234,
189275,
435039,
295776,
303972,
385893,
230248,
246641,
246643,
295798,
246648,
361337,
254850,
369538,
287622,
295824,
140204,
377772,
304051,
230332,
377790,
353215,
189374,
353216,
213957,
345033,
279498,
386006,
418776,
50143,
123881,
271350,
295927,
320507,
328700,
328706,
410627,
320516,
295942,
386056,
353290,
377869,
238610,
418837,
140310,
320536,
189474,
369701,
238639,
312373,
238651,
377926,
353367,
304222,
173166,
377972,
377983,
402565,
279685,
386189,
296086,
238743,
238765,
279728,
238769,
402613,
353479,
402634,
189653,
419029,
279765,
148696,
296153,
279774,
304351,
222440,
328940,
279792,
386294,
386301,
320770,
386306,
369930,
328971,
353551,
320796,
222494,
353584,
345396,
386359,
378172,
312648,
337225,
304456,
230729,
238927,
353616,
222559,
378209,
386412,
296303,
296307,
116084,
337281,
148867,
296329,
296335,
9619,
370071,
173491,
304564,
353719,
361927,
296392,
329173,
271843,
296433,
329225,
296461,
304656,
329232,
370197,
230943,
402985,
394794,
230959,
288309,
312889,
280130,
288327,
280147,
239198,
99938,
312940,
222832,
337534,
337535,
263809,
288392,
239250,
419478,
337591,
296632,
280257,
280267,
403148,
9936,
9937,
370388,
272085,
345814,
18138,
345821,
321247,
321249,
345833,
345834,
67315,
173814,
288512,
288516,
321302,
345879,
321310,
255776,
362283,
378668,
296755,
321337,
345919,
436031,
403267,
345929,
18262,
362327,
280410,
345951,
362337,
345955,
296806,
280430,
214895,
313199,
362352,
296814,
182144,
305026,
329622,
337815,
214938,
436131,
436137,
362417,
288697,
362431,
214984,
362443,
280541,
329695,
436191,
313319,
247785,
436205,
43014,
354316,
313357,
346162,
288828,
436285,
288833,
288834,
436292,
403525,
436301,
338001,
338003,
280661,
329814,
280675,
280677,
43110,
321637,
329829,
436329,
313447,
288879,
288889,
215164,
215166,
280712,
215178,
346271,
436383,
362659,
239793,
182456,
280762,
379071,
149703,
346314,
321745,
387296,
280802,
379106,
346346,
321772,
436470,
149760,
411906,
272658,
338218,
321840,
379186,
321860,
182598,
289110,
215385,
354676,
436608,
362881,
240002,
436611,
108944,
190871,
149916,
420253,
141728,
289189,
289194,
108972,
272813,
338356,
436661,
289232,
281040,
256477,
174593,
420369,
207393,
289332,
174648,
338489,
338490,
281166,
281171,
297560,
436832,
436834,
420463,
346737,
313971,
346740,
420471,
330379,
330387,
117396,
346772,
117397,
330388,
264856,
289434,
346779,
314040,
158394,
248517,
363211,
363230,
264928,
330474,
289518,
199414,
117517,
322319,
166676,
207640,
289576,
191283,
273207,
289598,
281433,
330609,
207732,
158593,
224145,
355217,
256922,
289690,
289698,
420773,
289703,
363438,
347055,
289727,
273344,
330689,
363458,
379844,
19399,
248796,
347103,
52200,
347123,
240630,
257024,
330754,
330763,
248872,
314448,
339030,
257125,
273515,
207979,
404593,
363641,
363644,
150657,
248961,
330888,
363669,
339100,
380061,
429214,
199839,
339102,
265379,
249002,
306346,
3246,
421048,
208058,
322749,
265412,
290000,
298208,
298212,
298213,
290022,
330984,
298221,
298228,
437505,
322824,
257305,
339234,
372009,
412971,
298291,
306494,
216386,
224586,
372043,
331090,
314710,
372054,
159066,
314720,
134506,
380271,
208244,
249204,
290173,
306559,
314751,
298374,
314758,
314760,
142729,
388487,
314766,
290207,
314783,
314789,
314791,
396711,
396712,
380337,
380338,
150965,
380357,
339398,
306639,
413137,
429542,
191990,
372227,
323080,
175639,
388632,
396827,
134686,
347694,
265798,
265804,
396882,
290390,
306776,
44635,
396895,
323172,
282213,
224883,
314998,
396922,
323196,
339584,
282273,
323236,
298661,
224946,
110268,
224958,
274115,
306890,
282318,
241361,
241365,
298720,
282339,
282348,
282358,
339715,
323331,
323332,
339720,
372496,
323346,
282400,
339745,
257830,
421672,
282417,
282434,
307011,
282438,
323406,
216918,
241495,
282474,
282480,
241528,
339841,
241540,
315273,
315274,
110480,
372626,
380821,
118685,
298909,
323507,
282549,
290745,
290746,
274371,
151497,
372701,
298980,
380908,
282633,
241692,
315432,
102445,
233517,
176175,
241716,
225351,
315465,
315476,
307289,
315487,
356447,
307299,
438377,
233589,
266357,
422019,
241808,
381073,
299174,
258214,
323762,
299187,
405687,
258239,
389313,
299203,
299209,
372941,
282831,
266449,
356576,
307435,
438511,
381172,
184575,
381208,
299293,
151839,
233762,
217380,
282919,
332083,
332085,
332089,
282939,
438596,
332101,
323913,
348492,
323920,
348500,
168281,
332123,
332127,
242023,
160110,
242033,
291192,
340357,
225670,
242058,
373134,
242078,
61857,
315810,
315811,
381347,
61859,
340398,
127427,
291267,
127428,
324039,
373197,
160225,
291311,
291333,
340490,
258581,
234036,
315960,
348732,
242237,
70209,
348742,
70215,
348749,
381517,
332378,
201308,
111208,
184940,
373358,
389745,
209530,
373375,
152195,
348806,
316049,
111253,
316053,
111258,
111259,
176808,
299699,
422596,
422599,
291530,
225995,
242386,
422617,
422626,
234217,
299759,
299776,
291585,
430849,
242433,
291592,
62220,
422673,
430865,
291604,
422680,
152365,
422703,
422709,
152374,
160571,
430910,
160575,
160580,
381773,
201551,
242529,
349026,
357218,
201577,
308076,
242541,
209783,
177019,
185211,
308092,
398206,
291712,
381829,
316298,
349072,
390045,
185250,
185254,
373687,
373706,
316364,
340961,
324586,
316405,
349175,
201720,
127992,
357379,
324625,
308243,
357414,
300084,
308287,
218186,
341073,
439384,
300135,
316520,
357486,
144496,
300150,
291959,
300151,
160891,
300158,
349316,
349318,
373903,
169104,
177296,
185493,
119962,
300187,
300188,
300201,
300202,
373945,
259268,
283847,
283852,
259280,
316627,
333011,
234742,
128251,
234755,
439562,
292107,
414990,
251153,
177428,
349462,
382258,
300343,
382269,
333117,
193859,
177484,
406861,
259406,
234831,
120148,
374109,
234850,
333160,
243056,
316787,
357762,
112017,
234898,
259475,
275859,
357786,
251298,
333220,
316842,
374191,
284089,
300489,
210390,
210391,
210393,
144867,
316902,
54765,
251378,
308723,
333300,
333303,
300536,
259599,
308756,
398869,
374296,
374299,
308764,
333343,
431649,
169518,
431663,
194110,
349763,
218696,
292425,
243274,
128587,
333388,
128599,
333408,
300644,
415338,
243307,
54893,
325231,
325245,
194180,
415375,
153251,
300714,
210603,
415420,
333503,
259781,
333517,
333520,
333521,
325346,
153319,
325352,
284401,
325371,
284431,
243472,
366360,
284442,
325404,
333610,
399147,
431916,
300848,
259899,
325439,
153415,
341836,
415567,
325457,
317269,
341847,
350044,
128862,
276327,
292712,
423789,
325492,
276341,
300918,
341879,
333688,
317304,
112509,
55167,
325503,
333701,
243591,
325515,
325518,
333722,
350109,
292771,
415655,
284587,
243637,
284619,
301008,
153554,
292836,
292837,
317415,
325619,
432116,
292858,
415741,
333828,
358410,
399373,
317467,
145435,
325674,
129076,
243767,
358456,
194666,
260207,
432240,
415881,
104587,
235662,
317587,
284826,
333991,
227524,
194782,
301279,
317664,
243962,
375039,
325905,
325912,
309529,
227616,
211235,
432421,
211238,
358703,
358709,
6481,
366930,
391520,
383332,
383336,
211326,
317831,
252308,
178582,
293274,
121245,
342450,
293303,
293310,
416197,
129483,
342476,
317901,
342498,
358882,
334309,
391655,
432618,
375276,
416286,
375333,
244269,
375343,
23092,
375351,
244281,
301638,
309830,
293448,
55881,
416341,
244310,
416351,
268899,
39530,
244347,
326287,
375440,
334481,
318106,
318107,
342682,
318130,
383667,
293556,
39614,
375526,
342762,
342763,
293612,
154359,
432893,
162561,
285444,
383754,
285458,
310036,
326429,
293664,
326433,
342820,
400166,
293672,
285487,
375609,
285497,
252741,
293711,
244568,
244570,
301918,
342887,
269178,
400252,
359298,
359299,
260996,
113542,
392074,
56208,
293781,
318364,
310176,
310178,
293800,
236461,
326581,
326587,
326601,
359381,
433115,
343005,
326635,
203757,
187374,
383983,
318461,
293886,
293893,
433165,
384016,
433174,
252958,
203830,
359478,
392290,
253029,
351344,
285814,
392318,
384131,
302216,
162961,
326804,
351390,
253099,
253100,
318639,
367799,
113850,
294074,
228542,
302274,
367810,
228563,
195808,
310497,
302325,
261377,
253216,
261425,
351537,
286013,
146762,
294218,
294219,
318805,
425304,
163175,
327024,
318848,
179587,
253317,
384393,
368011,
318864,
318868,
318875,
310692,
245161,
286129,
286132,
228795,
425405,
302531,
425418,
286172,
187878,
343542,
286202,
359930,
302590,
253451,
359950,
146964,
253463,
286244,
245287,
245292,
196164,
179801,
343647,
286306,
310889,
204397,
138863,
188016,
294529,
286343,
229001,
188048,
425626,
302754,
229029,
40614,
384695,
327358,
212685,
384720,
245457,
302802,
286423,
212716,
212717,
360177,
278272,
319233,
360195,
294678,
286494,
409394,
319292,
360252,
360264,
376669,
245599,
425825,
425833,
417654,
188292,
294807,
294809,
376732,
311199,
319392,
294823,
327596,
294843,
188348,
237504,
294850,
384964,
344013,
212942,
24532,
294886,
327661,
311281,
311282
] |
95b2c665634bbad659388965f341bca89f22fe4d | 680042e27880f1adfb02ca69e43341b06604db11 | /LonaStudio/Utils/parseCSSColor.swift | ae1fba767c727ef8f86bf0ef920bb9cd21a08de7 | [
"MIT"
] | permissive | focusspan/Lona | 4063ffecc5ece965380619b868f0fcc63221d76c | 276f937e256072b316455dd98f571e7f6851b5aa | refs/heads/master | 2021-05-16T14:54:04.021208 | 2018-01-23T18:24:26 | 2018-01-23T18:24:26 | 118,712,301 | 2 | 0 | null | 2018-01-24T04:34:28 | 2018-01-24T04:34:28 | null | UTF-8 | Swift | false | false | 11,427 | swift | // Swift port by Devin Abbott <[email protected]>, 2017.
// (c) Dean McNamee <[email protected]>, 2012.
//
// https://github.com/deanm/css-color-parser-js
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
import Foundation
typealias CSSColor = (r: Int, g: Int, b: Int, a: Double)
// http://www.w3.org/TR/css3-color/
fileprivate let kCSSColorTable: [String: CSSColor] = [
"transparent": (0,0,0,0), "aliceblue": (240,248,255,1),
"antiquewhite": (250,235,215,1), "aqua": (0,255,255,1),
"aquamarine": (127,255,212,1), "azure": (240,255,255,1),
"beige": (245,245,220,1), "bisque": (255,228,196,1),
"black": (0,0,0,1), "blanchedalmond": (255,235,205,1),
"blue": (0,0,255,1), "blueviolet": (138,43,226,1),
"brown": (165,42,42,1), "burlywood": (222,184,135,1),
"cadetblue": (95,158,160,1), "chartreuse": (127,255,0,1),
"chocolate": (210,105,30,1), "coral": (255,127,80,1),
"cornflowerblue": (100,149,237,1), "cornsilk": (255,248,220,1),
"crimson": (220,20,60,1), "cyan": (0,255,255,1),
"darkblue": (0,0,139,1), "darkcyan": (0,139,139,1),
"darkgoldenrod": (184,134,11,1), "darkgray": (169,169,169,1),
"darkgreen": (0,100,0,1), "darkgrey": (169,169,169,1),
"darkkhaki": (189,183,107,1), "darkmagenta": (139,0,139,1),
"darkolivegreen": (85,107,47,1), "darkorange": (255,140,0,1),
"darkorchid": (153,50,204,1), "darkred": (139,0,0,1),
"darksalmon": (233,150,122,1), "darkseagreen": (143,188,143,1),
"darkslateblue": (72,61,139,1), "darkslategray": (47,79,79,1),
"darkslategrey": (47,79,79,1), "darkturquoise": (0,206,209,1),
"darkviolet": (148,0,211,1), "deeppink": (255,20,147,1),
"deepskyblue": (0,191,255,1), "dimgray": (105,105,105,1),
"dimgrey": (105,105,105,1), "dodgerblue": (30,144,255,1),
"firebrick": (178,34,34,1), "floralwhite": (255,250,240,1),
"forestgreen": (34,139,34,1), "fuchsia": (255,0,255,1),
"gainsboro": (220,220,220,1), "ghostwhite": (248,248,255,1),
"gold": (255,215,0,1), "goldenrod": (218,165,32,1),
"gray": (128,128,128,1), "green": (0,128,0,1),
"greenyellow": (173,255,47,1), "grey": (128,128,128,1),
"honeydew": (240,255,240,1), "hotpink": (255,105,180,1),
"indianred": (205,92,92,1), "indigo": (75,0,130,1),
"ivory": (255,255,240,1), "khaki": (240,230,140,1),
"lavender": (230,230,250,1), "lavenderblush": (255,240,245,1),
"lawngreen": (124,252,0,1), "lemonchiffon": (255,250,205,1),
"lightblue": (173,216,230,1), "lightcoral": (240,128,128,1),
"lightcyan": (224,255,255,1), "lightgoldenrodyellow": (250,250,210,1),
"lightgray": (211,211,211,1), "lightgreen": (144,238,144,1),
"lightgrey": (211,211,211,1), "lightpink": (255,182,193,1),
"lightsalmon": (255,160,122,1), "lightseagreen": (32,178,170,1),
"lightskyblue": (135,206,250,1), "lightslategray": (119,136,153,1),
"lightslategrey": (119,136,153,1), "lightsteelblue": (176,196,222,1),
"lightyellow": (255,255,224,1), "lime": (0,255,0,1),
"limegreen": (50,205,50,1), "linen": (250,240,230,1),
"magenta": (255,0,255,1), "maroon": (128,0,0,1),
"mediumaquamarine": (102,205,170,1), "mediumblue": (0,0,205,1),
"mediumorchid": (186,85,211,1), "mediumpurple": (147,112,219,1),
"mediumseagreen": (60,179,113,1), "mediumslateblue": (123,104,238,1),
"mediumspringgreen": (0,250,154,1), "mediumturquoise": (72,209,204,1),
"mediumvioletred": (199,21,133,1), "midnightblue": (25,25,112,1),
"mintcream": (245,255,250,1), "mistyrose": (255,228,225,1),
"moccasin": (255,228,181,1), "navajowhite": (255,222,173,1),
"navy": (0,0,128,1), "oldlace": (253,245,230,1),
"olive": (128,128,0,1), "olivedrab": (107,142,35,1),
"orange": (255,165,0,1), "orangered": (255,69,0,1),
"orchid": (218,112,214,1), "palegoldenrod": (238,232,170,1),
"palegreen": (152,251,152,1), "paleturquoise": (175,238,238,1),
"palevioletred": (219,112,147,1), "papayawhip": (255,239,213,1),
"peachpuff": (255,218,185,1), "peru": (205,133,63,1),
"pink": (255,192,203,1), "plum": (221,160,221,1),
"powderblue": (176,224,230,1), "purple": (128,0,128,1),
"rebeccapurple": (102,51,153,1),
"red": (255,0,0,1), "rosybrown": (188,143,143,1),
"royalblue": (65,105,225,1), "saddlebrown": (139,69,19,1),
"salmon": (250,128,114,1), "sandybrown": (244,164,96,1),
"seagreen": (46,139,87,1), "seashell": (255,245,238,1),
"sienna": (160,82,45,1), "silver": (192,192,192,1),
"skyblue": (135,206,235,1), "slateblue": (106,90,205,1),
"slategray": (112,128,144,1), "slategrey": (112,128,144,1),
"snow": (255,250,250,1), "springgreen": (0,255,127,1),
"steelblue": (70,130,180,1), "tan": (210,180,140,1),
"teal": (0,128,128,1), "thistle": (216,191,216,1),
"tomato": (255,99,71,1), "turquoise": (64,224,208,1),
"violet": (238,130,238,1), "wheat": (245,222,179,1),
"white": (255,255,255,1), "whitesmoke": (245,245,245,1),
"yellow": (255,255,0,1), "yellowgreen": (154,205,50,1)]
// Clamp to integer 0 .. 255.
fileprivate func clamp_css_byte(_ i: Int) -> Int {
return i < 0 ? 0 : i > 255 ? 255 : i
}
// Clamp to float 0.0 .. 1.0.
fileprivate func clamp_css_float(_ f: Double) -> Double {
return f < 0 ? 0 : f > 1 ? 1 : f
}
// int or percentage.
fileprivate func parse_css_int(_ str: String) -> Int {
if str.hasSuffix("%") {
let digits = str.replacingOccurrences(of: "%", with: "")
let value = (Double(digits) ?? 0) / 100 * 255
return clamp_css_byte(Int(value))
}
return clamp_css_byte(Int(str) ?? 0)
}
// float or percentage.
fileprivate func parse_css_float(_ str: String) -> Double {
if str.hasSuffix("%") {
let digits = str.replacingOccurrences(of: "%", with: "")
return clamp_css_float((Double(digits) ?? 0) / 100);
}
return clamp_css_float(Double(str) ?? 0);
}
fileprivate func css_hue_to_rgb(_ m1: Double, _ m2: Double, _ h: Double) -> Double {
var h = h
if h < 0 { h += 1 }
else if h > 1 { h -= 1 }
if h * 6 < 1 { return m1 + (m2 - m1) * h * 6 }
if h * 2 < 1 { return m2 }
if h * 3 < 2 { return m1 + (m2 - m1) * (2/3 - h) * 6 }
return m1
}
func parseCSSColor(_ css_str: String) -> CSSColor? {
// Remove all whitespace, not compliant, but should just be more accepting.
var str = css_str.replacingOccurrences(of: " ", with: "").lowercased()
// Color keywords (and transparent) lookup.
if let match = kCSSColorTable[str] {
return match; // dup.
}
// #abc and #abc123 syntax.
if (str.first == "#") {
if (str.count == 4) {
str.remove(at: str.startIndex) // TODO(deanm): Stricter parsing.
guard let iv = Int(str, radix: 16) else { return nil }
if !(iv >= 0 && iv <= 0xfff) { return nil } // Covers NaN.
return (
((iv & 0xf00) >> 4) | ((iv & 0xf00) >> 8),
(iv & 0xf0) | ((iv & 0xf0) >> 4),
(iv & 0xf) | ((iv & 0xf) << 4),
1
)
} else if (str.count == 7) {
str.remove(at: str.startIndex) // TODO(deanm): Stricter parsing.
guard let iv = Int(str, radix: 16) else { return nil }
if (!(iv >= 0 && iv <= 0xffffff)) { return nil } // Covers NaN.
return (
(iv & 0xff0000) >> 16,
(iv & 0xff00) >> 8,
iv & 0xff,
1
)
}
return nil
}
let op = str.index(of: "(")
let ep = str.index(of: ")")
if let op = op, ep == str.index(before: str.endIndex), let ep = ep {
let fname = String(str[..<op])
let range: Range<String.Index> = str.index(after: op)..<ep
var params: [String] = String(str[range]).components(separatedBy: ",")
var alpha: Double = 1; // To allow case fallthrough.
switch (fname) {
case "rgba":
if params.count != 4 { return nil }
alpha = parse_css_float(params.popLast()!)
fallthrough
case "rgb":
if (params.count != 3) { return nil }
return (
parse_css_int(params[0]),
parse_css_int(params[1]),
parse_css_int(params[2]),
alpha
)
case "hsla":
if (params.count != 4) { return nil }
alpha = parse_css_float(params.popLast()!)
fallthrough
case "hsl":
if (params.count != 3) { return nil }
let hue = Double(params[0]) ?? 0
let h = (hue.remainder(dividingBy: 360) + 360).remainder(dividingBy: 360) / 360 // 0 .. 1
// NOTE(deanm): According to the CSS spec s/l should only be
// percentages, but we don't bother and let float or percentage.
let s = parse_css_float(params[1])
let l = parse_css_float(params[2])
let m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s
let m1 = l * 2 - m2
return (
clamp_css_byte(Int(css_hue_to_rgb(m1, m2, h+1/3) * 255.0)),
clamp_css_byte(Int(css_hue_to_rgb(m1, m2, h) * 255.0)),
clamp_css_byte(Int(css_hue_to_rgb(m1, m2, h-1/3) * 255.0)),
alpha
)
default:
return nil;
}
}
return nil;
}
fileprivate func colorComponent(for int: Int) -> CGFloat {
return CGFloat(int) / 255.0
}
#if os(iOS)
import UIKit
extension UIColor {
static func parse(css: String) -> UIColor? {
guard let color = parseCSSColor(css) else { return nil }
return UIColor(
red: colorComponent(for: color.r),
green: colorComponent(for: color.g),
blue: colorComponent(for: color.b),
alpha: CGFloat(color.a)
)
}
}
#elseif os(OSX)
import AppKit
extension NSColor {
static func parse(css: String) -> NSColor? {
guard let color = parseCSSColor(css) else { return nil }
return NSColor(
red: colorComponent(for: color.r),
green: colorComponent(for: color.g),
blue: colorComponent(for: color.b),
alpha: CGFloat(color.a)
)
}
}
#endif
| [
-1
] |
e162ebfeead6d4037696ea87159d429a4e3f7aea | 076ff960cd2a44260a61eb1f16e6f01c616bfc52 | /Movies App/Modules/MovieDetails/Model/MappedModel/ReviewsResponse.swift | ec3de0777917adb0c41a9d8984faf86b7b76d95a | [] | no_license | Jeddawy/MovieApp | 308f71667fed0ff6839c0660df18cdbb46f32de4 | 60d4d5cd3375016bf3c359fdd0fa3914a7fc00d7 | refs/heads/master | 2020-07-09T03:47:01.441783 | 2019-08-22T11:31:52 | 2019-08-22T11:31:52 | 203,781,953 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,091 | swift | //
// ReviewsResponse.swift
//
// Created by Ibrahim El-geddawy on 8/22/19
// Copyright (c) . All rights reserved.
//
import Foundation
import ObjectMapper
class ReviewsResponse: Mappable {
// MARK: Declaration for string constants to be used to decode and also serialize.
private struct SerializationKeys {
static let content = "content"
static let author = "author"
static let id = "id"
static let url = "url"
}
// MARK: Properties
public var content: String?
public var author: String?
public var id: String?
public var url: String?
// MARK: ObjectMapper Initializers
/// Map a JSON object to this class using ObjectMapper.
///
/// - parameter map: A mapping from ObjectMapper.
public required init?(map: Map){
}
/// Map a JSON object to this class using ObjectMapper.
///
/// - parameter map: A mapping from ObjectMapper.
public func mapping(map: Map) {
content <- map[SerializationKeys.content]
author <- map[SerializationKeys.author]
id <- map[SerializationKeys.id]
url <- map[SerializationKeys.url]
}
}
| [
-1
] |
8580c56e07745174a8bbcc02e56b5febad9ee291 | d4e6e943e123c18c45cc5c7a73d02ec86c63c44c | /Sources/Core/Models/CLAlertMessage.swift | 1863785bd840281954aa1217765d1dc734669d9f | [] | no_license | agentsmithy/ExampleClientLibrary | eb9a130ea143c84d59bb82db04be4391d14bcad2 | 31a89b76ab74eb66e8842c1b034a3d23cf63c138 | refs/heads/master | 2021-05-02T12:43:09.694348 | 2018-02-08T10:22:31 | 2018-02-08T10:22:31 | 120,745,483 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,128 | swift | //
// CLAlertMessage.swift
// ExampleClientLibrary
//
// Created by James Reeve on 8/2/18.
// Copyright © 2018 James Reeve. All rights reserved.
//
import Foundation
import ObjectMapper
/**
* Identifies the the frequency that the alert message is to be displayed
* AMPAlertMessageFrequencyOnce - displayed once for this app instance
* AMPAlertMessageFrequencyAlways - displayed every time (always) for this app instance
*/
open class AlertMessageFrequency: CLEnum {
/** Used to specify that an alert is only to be shown once */
open class func showOnce() -> AlertMessageFrequency {
return AlertMessageFrequency.enumInstance(forLiteral: "SHOW_ONCE")
}
/** Used to specify that an alert is to be shown every time (always) */
open class func showEverytime() -> AlertMessageFrequency {
return AlertMessageFrequency.enumInstance(forLiteral: "SHOW_EVERYTIME")
}
}
public let alertMessageFrequencyTransform = TransformOf<AlertMessageFrequency, String>(fromJSON: { (value: String?) -> AlertMessageFrequency? in
// transform value from String? to AlertMessageFrequency?
if let value = value {
return AlertMessageFrequency(value)
}
return nil
}, toJSON: { (value: AlertMessageFrequency?) -> String? in
// transform value from AlertMessageFrequency? to String?
if let value = value {
return value.literal
}
return nil
})
open class AlertMessage: NSObject, StaticMappable {
/** The alert message to be displayed on the device */
public var alertMessage: String?
/** Identifies the frequency that the alert message is to be displayed e.g. displayed once, displayed every time (always). */
public var alertIndicator: AlertMessageFrequency?
public func mapping(map: Map) {
self.alertMessage <- map["alertMessage"]
self.alertIndicator <- map["alertIndicator"]
self.alertIndicator <- (map["alertIndicator"], alertMessageFrequencyTransform)
}
public static func objectForMapping(map _: Map) -> BaseMappable? {
return AlertMessage()
}
}
| [
-1
] |
3e3923f119f8c0223f78bfd0bdd9649c4cb86f5a | b2fd904af60e7559e69eaec7ff2de73282dc843c | /Kouti/views/Character/CharacterHeader.swift | d8b13c16a25f0d6079c48c273bc86b311afb6e4a | [] | no_license | thihxm/kouti | 5e0a5b17c55df21a6107d9846be6cd2cfab037e1 | 6db21a4768b9b691bc976d9c5ccf6582354db098 | refs/heads/main | 2023-07-23T09:25:57.218580 | 2021-09-05T22:06:20 | 2021-09-05T22:06:20 | 378,223,180 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 946 | swift | //
// CharacterHeader.swift
// Kouti
//
// Created by Marco Zulian on 24/06/21.
//
import SwiftUI
struct CharacterHeader: View {
@EnvironmentObject var userManager: UserManager
var body: some View {
let title = userManager.user.character.inventory.equipedItems.filter { $0.type == .title }.first
LazyVGrid(columns: [GridItem(.flexible())], alignment: .leading) {
Text("\(userManager.user.character.name)")
.font(.headline)
Text("\(title?.name ?? "")")
.font(.subheadline)
ExperienceBar(character: $userManager.user.character)
.padding(.top)
StreakDisplay(streakCount: $userManager.user.streak)
}.foregroundColor(.white)
}
}
struct CharacterHeader_Previews: PreviewProvider {
static var previews: some View {
CharacterHeader()
.environmentObject(UserManager.fullState())
}
}
| [
-1
] |
75cb40c860dc2a4019fdea231df1aa0d54838e7c | 249ceeca8cd83e986cb838aeaf3cfa289c7c50e4 | /_SwiftUI-Snapchat-Transition/Shared/ViewModel/VideoPlayerViewModel.swift | 3279f0cb28b64ebc05648fd30694391efc371d97 | [
"MIT"
] | permissive | ihusnainalii/my-swift-journey | 1c73103ad087a5a40f72e8b937da5cf7b992c81e | 72bb9fe115f94af0cad0d5454736e5c026dbc4f5 | refs/heads/master | 2023-02-24T19:11:49.401255 | 2021-01-28T06:33:22 | 2021-01-28T06:33:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 298 | swift | import SwiftUI
import AVKit
class VideoPlayerViewModel: ObservableObject {
// Hero Animation Properties
@Published var showPlayer = false
@Published var offset: CGSize = .zero
@Published var scale: CGFloat = 1
@Published var selectedVideo : Video = Video(player: AVPlayer())
}
| [
-1
] |
a9487085b015d06a4031b6d9952cbee4ccad34b7 | 264835afab77cb8b25dd1e3e94e06ffdd679de08 | /Millas a Metros/ViewController.swift | e1fc6db067c059625aa48365f4afc27f5976353b | [] | no_license | juanmorillios/Millas-a-Metros | 68f73883b51e44786ba013e012fe553b3d594393 | 4d26f6a2258850b4895d88ec5c8bfd811165b515 | refs/heads/master | 2021-01-15T10:34:14.724896 | 2016-09-18T16:01:10 | 2016-09-18T16:01:10 | 68,531,845 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,417 | swift | //
// ViewController.swift
// Millas a Metros
//
// Created by Juan Morillo on 18/9/16.
// Copyright © 2016 JuanMorillios. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
let mileUnit : Double = 1.609
@IBOutlet weak var distanceTextField: UITextField!
@IBOutlet weak var segmentedControl: UISegmentedControl!
@IBOutlet weak var resultLabel: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
resultLabel.text = "Escribe la distancia a convertir"
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func convertBtnPressed(_ sender: UIButton) {
let selectedIndex = segmentedControl.selectedSegmentIndex
let texttFieldVal = Double(distanceTextField.text!)! //Casting del valor introducido por el usuario
if selectedIndex == 0 {
let convertedValue = texttFieldVal / mileUnit //Operación del número que introduce el usuario y lo dividimos por la unidad de medida mileUnit
let initValue = String(format: "%.2f", texttFieldVal)
let endValue = String(format: "%.2f", convertedValue)
resultLabel.text = "\(initValue) km = \(endValue) millas " //Presentamos por pantalla el resultado al usuario
print("Convertir a millas \(convertedValue)") //sacamos el mismo resultado por consola
} else if selectedIndex == 1 {
let convertedValue = texttFieldVal * mileUnit //Operación del número que introduce el usuario y lo multiplicamos por la unidad de medida mileUnit
let initValue = String(format: "%.2f", texttFieldVal)
let endValue = String(format: "%.2f", convertedValue)
resultLabel.text = "\(initValue) millas = \(endValue) km." //Presentamos por pantalla el resultado al usuario
print("Debo Convertir a kilometros \(convertedValue)") //sacamos el mismo resultado por consola
} else {
print("Nada se ha convertido")
}
}
}
| [
-1
] |
462b674341312e62849ff0f17c26d12cc4f38a86 | b284637a24626b1fe5c4bf46db6ca0a8b20b587a | /Tests/WWLayoutTests/PriorityTests.swift | dc9748ad38054b89e07339f265498487c09b59c0 | [
"Apache-2.0"
] | permissive | ww-tech/wwlayout | 3a7988c9b9f4e29bdb9566b937bf2878e39645ac | c8e74ae42ff24311b445032f19f50895d6e295ae | refs/heads/develop | 2023-06-09T04:06:57.093304 | 2023-06-01T11:01:49 | 2023-06-01T11:01:49 | 160,233,441 | 57 | 15 | Apache-2.0 | 2023-06-01T11:01:50 | 2018-12-03T18:09:11 | Swift | UTF-8 | Swift | false | false | 5,567 | swift | //
// ===----------------------------------------------------------------------===//
//
// PriorityTests.swift
//
// Created by Steven Grosmark on 3/26/18.
// Copyright © 2018 WW International, Inc.
//
//
// This source file is part of the WWLayout open source project
//
// https://github.com/ww-tech/wwlayout
//
// Copyright © 2017-2021 WW International, 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 XCTest
@testable import WWLayout
class PriorityTests: XCTestCase {
private var container: UIView!
override func setUp() {
super.setUp()
container = UIView()
}
override func tearDown() {
super.tearDown()
container = nil
}
func testPriorities() {
let subview = UIView()
container.addSubview(subview)
// default required priority
for constraint in subview.layout.size(200).constraints() {
XCTAssertEqual(constraint.priority, UILayoutPriority.required)
}
// our version of required
for constraint in subview.layout.size(200, priority: .required).constraints() {
XCTAssertEqual(constraint.priority, UILayoutPriority.required)
}
// our version of high
for constraint in subview.layout.fill(.superview, priority: .high).constraints() {
XCTAssertEqual(constraint.priority, UILayoutPriority.defaultHigh)
}
// our version of low, as the default
for constraint in subview.layout(priority: .low).center(in: .superview).constraints() {
XCTAssertEqual(constraint.priority, UILayoutPriority.defaultLow)
}
// set a different default, override it
let constraints = subview.layout(priority: .low)
.left(to: .superview)
.top(to: .superview, priority: .high)
.right(to: .superview)
.constraints()
XCTAssertEqual(constraints[0].priority, UILayoutPriority.defaultLow)
XCTAssertEqual(constraints[1].priority, UILayoutPriority.defaultHigh)
XCTAssertEqual(constraints[2].priority, UILayoutPriority.defaultLow)
}
func testIntLiterals() {
let subview = UIView()
container.addSubview(subview)
for constraint in subview.layout.fill(.superview, priority: 678).constraints() {
XCTAssertEqual(constraint.priority, UILayoutPriority(678))
}
for constraint in subview.layout(priority: 789).center(in: .superview).constraints() {
XCTAssertEqual(constraint.priority, UILayoutPriority(789))
}
}
func testFloatLiterals() {
let subview = UIView()
container.addSubview(subview)
for constraint in subview.layout.fill(.superview, priority: 123.4).constraints() {
XCTAssertEqual(constraint.priority, UILayoutPriority(123.4))
}
for constraint in subview.layout(priority: 567.8).center(in: .superview).constraints() {
XCTAssertEqual(constraint.priority, UILayoutPriority(567.8))
}
}
func testAdditionSubtraction() {
// + operator
XCTAssertEqual((LayoutPriority.high + 2).rawValue, LayoutPriority.high.rawValue + 2)
XCTAssertEqual((LayoutPriority.low + 1.7).rawValue, LayoutPriority.low.rawValue + 1.7)
XCTAssertEqual((LayoutPriority.required + 1).rawValue, LayoutPriority.required.rawValue)
// - operator
XCTAssertEqual((LayoutPriority.low - 5).rawValue, LayoutPriority.low.rawValue - 5)
XCTAssertEqual((LayoutPriority.required - 3.14).rawValue, LayoutPriority.required.rawValue - 3.14)
XCTAssertEqual((LayoutPriority.low - 999).rawValue, 0)
// +=
var priority: LayoutPriority = .high
var value = priority.rawValue
priority += 1
value += 1
XCTAssertEqual(priority.rawValue, value)
priority += 12.8
value += 12.8
XCTAssertEqual(priority.rawValue, value)
// -=
priority -= 1
value -= 1
XCTAssertEqual(priority.rawValue, value)
priority -= 2.5
value -= 2.5
XCTAssertEqual(priority.rawValue, value)
// test with a view
let subview = UIView()
container.addSubview(subview)
for constraint in subview.layout.size(200, priority: .required - 1).constraints() {
XCTAssertEqual(constraint.priority.rawValue, UILayoutPriority.required.rawValue - 1)
}
}
func testEquatable() {
XCTAssertEqual(LayoutPriority.required, 1000.0)
XCTAssertEqual(LayoutPriority.high, 750)
XCTAssertEqual(LayoutPriority.low, 250)
let priority: LayoutPriority = .low - 1
XCTAssertEqual(priority, LayoutPriority(rawValue: 249))
}
}
| [
-1
] |
e795093a018e75dd70e6e726a3e15e308eb79763 | d832b501d3842fc63f14a3b4a46c69688eb73d2a | /AMSwift/Module/Beauty/Controller/AMBeautyController.swift | c9bb6a017292b95b3878ad6567d0e448095f532a | [] | no_license | edwardboy/AMSwift | 5227b5501868ee9b5c307d552e0d10dd02dce5cb | e4f3507a0320823e98acacfe1c4499d256fb0de0 | refs/heads/master | 2020-05-06T12:16:49.792768 | 2019-05-29T09:10:04 | 2019-05-29T09:10:04 | 180,114,159 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 772 | swift | //
// AMBeautyController.swift
// AMSwift
//
// Created by gyh on 2019/4/10.
// Copyright © 2019 gyh. All rights reserved.
//
import UIKit
class AMBeautyController: AMBaseController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func setupView() {
self.view.backgroundColor = UIColor.orange
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/
}
| [
-1
] |
7fb948abd6d48605f5559fffcf66829975334c2f | 93781e32db3e52c2fa5a037143613746744162f3 | /Tests/macOS/MMDSceneKit_macOSTests.swift | e6bb489392bb63e4f5e8cefe2e98af7f95f1eb5e | [
"MIT"
] | permissive | 8secz-johndpope/MMDSceneKit | 2fef13900827c190a6016075a597ed4f2061c4e8 | 53f0c043e90f6537e2519f3e7d6061028687b8bd | refs/heads/master | 2020-09-04T00:49:12.606009 | 2018-09-30T08:46:51 | 2018-09-30T08:46:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,015 | swift | //
// MMDSceneKit_macOSTests.swift
// MMDSceneKit_macOSTests
//
// Created by magicien on 12/9/15.
// Copyright © 2015 DarkHorse. All rights reserved.
//
/*
import XCTest
@testable import MMDSceneKit_macOS
class MMDSceneKit_macOSTests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measureBlock {
// Put the code you want to measure the time of here.
}
}
}
*/
| [
-1
] |
10a89c0312c157cdaee6ada624272dca759b2d04 | a87252764f7ccd07b15102ac1244d53ecaa46a2b | /Millionaire/App/Entity/GameResult.swift | 62c07f3f948dd1b9aee7634db3e03945e1173b12 | [] | no_license | VBozhenov/Millionaire | bad2aa2cfa60587760666b3e721e60258fb00d69 | 5a83e1234ed3ee22456de755cf435876c140c618 | refs/heads/master | 2020-08-14T06:41:49.610241 | 2019-10-16T21:29:48 | 2019-10-16T21:29:48 | 215,115,779 | 0 | 0 | null | 2019-11-16T17:50:18 | 2019-10-14T18:21:19 | Swift | UTF-8 | Swift | false | false | 294 | swift | //
// GameResult.swift
// Millionaire
//
// Created by Vladimir Bozhenov on 15.10.2019.
// Copyright © 2019 Vladimir Bozhenov. All rights reserved.
//
import Foundation
struct GameResult: Codable {
// MARK: - Properties
let date: Date
let percentOfCorrectAnswers: Int
}
| [
-1
] |
3eeb02a8b871b76149a8292e3643a6140acbf775 | b7ad40d860a4d46d2720af990a96f4e60785862c | /eucountries/MasterViewController.swift | 91b49b7c4a228459802c916a4b81a9ab2b705e14 | [] | no_license | tuulik/m4d-harkkatyo | 0f815dd66cbcf757e86f50616c3b67114d643990 | 8175e0cec87fcb40aabebde69906202d375808e4 | refs/heads/master | 2020-03-14T21:37:09.856561 | 2018-05-19T14:45:16 | 2018-05-19T14:45:16 | 131,800,656 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,643 | swift | //
// MasterViewController.swift
// eucountries
//
// Created by Tuuli Kähkönen on 28/04/2018.
// Copyright © 2018 Tuuli Kähkönen. All rights reserved.
//
import UIKit
class MasterViewController: UITableViewController {
var detailViewController: DetailViewController? = nil
var countries = [eucountries.Country]()
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
/*navigationItem.leftBarButtonItem = editButtonItem
let addButton = UIBarButtonItem(barButtonSystemItem: .add, target: self, action: #selector(insertNewObject(_:)))
navigationItem.rightBarButtonItem = addButton
*/
for country in eucountries.countries {
insertNewCountry(country)
}
if let split = splitViewController {
let controllers = split.viewControllers
detailViewController = (controllers[controllers.count-1] as! UINavigationController).topViewController as? DetailViewController
}
}
override func viewWillAppear(_ animated: Bool) {
clearsSelectionOnViewWillAppear = splitViewController!.isCollapsed
super.viewWillAppear(animated)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func insertNewCountry(_ country: Country) {
countries.insert(country, at: 0)
let indexPath = IndexPath(row: 0, section: 0)
tableView.insertRows(at: [indexPath], with: .automatic)
}
// MARK: - Segues
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "showDetail" {
if let indexPath = tableView.indexPathForSelectedRow {
let country = countries[indexPath.row]
let controller = (segue.destination as! UINavigationController).topViewController as! DetailViewController
controller.detailItem = country
controller.countries = countries
controller.navigationItem.leftBarButtonItem = splitViewController?.displayModeButtonItem
controller.navigationItem.leftItemsSupplementBackButton = true
}
}
}
// MARK: - Table View
override func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return countries.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath)
let country = countries[indexPath.row]
cell.textLabel!.text = country.name
cell.imageView?.image = UIImage(named: country.code)
return cell
}
override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
// Return false if you do not want the specified item to be editable.
return false
}
override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
if editingStyle == .delete {
countries.remove(at: indexPath.row)
tableView.deleteRows(at: [indexPath], with: .fade)
} else if editingStyle == .insert {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view.
}
}
}
| [
339096,
129177,
287449,
287302
] |
ca8b287dcbf69cfdba2cbbfe417a09b6b38eab22 | 97f7d019c3b92d15e46841730641dd8c860fc3d0 | /pokeApp/Features/FavoriteList/Presenter/FavoriteListViewProtocol.swift | 8e3a094e2c2888372bfe43c2c6f3eeef683dd270 | [] | no_license | rafsouzap/pokeApp | e27166f53411025ed56c4fdd4f9d4be0f7349687 | 451af063e7ce2de18d87f854ec8cb2a1de342619 | refs/heads/master | 2020-03-10T03:55:31.732053 | 2018-04-19T05:55:57 | 2018-04-19T05:55:57 | 129,178,810 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 361 | swift | //
// FavoriteListViewProtocol.swift
// pokeApp
//
// Created by Rafael de Paula on 19/04/18.
// Copyright © 2018 Rafael de Paula. All rights reserved.
//
protocol FavoriteListViewProtocol: class {
func showLoading()
func hideLoading()
func reloadTableView()
func showAlertError(with title: String, message: String, buttonTitle: String)
}
| [
-1
] |
6e65783ccd3cd92ca045cee78d230643fbffa84a | 5c8a4c21cb31039625192b25be30f342f0aaeb9f | /CoreDataHW/Controllers/AllContactsViewController.swift | 8885621cc405eea046ba89d9f1dd70969058f9fc | [] | no_license | vadimshoshin/CoreDataHW | ccf53e6a22d75ac59715aec6fa99759f651d93ba | 12136cda10ce4350ee3320917ebe40189366e336 | refs/heads/master | 2021-09-03T08:56:52.932866 | 2018-01-07T20:42:05 | 2018-01-07T20:42:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,349 | swift | //
// AllContactsViewController.swift
// CoreDataHW
//
// Created by Vadim Shoshin on 06.01.2018.
// Copyright © 2018 Vadim Shoshin. All rights reserved.
//
import UIKit
class AllContactsViewController: UITableViewController {
override func viewDidLoad() {
super.viewDidLoad()
addObservers()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
DataManager.instance.loadContacts()
}
private func addObservers() {
NotificationCenter.default.addObserver(self, selector: #selector(datasourceChanged), name: .contactAdded, object: nil)
//NotificationCenter.default.addObserver(self, selector: #selector(datasourceChanged), name: .contactDeleted, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(datasourceChanged), name: .contactUpdated, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(datasourceChanged), name: .contactsLoaded, object: nil)
}
// MARK: - Table view data source
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return DataManager.instance.allContacts.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "reuseIdentifier", for: indexPath)
let item = DataManager.instance.allContacts[indexPath.row]
cell.textLabel?.text = item.fullName
return cell
}
/*
// Override to support conditional editing of the table view.
override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
// Return false if you do not want the specified item to be editable.
return true
}
*/
// Override to support editing the table view.
override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
guard editingStyle == .delete else { return }
let item = DataManager.instance.allContacts[indexPath.row]
DataManager.instance.deleteContact(item)
tableView.deleteRows(at: [indexPath], with: .fade)
}
/*
// Override to support rearranging the table view.
override func tableView(_ tableView: UITableView, moveRowAt fromIndexPath: IndexPath, to: IndexPath) {
}
*/
// 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?) {
guard segue.identifier == "showDetailsScreen", let destVC = segue.destination as? ContactDetailsViewController
else { return }
guard let cell = sender as? UITableViewCell else { return }
guard let index = tableView.indexPath(for: cell) else { return }
let transferredContact = DataManager.instance.allContacts[index.row]
destVC.contactToShow = transferredContact
}
}
extension AllContactsViewController {
@objc func datasourceChanged() {
tableView.reloadData()
}
}
| [
-1
] |
36c6e2558f63c9ed284129e7f2024db408550146 | 42f353de98da2cc69bdc59538cab116c4239d556 | /PersistenciaNetwork/AulaSemana1/MyGames/MyGames/ConsoleViewController.swift | 90088b1336477958174ec3dcd2c1674926e3b6af | [
"MIT"
] | permissive | jacielferreira/cesar.school.ios.2020.devapps.2019.1 | a9e655b3d0e028e0e8c0754f062306ad1c9835d4 | cde0606da70a61014edae4526af415826705f120 | refs/heads/master | 2022-10-19T10:34:25.028090 | 2020-06-07T20:58:16 | 2020-06-07T20:58:16 | 267,967,325 | 0 | 0 | MIT | 2020-05-29T22:30:13 | 2020-05-29T22:30:13 | null | UTF-8 | Swift | false | false | 1,175 | swift | //
// ConsoleViewController.swift
// MyGames
//
// Created by Jaciel Ferreira da Siva on 28/05/20.
// Copyright © 2020 Douglas Frari. All rights reserved.
//
import UIKit
class ConsoleViewController: UIViewController {
@IBOutlet weak var lbConsoleTitle: UILabel!
@IBOutlet weak var IvConsoleCover: UIImageView!
var console: Console?
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
lbConsoleTitle.text = console?.name
if let image = console?.cover as? UIImage {
IvConsoleCover.image = image
} else {
IvConsoleCover.image = UIImage(named: "noCoverFull")
}
}
// 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?) {
let vc = segue.destination as! AddEditConsoleViewController
vc.console = console
}
}
| [
-1
] |
c41748694b919ce58e6b771b1b7041f4d6ea34c3 | 3b7554cdf3de24ba5c05b7a6d63758910c3e6f33 | /Example/ConsentViewController_ExampleTests/Helpers/GDPRUIiDelegateMock.swift | 6796ec6e7c6d0ba67d06453a1e504e0fb2ea3b38 | [
"MIT"
] | permissive | mumer92/ios-cmp-app | a3a2814bdab37f4a14880426009c2d51434fcae2 | b802bda61e689afc1607f21941ead5bad1d8ec48 | refs/heads/master | 2023-05-31T12:57:27.395183 | 2021-06-04T13:54:47 | 2021-06-04T13:54:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 738 | swift | //
// GDPRMessageUiDelegateMock.swift
// ConsentViewController_ExampleTests
//
// Created by Andre Herculano on 17.06.20.
// Copyright © 2020 CocoaPods. All rights reserved.
//
import Foundation
@testable import ConsentViewController
class GDPRUIDelegateMock: GDPRMessageUIDelegate {
weak var consentDelegate: SPDelegate?
var loadMessageCalled = false
var loadPrivacyManagerCalled = false
var loadMessageCalledWith: URL?
init(_ consentDelegate: SPDelegate) {
self.consentDelegate = consentDelegate
}
func loadMessage(fromUrl url: URL) {
loadMessageCalled = true
loadMessageCalledWith = url
}
func loadPrivacyManager() {
loadPrivacyManagerCalled = true
}
}
| [
-1
] |
629f49885fddf7ad6d2dfb888af3c948d3d25518 | 2d33fa4e6f6a3f05580e5ccc369a3e9b6d6db42d | /src/wsm/wsm/base/RequestBaseViewController.swift | bc1273eabcd84f3db7c2fa1d79c49070ddabb713 | [] | 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 | 4,893 | swift | //
// RequestBaseViewController.swift
// wsm
//
// Created by framgia on 9/28/17.
// Copyright © 2017 framgia. All rights reserved.
//
import Foundation
import UIKit
import InAppLocalize
class RequestBaseViewController: NoMenuBaseViewController {
@IBOutlet weak var scrollView: UIScrollView!
@IBOutlet weak var contentView: UIView!
@IBOutlet weak var empNameTextField: WsmTextField!
@IBOutlet weak var empCodeTextField: WsmTextField!
@IBOutlet weak var branchTextField: WsmTextField!
@IBOutlet weak var groupTextField: WsmTextField!
@IBOutlet weak var projectNameTextField: WsmTextField!
@IBOutlet weak var reasonTextField: WsmTextField!
let branchPicker = UIPickerView()
let groupPicker = UIPickerView()
let currentUser = UserServices.getLocalUserProfile()
var workSpaces = [UserWorkSpace]()
var groups = [UserGroup]()
override func viewDidLoad() {
super.viewDidLoad()
registerKeyboardNotifications()
workSpaces = currentUser?.workSpaces ?? [UserWorkSpace]()
groups = currentUser?.groups ?? [UserGroup]()
bindData()
setupPicker()
}
deinit {
NotificationCenter.default.removeObserver(self)
}
func setupPicker() {
branchPicker.delegate = self
groupPicker.delegate = self
branchTextField.inputView = branchPicker
branchTextField.inputAccessoryView = UIToolbar().ToolbarPiker(selector: #selector(onBranchSelected))
groupTextField.inputView = groupPicker
groupTextField.inputAccessoryView = UIToolbar().ToolbarPiker(selector: #selector(onGroupSelected))
}
func bindData() {
empNameTextField.text = currentUser?.name
empCodeTextField.text = currentUser?.employeeCode
if workSpaces.count > 0 {
let defaultBranchId = UserServices.getLocalUserSetting()?.workSpaceDefault
if let i = workSpaces.index(where: {$0.id == defaultBranchId}) {
branchPicker.selectRow(i, inComponent: 0, animated: true)
} else {
branchPicker.selectRow(0, inComponent: 0, animated: true)
}
onBranchSelected()
}
if groups.count > 0 {
let defaultGroupId = UserServices.getLocalUserSetting()?.groupDefault
if let i = groups.index(where: {$0.id == defaultGroupId}) {
groupPicker.selectRow(i, inComponent: 0, animated: true)
} else {
groupPicker.selectRow(0, inComponent: 0, animated: true)
}
onGroupSelected()
}
}
@objc func onBranchSelected() {
self.view.endEditing(true)
branchTextField.text = workSpaces[branchPicker.selectedRow(inComponent: 0)].name
}
@objc func onGroupSelected() {
self.view.endEditing(true)
groupTextField.text = groups[groupPicker.selectedRow(inComponent: 0)].fullName
}
}
extension RequestBaseViewController: UIPickerViewDelegate, UIPickerViewDataSource {
func numberOfComponents(in pickerView: UIPickerView) -> Int {
return 1
}
func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
return pickerView === branchPicker ? workSpaces.count : groups.count
}
func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
return pickerView === branchPicker ? workSpaces[row].name : groups[row].fullName
}
}
extension RequestBaseViewController {
func registerKeyboardNotifications() {
NotificationCenter.default.addObserver(self,
selector: #selector(keyboardWillShow(notification:)),
name: NSNotification.Name.UIKeyboardWillShow,
object: nil)
NotificationCenter.default.addObserver(self,
selector: #selector(keyboardWillHide(notification:)),
name: NSNotification.Name.UIKeyboardWillHide,
object: nil)
}
func keyboardWillShow(notification: NSNotification) {
let userInfo: NSDictionary = notification.userInfo! as NSDictionary
guard let keyboardInfo = userInfo[UIKeyboardFrameEndUserInfoKey] as? NSValue else {
return
}
let keyboardSize = keyboardInfo.cgRectValue.size
let contentInsets = UIEdgeInsets(top: 0, left: 0, bottom: keyboardSize.height, right: 0)
scrollView.contentInset = contentInsets
scrollView.scrollIndicatorInsets = contentInsets
}
func keyboardWillHide(notification: Notification) {
scrollView.contentInset = .zero
scrollView.scrollIndicatorInsets = .zero
}
}
| [
-1
] |
0ba5897813d627142c23cfea19900ae86b3b73fa | 7e710e278cc71b6699e7905c919c192dc77fb311 | /NewsApp/Core/BaseWireframe.swift | aebd94777af3fdd3e21cd960261e4eb119318092 | [] | no_license | ahmdmhasn/NewsApp | 55c1792532519a12f5864a22d2f63dee35bee6f9 | 9f1ef474fbd7ab725dc4f5bc0ca36ac71497b1e9 | refs/heads/main | 2023-07-14T01:53:45.662820 | 2021-08-14T06:55:33 | 2021-08-14T06:55:33 | 399,744,780 | 0 | 0 | null | 2021-08-25T08:37:23 | 2021-08-25T08:26:06 | null | UTF-8 | Swift | false | false | 567 | swift | //
// BaseWireframe.swift
// ViberTemplate
//
// Created by Abdelrhman Eliwa on 05/05/2021.
//
import UIKit
protocol BaseProtocol: ProgressDisplayerProtocol, AlertDisplayerProtocol { }
class BaseWireframe: UIViewController, BaseProtocol {
var currentLanguage: String {
"CurrentAppLanguage".localized
}
// MARK: Init
required init() {
super.init(nibName: String(describing: type(of: self)), bundle: nil)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
| [
-1
] |
f90e58bf44849f87b05913a7b2c355b2701e819e | 1cd0293b8874dbca36172dadf475dd18a5c839a6 | /PizzaWatch WatchKit Extension/SelMasaPizza.swift | df3a327bc562121a717dc9b89bc086575b4dfc6b | [] | no_license | johhns/iWatchApp | 303e7335b69c17effa4b3c47d0fc9e9890bd7b85 | 75670880a2dd71b4c563effea5a0f1b265ab9b6f | refs/heads/master | 2021-01-10T09:52:23.983907 | 2016-02-25T03:44:10 | 2016-02-25T03:44:10 | 52,494,291 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,193 | swift | //
// SelMasaPizza.swift
// PizzaWatch
//
// Created by Juan Sanchez on 24/2/16.
// Copyright © 2016 Juan Sanchez. All rights reserved.
//
import WatchKit
import Foundation
class SelMasaPizza: WKInterfaceController {
var pizza = Pizza()
let lista_masas = ["Delgada", "Crujiente", "Gruesa"]
@IBOutlet var lblMasa: WKInterfaceLabel!
@IBAction func sldMasa(value: Float) {
let indice = Int(value)
lblMasa.setText(lista_masas[indice])
self.pizza.masa = lista_masas[indice]
}
@IBAction func btnConfirmarMasa() {
pushControllerWithName("seleccionQueso", context: pizza)
}
override func awakeWithContext(context: AnyObject?) {
super.awakeWithContext(context)
pizza = context! as! Pizza
// Configure interface objects here.
}
override func willActivate() {
// This method is called when watch view controller is about to be visible to user
super.willActivate()
}
override func didDeactivate() {
// This method is called when watch view controller is no longer visible
super.didDeactivate()
}
}
| [
-1
] |
f2df00b54763b19fceca5cb72378e84590b9cb20 | 96d810724f158a7f62e9b12fb6a12f0b77724c18 | /OTPLogin/Views/RewardViewController.swift | a6b369a6cf00db029cfe05d8ae9a4f95c4b1952d | [] | no_license | liyu-wang/OTPLogin | ca6960763197289c7ffea507cc9fc11d723fda66 | 36688205bbf731feac756e3091e38a7c77a8b5ea | refs/heads/master | 2020-06-14T08:23:15.767248 | 2019-07-10T11:26:46 | 2019-07-10T11:26:46 | 194,958,715 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,946 | swift | //
// RewardViewController.swift
// OTPLogin
//
// Created by Liyu Wang on 4/7/19.
// Copyright © 2019 Liyu Wang. All rights reserved.
//
import UIKit
import RxSwift
import RxCocoa
import Lottie
class RewardViewController: BaseViewController {
private let animationView = AnimationView()
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
self.configAnimationView()
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
self.animationView.play(
fromProgress: 0,
toProgress: 1,
loopMode: LottieLoopMode.loop,
completion: { (finished) in
if finished {
print("Animation Complete")
} else {
print("Animation cancelled")
}
}
)
}
}
// MARK: - UI
extension RewardViewController {
private func configAnimationView() {
guard let animation = Animation.named("1138-deer", subdirectory: nil) else { return }
self.animationView.animation = animation
self.animationView.contentMode = .scaleAspectFit
self.animationView.backgroundBehavior = .pauseAndRestore
self.animationView.translatesAutoresizingMaskIntoConstraints = false
self.view.addSubview(self.animationView)
NSLayoutConstraint.activate([
self.animationView.leadingAnchor.constraint(equalTo: self.view.leadingAnchor),
self.animationView.trailingAnchor.constraint(equalTo: self.view.trailingAnchor),
self.animationView.centerYAnchor.constraint(equalTo: self.view.centerYAnchor),
self.animationView.heightAnchor.constraint(equalTo: self.animationView.widthAnchor, multiplier: animation.size.height / animation.size.width)
])
}
}
| [
-1
] |
e2772c7c3b23d1b3ca85a2afe0e94b487a427f65 | 4f5d9b5dd5eafae5fc4183d908bd6574460e64d7 | /Teste com Mocks/Leilao/Models/GeradorDePagamentos.swift | d8fb44b2a1641ee0bf6bd152e183df35b618ec6c | [] | no_license | KathLouise/Testes-Swift-Leilao | c7b6183bf2767fe179499d140f2824d41254ed91 | 35c89082129d144b1523603d2c23c106eacedba6 | refs/heads/master | 2020-04-26T18:08:40.040899 | 2019-03-07T13:54:08 | 2019-03-07T13:54:08 | 173,735,571 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,490 | swift | //
// GeradorDePagamentos.swift
// Leilao
//
// Created by Katheryne Graf on 05/03/19.
// Copyright © 2019 Alura. All rights reserved.
//
import Foundation
class GeradorDePagamentos {
private var leiloes: LeilaoDao;
private var avaliador: Avaliador;
private var repositorioDePagamentos: RepositorioDePagamentos;
private var data: Date;
init(_ leiloes: LeilaoDao, _ avaliador: Avaliador, _ repositorioDePagamentos: RepositorioDePagamentos, _ data: Date) {
self.leiloes = leiloes;
self.avaliador = avaliador;
self.repositorioDePagamentos = repositorioDePagamentos;
self.data = data;
}
convenience init(_ leiloes: LeilaoDao, _ avaliador: Avaliador, _ repositorioDePagamentos: RepositorioDePagamentos) {
self.init(leiloes, avaliador, repositorioDePagamentos, Date());
}
func gera(){
let leiloesEncerrados = self.leiloes.encerrados();
for leilao in leiloesEncerrados {
try? avaliador.avalia(leilao: leilao);
let novoPagamento = Pagamentos(avaliador.maiorLance(), proximoDiaUtil());
repositorioDePagamentos.salva(novoPagamento);
}
}
func proximoDiaUtil() -> Date{
var dataAtual = data;
while Calendar.current.isDateInWeekend(dataAtual){
dataAtual = Calendar.current.date(byAdding: .day, value: 1, to: dataAtual)!
}
return dataAtual;
}
}
| [
-1
] |
b2c9ab63c0c331b241a1efa79b682b272770437b | 27dceedab16e3a92f86fc4d67892c11f8da61a37 | /GestureAppV1/GestureAppV1/AppDelegate.swift | d22f3432afb422b16ad716aaf32bf50d9933e480 | [] | no_license | RobJWong/CF | 0b1c802c5da95ad7a523b988b5e7647b6c5e6aa6 | 59c5d877118561b424c534474ac376d96f877cb5 | refs/heads/master | 2020-12-02T19:38:27.244642 | 2018-07-12T20:00:10 | 2018-07-12T20:00:10 | 96,358,015 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,175 | swift | //
// AppDelegate.swift
// GestureAppV1
//
// Created by Robert Wong on 8/2/17.
// Copyright © 2017 Robert Wong. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
| [
229380,
229383,
229385,
294924,
229388,
278542,
229391,
327695,
278545,
229394,
278548,
229397,
229399,
229402,
278556,
229405,
278559,
229408,
278564,
294950,
229415,
229417,
327722,
237613,
229422,
360496,
229426,
237618,
229428,
311349,
286774,
286776,
319544,
286778,
229432,
204856,
286791,
237640,
286797,
278605,
311375,
163920,
237646,
196692,
319573,
311383,
319590,
311400,
278635,
303212,
278639,
131192,
278648,
237693,
303230,
327814,
303241,
131209,
417930,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
131264,
286916,
295110,
286922,
286924,
286926,
319694,
286928,
131281,
278743,
278747,
295133,
155872,
319716,
237807,
303345,
286962,
131314,
229622,
327930,
278781,
278783,
278785,
237826,
319751,
278792,
286987,
319757,
311569,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
295220,
287032,
155966,
319809,
319810,
278849,
319814,
311623,
319818,
311628,
229709,
319822,
287054,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
319879,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
278980,
98756,
278983,
319945,
278986,
319947,
278990,
278994,
311767,
279003,
279006,
188895,
172512,
287202,
279010,
279015,
172520,
319978,
279020,
172526,
311791,
279023,
172529,
279027,
319989,
172534,
180727,
164343,
279035,
311804,
287230,
279040,
303617,
287234,
279045,
172550,
303623,
172552,
287238,
320007,
279051,
172558,
279055,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
279082,
311850,
279084,
172591,
172598,
279095,
172607,
172609,
172612,
377413,
172614,
172618,
303690,
33357,
287309,
303696,
279124,
172634,
262752,
172644,
311911,
189034,
295533,
172655,
172656,
352880,
295538,
189039,
172660,
287349,
189040,
189044,
287355,
287360,
295553,
172675,
295557,
287365,
311942,
303751,
352905,
279178,
287371,
311946,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
172702,
164509,
303773,
172705,
287394,
172707,
303780,
287390,
287398,
205479,
279208,
287400,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
328384,
172737,
279231,
287427,
312005,
312006,
107208,
172748,
287436,
107212,
172751,
287440,
295633,
172755,
303827,
279255,
172760,
287450,
303835,
279258,
189149,
303838,
213724,
312035,
279267,
295654,
279272,
230128,
312048,
312050,
230131,
205564,
303871,
230146,
328453,
295685,
230154,
33548,
312077,
295695,
295701,
230169,
369433,
295707,
328476,
295710,
230175,
295720,
303914,
279340,
205613,
279353,
230202,
312124,
328508,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
279390,
230241,
279394,
303976,
336744,
303985,
328563,
303987,
279413,
303991,
303997,
295806,
295808,
295813,
304005,
320391,
213895,
304007,
304009,
304011,
230284,
304013,
295822,
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,
295949,
197645,
320528,
140312,
295961,
238620,
197663,
304164,
304170,
304175,
238641,
312374,
238652,
238655,
230465,
238658,
336964,
296004,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
205931,
296044,
279661,
205934,
164973,
312432,
279669,
337018,
189562,
279679,
304258,
279683,
222340,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
238766,
165038,
230576,
238770,
304311,
230592,
312518,
279750,
230600,
230607,
148690,
320727,
279769,
304348,
279777,
304354,
296163,
320740,
279781,
304360,
320748,
279788,
279790,
304370,
296189,
320771,
312585,
296202,
296205,
230674,
320786,
230677,
296213,
296215,
320792,
230681,
230679,
214294,
304416,
230689,
173350,
312622,
296243,
312630,
222522,
296253,
222525,
296255,
312639,
230718,
296259,
378181,
296262,
230727,
238919,
296264,
320840,
296267,
296271,
222545,
230739,
312663,
222556,
337244,
230752,
312676,
230760,
173418,
148843,
410987,
230763,
230768,
296305,
312692,
230773,
304505,
304506,
181626,
181631,
148865,
312711,
312712,
296331,
288140,
288144,
230800,
304533,
337306,
288154,
288160,
173472,
288162,
288164,
279975,
304555,
370092,
279983,
173488,
288176,
279985,
312755,
296373,
312759,
279991,
288185,
337335,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
288210,
370130,
222676,
288212,
288214,
280021,
239064,
288217,
329177,
280027,
288220,
288218,
239070,
288224,
280034,
288226,
280036,
288229,
280038,
288230,
288232,
370146,
320998,
288234,
288236,
288238,
288240,
288242,
296435,
288244,
288250,
296446,
321022,
402942,
206336,
296450,
148990,
230916,
230919,
214535,
230923,
304651,
304653,
370187,
230940,
222752,
108066,
296486,
296488,
157229,
239152,
230961,
157236,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
288344,
280152,
239194,
280158,
403039,
370272,
181854,
239202,
312938,
280183,
280185,
280188,
280191,
116354,
280194,
280208,
280211,
288408,
280218,
280222,
190118,
198310,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
313027,
280260,
206536,
280264,
206539,
206541,
206543,
313044,
280276,
321239,
280283,
313052,
18140,
288478,
313055,
321252,
313066,
288494,
280302,
280304,
313073,
321266,
288499,
419570,
288502,
280314,
288510,
124671,
67330,
280324,
198405,
288519,
280331,
198416,
280337,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
296767,
288576,
345921,
280388,
337732,
304968,
280393,
280402,
173907,
313171,
313176,
280419,
321381,
296809,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280464,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
280487,
313258,
321458,
296883,
124853,
214966,
296890,
10170,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
239586,
313320,
231404,
124913,
165876,
321528,
239612,
313340,
288764,
239617,
313347,
288773,
313358,
305176,
321560,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
378941,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
149599,
280671,
149601,
321634,
149603,
223327,
329830,
280681,
313451,
223341,
280687,
149618,
215154,
313458,
280691,
313464,
329850,
321659,
280702,
288895,
321670,
215175,
141446,
141455,
141459,
280725,
313498,
100520,
288936,
280747,
288940,
288947,
280755,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
313548,
321740,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
157930,
280811,
280817,
125171,
157940,
280819,
182517,
280823,
280825,
280827,
280830,
280831,
280833,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
305464,
280888,
280891,
289087,
108865,
280897,
280900,
305480,
239944,
280906,
239947,
305485,
305489,
379218,
280919,
354653,
313700,
280937,
313705,
190832,
280946,
223606,
313720,
280956,
239997,
280959,
313731,
199051,
240011,
289166,
240017,
297363,
190868,
240021,
297365,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
289210,
305594,
281024,
289218,
289221,
289227,
281045,
281047,
215526,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
240132,
281095,
223752,
150025,
338440,
330244,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
281179,
338528,
338532,
281190,
199273,
281196,
19053,
158317,
313973,
297594,
281210,
158347,
182926,
133776,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
199364,
297671,
158409,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322314,
322318,
281361,
281372,
322341,
215850,
281388,
289593,
281401,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
281442,
174955,
224110,
207733,
207737,
158596,
183172,
240519,
322440,
314249,
338823,
183184,
142226,
289687,
240535,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
281567,
289762,
322534,
297961,
183277,
281581,
322550,
134142,
322563,
314372,
330764,
175134,
322599,
322610,
314421,
281654,
314427,
314433,
207937,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
289912,
248995,
306341,
306344,
306347,
322734,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
126190,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
257334,
216376,
380226,
298306,
224584,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
290171,
314747,
306555,
290174,
298365,
224641,
281987,
298372,
314756,
281990,
224647,
265604,
298377,
314763,
142733,
298381,
314768,
224657,
306581,
314773,
314779,
314785,
314793,
282025,
282027,
241068,
241070,
241072,
282034,
241077,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
290291,
282101,
241142,
191992,
290298,
151036,
290302,
282111,
290305,
175621,
306694,
192008,
323084,
257550,
290321,
282130,
323090,
290325,
282133,
241175,
290328,
282137,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
282186,
224849,
282195,
282199,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
324757,
282261,
175770,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
306856,
196133,
282295,
282300,
323260,
323266,
282310,
323273,
282319,
306897,
241362,
306904,
282328,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
241450,
282410,
306988,
306991,
315184,
323376,
315190,
241464,
159545,
282425,
298811,
118593,
307009,
413506,
307012,
241475,
148946,
315211,
282446,
307027,
315221,
323414,
315223,
241496,
241498,
307035,
307040,
110433,
282465,
241509,
110438,
298860,
110445,
282478,
315249,
110450,
315251,
282481,
315253,
315255,
339838,
315267,
282499,
315269,
241544,
282505,
241546,
241548,
298896,
298898,
282514,
241556,
44948,
298901,
241560,
282520,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
36779,
241581,
282542,
241583,
323504,
241586,
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,
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,
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,
282881,
184579,
184586,
282893,
291089,
282906,
291104,
233766,
299304,
295583,
176435,
307508,
315701,
332086,
307510,
307512,
168245,
307515,
307518,
282942,
282947,
323917,
110926,
282957,
233808,
323921,
315733,
323926,
233815,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299388,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
315801,
291226,
242075,
283033,
194654,
61855,
291231,
283042,
291238,
291241,
127403,
127405,
291247,
299440,
127407,
299444,
127413,
291254,
283062,
127417,
291260,
127421,
283069,
127424,
299457,
127429,
127431,
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,
283161,
242202,
234010,
135707,
242206,
135710,
242208,
291361,
242220,
291378,
234038,
152118,
234041,
315961,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
291456,
135808,
373383,
299655,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
225948,
135839,
299680,
225954,
299684,
135844,
242343,
209576,
242345,
373421,
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,
226053,
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,
291711,
234368,
291714,
234370,
291716,
234373,
201603,
226182,
234375,
308105,
324490,
226185,
234379,
234384,
234388,
234390,
324504,
234393,
209818,
308123,
234396,
324508,
291742,
226200,
234398,
234401,
291747,
291748,
234405,
291750,
234407,
324520,
324518,
324522,
234410,
291756,
226220,
291754,
324527,
291760,
234417,
201650,
324531,
234414,
234422,
226230,
275384,
324536,
234428,
291773,
242623,
324544,
234431,
234434,
324546,
324548,
226245,
234437,
234439,
226239,
234443,
291788,
234446,
275406,
193486,
234449,
316370,
193488,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234475,
234478,
316400,
234481,
316403,
234484,
234485,
234487,
324599,
234490,
234493,
316416,
234496,
308226,
234501,
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,
234648,
275606,
234650,
275608,
308379,
300189,
324766,
119967,
234653,
324768,
234657,
283805,
242852,
300197,
234661,
283813,
234664,
275626,
234667,
316596,
308414,
234687,
300223,
300226,
308418,
234692,
300229,
308420,
308422,
226500,
283844,
300234,
283850,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
300267,
161003,
300270,
300272,
120053,
300278,
275703,
316663,
300284,
275710,
300287,
292097,
300289,
161027,
300292,
300294,
275719,
234760,
177419,
300299,
242957,
300301,
283917,
177424,
275725,
349464,
283939,
259367,
292143,
283951,
300344,
226617,
243003,
283963,
226628,
300357,
283973,
177482,
283983,
316758,
357722,
316766,
292192,
316768,
218464,
292197,
316774,
243046,
218473,
284010,
136562,
324978,
275834,
333178,
275836,
275840,
316803,
316806,
226696,
316811,
226699,
316814,
226703,
300433,
234899,
300436,
226709,
357783,
316824,
316826,
144796,
300448,
144807,
144810,
144812,
284076,
144814,
144820,
374196,
284084,
292279,
284087,
144826,
144828,
144830,
144832,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
292338,
226802,
227440,
316917,
308727,
292343,
300537,
316933,
316947,
308757,
308762,
284191,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
194101,
284213,
316983,
194103,
284215,
308790,
284218,
226877,
292414,
284223,
284226,
284228,
292421,
226886,
284231,
128584,
243268,
284234,
276043,
317004,
366155,
284238,
226895,
284241,
194130,
284243,
300628,
284245,
276053,
284247,
317015,
284249,
243290,
284251,
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,
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,
276160,
358080,
284354,
358083,
284358,
276166,
358089,
284362,
276170,
284365,
276175,
284368,
276177,
284370,
358098,
284372,
317138,
284377,
276187,
284379,
284381,
284384,
358114,
284386,
358116,
276197,
317158,
358119,
284392,
325353,
358122,
284394,
284397,
358126,
276206,
358128,
284399,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
300819,
317207,
284440,
300828,
300830,
276255,
300832,
325408,
300834,
317221,
227109,
358183,
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,
292776,
284585,
276395,
292784,
276402,
358326,
161718,
358330,
276410,
276411,
276418,
276425,
301009,
301011,
301013,
292823,
358360,
301017,
301015,
292828,
276446,
153568,
276448,
276452,
292839,
276455,
292843,
276460,
292845,
276464,
178161,
227314,
276466,
325624,
276472,
317435,
276476,
276479,
276482,
276485,
317446,
276490,
292876,
317456,
276496,
317458,
178195,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
276528,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
276544,
284739,
325700,
243779,
292934,
243785,
276553,
350293,
350295,
309337,
194649,
227418,
350299,
350302,
227423,
350304,
178273,
309346,
194657,
194660,
350308,
309350,
309348,
292968,
309352,
227426,
276579,
227430,
276583,
309354,
301167,
276590,
350321,
350313,
350316,
284786,
350325,
252022,
276595,
350328,
292985,
301178,
350332,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
350366,
276638,
284837,
153765,
350375,
350379,
350381,
350383,
129200,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
301258,
309450,
276685,
309455,
276689,
309462,
301272,
276699,
194780,
309468,
309471,
301283,
317672,
317674,
325867,
243948,
194801,
227571,
309491,
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,
129603,
301636,
318020,
301639,
301643,
277071,
285265,
399955,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
121458,
277106,
170618,
170619,
309885,
309888,
277122,
227975,
277128,
285320,
301706,
318092,
326285,
334476,
318094,
277136,
277139,
227992,
334488,
318108,
285340,
318110,
227998,
137889,
383658,
285357,
318128,
277170,
293555,
342707,
154292,
277173,
318132,
285368,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
137946,
113378,
203491,
228069,
277223,
342760,
285417,
56041,
56043,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
228113,
285459,
277273,
293659,
326430,
228128,
285474,
293666,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
285494,
301880,
285499,
301884,
293696,
310080,
277317,
277322,
277329,
162643,
310100,
301911,
277337,
301913,
301921,
400236,
236397,
162671,
326514,
310134,
236408,
15224,
277368,
416639,
416640,
113538,
310147,
416648,
39817,
187274,
277385,
301972,
424853,
277405,
277411,
310179,
293798,
293802,
236460,
277426,
293811,
293817,
293820,
203715,
326603,
276586,
293849,
293861,
228327,
228328,
318442,
228330,
228332,
326638,
277486,
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,
285792,
277601,
203872,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
367737,
285817,
302205,
285821,
392326,
285831,
253064,
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,
228601,
204026,
228606,
204031,
64768,
310531,
285958,
138505,
228617,
318742,
204067,
277798,
130345,
277801,
113964,
285997,
277804,
285999,
277807,
113969,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
417086,
277822,
286016,
302403,
294211,
384328,
277832,
277836,
294221,
294223,
326991,
277839,
277842,
277847,
277850,
179547,
277853,
146784,
277857,
302436,
277860,
294246,
327015,
310632,
327017,
351594,
277864,
277869,
277872,
351607,
310648,
277880,
310651,
277884,
277888,
310657,
351619,
294276,
310659,
327046,
277892,
253320,
310665,
318858,
277894,
277898,
277903,
310672,
351633,
277905,
277908,
277917,
310689,
277921,
130468,
228776,
277928,
277932,
310703,
277937,
310710,
130486,
310712,
277944,
310715,
277947,
302526,
228799,
277950,
277953,
302534,
310727,
64966,
245191,
163272,
277959,
277963,
302541,
277966,
302543,
310737,
277971,
228825,
163290,
277978,
310749,
277981,
277984,
310755,
277989,
277991,
187880,
277995,
310764,
286188,
278000,
228851,
310772,
278003,
278006,
40440,
212472,
278009,
40443,
286203,
40448,
228864,
286214,
228871,
302603,
65038,
302614,
286233,
302617,
302621,
286240,
146977,
187939,
40484,
294435,
40486,
286246,
294440,
40488,
294439,
294443,
40491,
294445,
278057,
310831,
245288,
286248,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
327240,
40521,
286283,
40525,
40527,
212560,
400976,
228944,
40533,
147032,
40537,
40539,
40541,
278109,
40544,
40548,
40550,
40552,
286313,
40554,
286312,
310892,
40557,
40560,
188022,
122488,
294521,
343679,
294537,
310925,
286354,
278163,
302740,
122517,
278168,
179870,
327333,
229030,
212648,
278188,
302764,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
294601,
302793,
343757,
212690,
319187,
278227,
286420,
229076,
286425,
319194,
278235,
301163,
278238,
229086,
286432,
294625,
294634,
302838,
319226,
286460,
278274,
302852,
278277,
302854,
294664,
311048,
352008,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
278320,
319280,
319290,
229192,
302925,
188247,
188252,
237409,
229233,
294776,
360317,
294785,
327554,
40840,
40851,
294803,
188312,
294811,
237470,
319390,
40865,
319394,
294817,
294821,
311209,
180142,
343983,
294831,
188340,
40886,
319419,
294844,
294847,
393177,
294876,
294879,
294883,
294890,
311279,
278513,
237555,
278516,
311283,
278519,
237562
] |
c1c3fe7d0f41c7a91767112bef429629b58b1609 | a600b03266f492b7f065b293d724a72e5908448c | /stdlib/public/SDK/Dispatch/Block.swift | b4a39d62b9262e8df496edd5167a789c5d781c30 | [
"Apache-2.0",
"Swift-exception"
] | permissive | jingaprilzhang/swift | 6e923c847e29bbfd4b07de404d0b9fa0ac967c3f | 212ffadf5e652cbddb4bb39a203dafa632ed84d5 | refs/heads/master | 2020-05-29T11:54:10.940278 | 2016-08-02T17:21:01 | 2016-08-02T17:21:01 | 64,780,659 | 2 | 0 | null | 2016-08-02T18:09:29 | 2016-08-02T18:09:29 | null | UTF-8 | Swift | false | false | 3,579 | swift | //===----------------------------------------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
import SwiftShims
public struct DispatchWorkItemFlags : OptionSet, RawRepresentable {
public let rawValue: UInt
public init(rawValue: UInt) { self.rawValue = rawValue }
public static let barrier = DispatchWorkItemFlags(rawValue: 0x1)
@available(OSX 10.10, iOS 8.0, *)
public static let detached = DispatchWorkItemFlags(rawValue: 0x2)
@available(OSX 10.10, iOS 8.0, *)
public static let assignCurrentContext = DispatchWorkItemFlags(rawValue: 0x4)
@available(OSX 10.10, iOS 8.0, *)
public static let noQoS = DispatchWorkItemFlags(rawValue: 0x8)
@available(OSX 10.10, iOS 8.0, *)
public static let inheritQoS = DispatchWorkItemFlags(rawValue: 0x10)
@available(OSX 10.10, iOS 8.0, *)
public static let enforceQoS = DispatchWorkItemFlags(rawValue: 0x20)
}
@available(OSX 10.10, iOS 8.0, *)
public class DispatchWorkItem {
internal var _block: _DispatchBlock
public init(qos: DispatchQoS = .unspecified, flags: DispatchWorkItemFlags = [], block: @escaping @convention(block) () -> ()) {
_block = _swift_dispatch_block_create_with_qos_class(flags.rawValue,
qos.qosClass.rawValue.rawValue, Int32(qos.relativePriority), block)
}
// Used by DispatchQueue.synchronously<T> to provide a @noescape path through
// dispatch_block_t, as we know the lifetime of the block in question.
internal init(flags: DispatchWorkItemFlags = [], noescapeBlock: @noescape () -> ()) {
_block = _swift_dispatch_block_create_noescape(flags.rawValue, noescapeBlock)
}
public func perform() {
_block()
}
public func wait() {
_ = _swift_dispatch_block_wait(_block, DispatchTime.distantFuture.rawValue)
}
public func wait(timeout: DispatchTime) -> DispatchTimeoutResult {
return _swift_dispatch_block_wait(_block, timeout.rawValue) == 0 ? .success : .timedOut
}
public func wait(wallTimeout: DispatchWallTime) -> DispatchTimeoutResult {
return _swift_dispatch_block_wait(_block, wallTimeout.rawValue) == 0 ? .success : .timedOut
}
public func notify(
qos: DispatchQoS = .unspecified,
flags: DispatchWorkItemFlags = [],
queue: DispatchQueue,
execute: @escaping @convention(block) () -> Void)
{
if qos != .unspecified || !flags.isEmpty {
let item = DispatchWorkItem(qos: qos, flags: flags, block: execute)
_swift_dispatch_block_notify(_block, queue, item._block)
} else {
_swift_dispatch_block_notify(_block, queue, execute)
}
}
public func notify(queue: DispatchQueue, execute: DispatchWorkItem) {
_swift_dispatch_block_notify(_block, queue, execute._block)
}
public func cancel() {
_swift_dispatch_block_cancel(_block)
}
public var isCancelled: Bool {
return _swift_dispatch_block_testcancel(_block) != 0
}
}
/// The dispatch_block_t typealias is different from usual closures in that it
/// uses @convention(block). This is to avoid unnecessary bridging between
/// C blocks and Swift closures, which interferes with dispatch APIs that depend
/// on the referential identity of a block. Particularly, dispatch_block_create.
internal typealias _DispatchBlock = @convention(block) () -> Void
| [
91324,
74215
] |
f4bb563f75f8787179302d7fa052d9f21709fabc | 7f9b066eb55a4c1f5b1a15056a546156e8b167e2 | /Thoughts/ViewController.swift | 6a24b8ada6f33881721b246f092fa0499c8d21fe | [] | no_license | dlindsay72/Thoughts | 08412468ffd52f94793481cb9326c01fd4975c50 | 4e0ecec09b0d393520190f330462ddc1abbb5535 | refs/heads/master | 2021-08-23T00:27:04.462977 | 2017-11-28T15:19:34 | 2017-11-28T15:19:34 | 112,351,892 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 508 | swift | //
// ViewController.swift
// Thoughts
//
// Created by Dan Lindsay on 2017-11-28.
// Copyright © 2017 Dan Lindsay. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
| [
293888,
279041,
277508,
279046,
278543,
234511,
281107,
236057,
286234,
282143,
282145,
295460,
296487,
300086,
286775,
234551,
237624,
40505,
288827,
226878,
277057,
286786,
129604,
284740,
226887,
293961,
243786,
300107,
158285,
226896,
212561,
228945,
300116,
276054,
237655,
307288,
282202,
212573,
284261,
277612,
356460,
164974,
307311,
312433,
281202,
277108,
300149,
287350,
281205,
292478,
284287,
292990,
284289,
278657,
276099,
285321,
303242,
285837,
311437,
234641,
278675,
349332,
282262,
117399,
280219,
284315,
284317,
282270,
299165,
228000,
285855,
302235,
225955,
282275,
278693,
326311,
287399,
100521,
234665,
284328,
284336,
307379,
276150,
300727,
280760,
282301,
283839,
277696,
285377,
280770,
228548,
302788,
228551,
282311,
284361,
230604,
287437,
313550,
298189,
230608,
229585,
282320,
307410,
280790,
302295,
189655,
282329,
363743,
282338,
298211,
284391,
277224,
228585,
282346,
312049,
289524,
288501,
120054,
234232,
280824,
282365,
286462,
282368,
300288,
276736,
230147,
358147,
299786,
312586,
295696,
300817,
282389,
296216,
278298,
329499,
281373,
228127,
287007,
281380,
282917,
152356,
234279,
283433,
282411,
293682,
285495,
282426,
289596,
279360,
288577,
289600,
288579,
300358,
238920,
234829,
287055,
296272,
295766,
241499,
188253,
308064,
227688,
313706,
306540,
293742,
299374,
199024,
276849,
278897,
216433,
277364,
207738,
292730,
224643,
311684,
313733,
183173,
324491,
234380,
304015,
310673,
227740,
285087,
289697,
234402,
284580,
283556,
284586,
144811,
291755,
277935,
324528,
230323,
282548,
292277,
296374,
130487,
277432,
278968,
234423,
281530,
278973,
291774,
165832,
289224,
306633,
288205,
301012,
163289,
279011,
276965,
168936,
286189,
183278,
277487,
282095,
298989,
308721,
227315,
237556,
302580,
236022,
310773,
296436,
288251,
237564,
287231
] |
2cfde43dbb469337527bf51f817fcefb06481b2b | e12d34cf1e5f72d11efed57f0b51080c45367fac | /FlashCardApp/CoreDataModel/CDFlashCardPart+CoreDataProperties.swift | 4fe1fb581feeb71800dc2d795cc7a880e7abc745 | [] | no_license | jz709u/FlashCardApp | 3083aa71a71eb85005687619d63188f80c72e1c3 | 854dd697247192cd36b8309a36ba68d4a3da37cd | refs/heads/main | 2023-02-14T22:37:23.563288 | 2021-01-17T01:23:12 | 2021-01-17T01:23:12 | 330,131,773 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 433 | swift | //
// CDFlashCardPart+CoreDataProperties.swift
// FlashCardApp
//
// Created by Jay Zisch on 2021/01/15.
//
//
import Foundation
import CoreData
extension CDFlashCardPart {
@nonobjc public class func fetchRequest() -> NSFetchRequest<CDFlashCardPart> {
return NSFetchRequest<CDFlashCardPart>(entityName: "CDFlashCardPart")
}
@NSManaged public var content: String?
@NSManaged public var order: Int16
}
| [
-1
] |
d66c0bcc01c4f4c9ce817db7886c4933d3e05b93 | 6612a00d422aa76129c5c38b46f83387670360a4 | /GenericNetworkManager/GenericNetworkManager/SceneDelegate.swift | 89cfe2e5623cccbf65f192bf1305f041798e7c28 | [
"MIT"
] | permissive | KevinTopollaj/MasterSwiftGenerics | 66fa703deded0e027af8f463a77deb9b2d9c7a57 | 52cfba3284c24cafde654dc7bad174b6e87a2821 | refs/heads/main | 2023-04-10T15:37:54.759224 | 2021-04-18T22:22:54 | 2021-04-18T22:22:54 | 358,247,498 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,211 | swift | //
// SceneDelegate.swift
// GenericNetworkManager
//
// Created by Kevin Topollaj on 18.4.21.
//
import UIKit
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
guard let _ = (scene as? UIWindowScene) else { return }
}
func sceneDidDisconnect(_ scene: UIScene) {
// Called as the scene is being released by the system.
// This occurs shortly after the scene enters the background, or when its session is discarded.
// Release any resources associated with this scene that can be re-created the next time the scene connects.
// The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead).
}
func sceneDidBecomeActive(_ scene: UIScene) {
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
}
func sceneWillResignActive(_ scene: UIScene) {
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).
}
func sceneWillEnterForeground(_ scene: UIScene) {
// Called as the scene transitions from the background to the foreground.
// Use this method to undo the changes made on entering the background.
}
func sceneDidEnterBackground(_ scene: UIScene) {
// Called as the scene transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
}
}
| [
393221,
163849,
393228,
393231,
393251,
352294,
344103,
393260,
393269,
213049,
376890,
385082,
393277,
376906,
327757,
254032,
368728,
254045,
180322,
376932,
286845,
286851,
417925,
262284,
360598,
377003,
377013,
164029,
327872,
180418,
377030,
377037,
377047,
418008,
418012,
377063,
327915,
205037,
393457,
393461,
393466,
418044,
385281,
262405,
180491,
336140,
164107,
262417,
368913,
262423,
377118,
377121,
262437,
254253,
336181,
262455,
393539,
262473,
344404,
213333,
418135,
270687,
262497,
418145,
262501,
213354,
246124,
262508,
262512,
213374,
385420,
393613,
262551,
262553,
385441,
385444,
262567,
385452,
262574,
393649,
385460,
262587,
344512,
262593,
360917,
369119,
328180,
328183,
328190,
254463,
328193,
328207,
410129,
393748,
262679,
377372,
188959,
385571,
377384,
197160,
33322,
352822,
270905,
197178,
418364,
188990,
369224,
270922,
385610,
352844,
385617,
352865,
262761,
352875,
344694,
352888,
336513,
377473,
385671,
148106,
213642,
377485,
352919,
98969,
344745,
361130,
336556,
385714,
434868,
164535,
164539,
328379,
328387,
352969,
344777,
418508,
385743,
385749,
139998,
189154,
369382,
361196,
418555,
344832,
336644,
344837,
344843,
328462,
361231,
394002,
336660,
418581,
418586,
434971,
369436,
262943,
369439,
418591,
418594,
336676,
418600,
418606,
369464,
361274,
328516,
336709,
328520,
336712,
361289,
328523,
336715,
361300,
213848,
426842,
361307,
197469,
361310,
254813,
361318,
344936,
361323,
361335,
328574,
369544,
361361,
222129,
345036,
115661,
386004,
345046,
386012,
386019,
386023,
328690,
435188,
328703,
328710,
418822,
377867,
328715,
361490,
386070,
271382,
336922,
345119,
377888,
214060,
345134,
345139,
361525,
386102,
361537,
377931,
345172,
189525,
402523,
361568,
148580,
345200,
361591,
386168,
361594,
410746,
214150,
345224,
386187,
345247,
361645,
345268,
402615,
361657,
402636,
328925,
165086,
66783,
165092,
328933,
222438,
328942,
386286,
386292,
206084,
328967,
345377,
345380,
353572,
345383,
263464,
337207,
345400,
378170,
369979,
386366,
337230,
337235,
263509,
353634,
337252,
402792,
271731,
378232,
337278,
271746,
181639,
353674,
181644,
361869,
181650,
181655,
230810,
181671,
181674,
181679,
181682,
337330,
181687,
370105,
181691,
181697,
361922,
337350,
181704,
337366,
271841,
329192,
361961,
329195,
116211,
337399,
402943,
337416,
329227,
419341,
419345,
329234,
419351,
345626,
419357,
345631,
419360,
370208,
394787,
419363,
370214,
419369,
394796,
419377,
419386,
214594,
419401,
353868,
419404,
173648,
419408,
214611,
419412,
403040,
345702,
370298,
353920,
403073,
403076,
345737,
198282,
403085,
403092,
345750,
419484,
345758,
345763,
419492,
345766,
419498,
419502,
370351,
419507,
337588,
419510,
419513,
419518,
403139,
337607,
419528,
419531,
419536,
272083,
394967,
419543,
419545,
345819,
419548,
419551,
345829,
419560,
337643,
419564,
337647,
370416,
337671,
362249,
362252,
395022,
362256,
321300,
345888,
362274,
378664,
354107,
345916,
354112,
370504,
329545,
345932,
370510,
354132,
247639,
337751,
370520,
313181,
182110,
354143,
354157,
345965,
345968,
345971,
345975,
403321,
1914,
354173,
395148,
247692,
337809,
247701,
436127,
436133,
247720,
337834,
362414,
337845,
190393,
247760,
346064,
346069,
419810,
329699,
354275,
190440,
354314,
346140,
436290,
395340,
378956,
436307,
338005,
100454,
329833,
329853,
329857,
329868,
411806,
329886,
346273,
362661,
100525,
387250,
379067,
387261,
256193,
395467,
346317,
411862,
256214,
411865,
411869,
411874,
379108,
411877,
387303,
346344,
395496,
338154,
387307,
346350,
338161,
387314,
436474,
379135,
411905,
411917,
379154,
395539,
387350,
387353,
338201,
338212,
395567,
248112,
362823,
436556,
321880,
362844,
379234,
354674,
321911,
420237,
379279,
272787,
354728,
338353,
338382,
272849,
248279,
256474,
182755,
338404,
338411,
330225,
248309,
248332,
330254,
199189,
420377,
330268,
191012,
330320,
199250,
191069,
346722,
248427,
338544,
346736,
191093,
346743,
346769,
150184,
174775,
248505,
174778,
363198,
223936,
355025,
273109,
355029,
264919,
256735,
264942,
363252,
338680,
264965,
338701,
256787,
363294,
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,
199681,
338951,
330761,
330769,
330775,
248863,
396329,
347178,
404526,
396337,
330803,
396340,
339002,
388155,
339010,
347208,
248905,
330827,
248915,
183384,
339037,
412765,
257121,
265321,
248952,
420985,
330890,
347288,
248986,
44199,
380071,
339118,
249018,
339133,
126148,
330959,
330966,
265433,
265438,
388320,
363757,
388348,
339199,
396552,
175376,
175397,
273709,
372016,
437553,
347442,
199989,
175416,
396601,
208189,
437567,
175425,
437571,
437576,
437584,
437588,
396634,
175451,
437596,
429408,
175458,
175461,
175464,
265581,
331124,
175478,
175487,
249215,
175491,
249219,
249225,
249228,
249235,
175514,
175517,
396703,
396706,
175523,
355749,
396723,
388543,
380353,
216518,
380364,
339406,
372177,
339414,
249303,
413143,
339418,
339421,
249310,
339425,
249313,
339429,
339435,
249329,
69114,
372229,
208399,
380433,
175637,
405017,
134689,
265779,
421442,
413251,
265796,
265806,
224854,
224858,
339553,
257636,
224871,
372328,
257647,
372338,
224885,
224888,
224891,
224895,
372354,
126597,
421509,
224905,
11919,
224911,
224914,
126611,
224917,
224920,
126618,
208539,
224923,
224927,
224930,
224933,
257705,
224939,
224943,
257713,
224949,
257717,
257721,
224954,
257725,
224960,
257733,
224966,
224970,
257740,
224976,
257745,
257748,
224982,
257752,
224987,
257762,
224996,
225000,
225013,
257788,
225021,
339711,
257791,
225027,
257796,
339722,
257802,
257805,
225039,
257808,
249617,
225044,
167701,
372500,
257815,
225049,
257820,
225054,
184096,
397089,
257825,
225059,
339748,
225068,
257837,
413485,
225071,
225074,
257843,
225077,
257846,
225080,
397113,
225083,
397116,
257853,
225088,
225094,
225097,
257869,
257872,
225105,
397140,
225109,
225113,
257881,
257884,
257887,
225120,
257891,
225128,
257897,
225138,
257909,
225142,
372598,
257914,
257917,
225150,
257922,
380803,
225156,
339845,
257927,
225166,
397201,
225171,
380823,
225176,
225183,
372698,
372704,
372707,
356336,
380919,
393215,
372739,
405534,
266295,
266298,
421961,
200786,
356440,
217180,
430181,
266351,
356467,
266365,
192640,
266375,
381069,
225425,
250003,
225430,
250008,
356507,
250012,
225439,
135328,
192674,
225442,
438434,
225445,
438438,
225448,
438441,
356521,
225451,
258223,
225456,
430257,
225459,
225462,
225468,
389309,
225472,
372931,
225476,
430275,
389322,
225485,
225488,
225491,
266454,
225494,
225497,
225500,
225503,
225506,
225511,
217319,
225515,
225519,
381177,
397572,
389381,
381212,
356638,
356641,
356644,
356647,
266537,
389417,
356650,
356656,
332081,
340276,
356662,
397623,
332091,
225599,
348489,
332107,
151884,
430422,
348503,
332118,
250201,
250203,
250211,
340328,
250217,
348523,
348528,
332153,
356734,
389503,
332158,
438657,
332162,
389507,
348548,
356741,
332175,
160152,
373146,
340380,
373149,
70048,
356783,
266688,
324032,
201158,
340452,
127473,
217590,
340473,
324095,
324100,
324103,
324112,
340501,
324118,
324122,
340512,
332325,
324134,
381483,
356908,
324141,
324143,
356917,
324150,
324156,
168509,
348734,
324161,
324165,
356935,
348745,
381513,
324171,
324174,
324177,
389724,
332381,
373344,
340580,
348777,
381546,
340628,
184983,
373399,
258723,
332455,
332460,
389806,
332464,
332473,
381626,
332484,
332487,
332494,
357070,
357074,
332512,
340724,
332534,
373499,
348926,
389927,
348979,
348983,
398141,
357202,
389971,
357208,
389979,
430940,
357212,
357215,
439138,
349041,
340850,
381815,
430967,
324473,
398202,
340859,
324476,
430973,
119675,
324479,
340863,
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,
340942,
209874,
340958,
431073,
398307,
340964,
209896,
201712,
209904,
349173,
381947,
201724,
349181,
431100,
431107,
349203,
209944,
209948,
357411,
250917,
169002,
357419,
209966,
209969,
209973,
209976,
209980,
209988,
209991,
431180,
209996,
349268,
177238,
250968,
210011,
373853,
341094,
210026,
210028,
210032,
349296,
210037,
210042,
210045,
349309,
152704,
349313,
160896,
210053,
210056,
349320,
259217,
373905,
210068,
210072,
210078,
210081,
210085,
210089,
210096,
210100,
324792,
210108,
357571,
210116,
210128,
210132,
333016,
210139,
210144,
218355,
218361,
275709,
128254,
275713,
242947,
275717,
275723,
333075,
349460,
349486,
349492,
415034,
210261,
365912,
259423,
374113,
251236,
374118,
390518,
357756,
374161,
112021,
349591,
357793,
333222,
259516,
415168,
366035,
415187,
366039,
415192,
415194,
415197,
415200,
333285,
415208,
366057,
366064,
415217,
415225,
423424,
415258,
415264,
366118,
415271,
382503,
349739,
144940,
415279,
415282,
415286,
210488,
415291,
415295,
349762,
333396,
374359,
333400,
366173,
423529,
423533,
210547,
415354,
333440,
267910,
267929,
259789,
366301,
333535,
153311,
366308,
366312,
431852,
399086,
366319,
210673,
366322,
399092,
366326,
333566,
268042,
210700,
366349,
210707,
399129,
333595,
210720,
366384,
358192,
210740,
366388,
358201,
325441,
366403,
325447,
341831,
341839,
341844,
415574,
358235,
350046,
399200,
399208,
268144,
358256,
358260,
399222,
325494,
333690,
325505,
399244,
333709,
333725,
333737,
382891,
382898,
350153,
358348,
333777,
219094,
399318,
358372,
350190,
350194,
333819,
350204,
350207,
325633,
325637,
350214,
219144,
268299,
333838,
350225,
186388,
350232,
333851,
350238,
350241,
374819,
350245,
350249,
350252,
178221,
350257,
350260,
350272,
243782,
350281,
350286,
374865,
252021,
342134,
374904,
268435,
333998,
334012,
260299,
211161,
375027,
358645,
268553,
268560,
432406,
325920,
194854,
358701,
391469,
358705,
358714,
358717,
383307,
358738,
383331,
383334,
391531,
383342,
334204,
268669,
194942,
391564,
366991,
334224,
342431,
375209,
375220,
334263,
326087,
358857,
195041,
334312,
104940,
375279,
416255,
350724,
186898,
342546,
350740,
342551,
342555,
416294,
350762,
252463,
358962,
334397,
358973,
252483,
219719,
399957,
334425,
326240,
375401,
334466,
334469,
391813,
162446,
342680,
342685,
260767,
342711,
244410,
260798,
334530,
260802,
350918,
154318,
342737,
391895,
154329,
416476,
64231,
113389,
203508,
375541,
342777,
391938,
391949,
375569,
375572,
375575,
375580,
162592,
334633,
326444,
383794,
375613,
244542,
260925,
375616,
342857,
416599,
342875,
244572,
433001,
400238,
211826,
211832,
392061,
351102,
252801,
260993,
351105,
400260,
211846,
342921,
342931,
252823,
400279,
392092,
400286,
252838,
359335,
211885,
252846,
400307,
351169,
359362,
351172,
170950,
187335,
326599,
359367,
359383,
359389,
383968,
343018,
261109,
261112,
244728,
383999,
261130,
261148,
359452,
211999,
261155,
261160,
261166,
359471,
375868,
343132,
384099,
384102,
384108,
367724,
187503,
343155,
384115,
212095,
351366,
384136,
384140,
384144,
351382,
384152,
384158,
384161,
351399,
384169,
367795,
244917,
384182,
367801,
384189,
384192,
351424,
343232,
367817,
244938,
384202,
253132,
384209,
146644,
351450,
384225,
359650,
343272,
351467,
359660,
384247,
351480,
384250,
351483,
351492,
384270,
359695,
261391,
253202,
261395,
384276,
384284,
245021,
384290,
253218,
245032,
171304,
384299,
351535,
245042,
326970,
384324,
212296,
212304,
367966,
343394,
367981,
343410,
155000,
327035,
245121,
245128,
253321,
155021,
384398,
245137,
245143,
245146,
245149,
245152,
245155,
155045,
245158,
114093,
327090,
343478,
359867,
384444,
327108,
327112,
384457,
359887,
359891,
368093,
155103,
343535,
343540,
368120,
409092,
253445,
359948,
359951,
245295,
359984,
343610,
400977,
400982,
179803,
155241,
155255,
155274,
368289,
245410,
425639,
425652,
425663,
155328,
245463,
155352,
155356,
155364,
245477,
155372,
245487,
212723,
409336,
155394,
155404,
245528,
155423,
360224,
155439,
204592,
155444,
155448,
417596,
384829,
360262,
155463,
155477,
376665,
155484,
261982,
425823,
155488,
376672,
155492,
327532,
261997,
376686,
262000,
262003,
425846,
262006,
147319,
262009,
327542,
262012,
155517,
155523,
155526,
360327,
376715,
155532,
262028,
262031,
262034,
262037,
262040,
262043,
155550,
253854,
262046,
262049,
262052,
327590,
155560,
155563,
155566,
327613,
393152,
393170,
155604,
155620,
253924,
155622,
253927,
327655,
360432,
393204,
360439,
253944,
393209,
155647
] |
6857b5265aba891bc2b44be0e178d03d8d2c5bd7 | f7bb0f2828d6630dd5aaab57b5bd5b90d3193296 | /Package.swift | 5bb2f4d86df0e15f5d4c4849202e979781334acb | [
"Apache-2.0"
] | permissive | csantanapr/swift-watson-sdk | cbdd7cce983b47f999fe458c022ef851dbc373bf | 74744bcf589626651310b3d774f05c3ef3499fdb | refs/heads/master | 2021-07-07T17:51:24.289343 | 2017-03-23T12:14:13 | 2017-03-23T12:14:13 | 105,233,622 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 940 | swift | import PackageDescription
let package = Package(
name: "WatsonDeveloperCloud",
targets: [
Target(name: "RestKit"),
Target(name: "WeatherCompanyData", dependencies: [.Target(name: "RestKit")]),
Target(name: "NaturalLanguageClassifier", dependencies: [.Target(name: "RestKit")]),
Target(name: "ToneAnalyzer", dependencies: [.Target(name: "RestKit")]),
Target(name: "PersonalityInsights", dependencies: [.Target(name: "RestKit")]),
Target(name: "Conversation", dependencies: [.Target(name: "RestKit")]),
Target(name: "AlchemyLanguage", dependencies: [.Target(name: "RestKit")]),
Target(name: "AlchemyVision", dependencies: [.Target(name: "RestKit")])
],
dependencies: [
.Package(url: "https://github.com/IBM-Swift/Kitura-net.git", majorVersion: 1),
.Package(url: "https://github.com/IBM-Swift/SwiftyJSON.git", majorVersion: 15)
]
)
| [
-1
] |
ed57faa3d20877ba309895ca2cb30730f815333f | 4dad1241401db7f774be744e645d2cc894da0709 | /game1/AppDelegate.swift | 67f9a809d16e01ef2705cbdfb41d216fc39110dd | [] | no_license | ar1hur/ios-spaceship | ffa27699c7032577a6712020479b5da789b3bf75 | ebc237f4dd0987946cdd151ec37a853028b22e6d | refs/heads/master | 2020-03-27T18:36:41.678117 | 2018-08-31T19:14:12 | 2018-08-31T19:14:12 | 146,932,632 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,156 | swift | //
// AppDelegate.swift
// game1
//
// Created by Arthur on 31.08.18.
// Copyright © 2018 AZ. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
| [
229380,
229383,
229385,
294924,
229388,
278542,
229391,
327695,
278545,
229394,
278548,
229397,
229399,
229402,
278556,
229405,
278559,
229408,
278564,
294950,
229415,
229417,
327722,
237613,
229422,
360496,
229426,
237618,
229428,
311349,
286774,
286776,
319544,
286778,
204856,
229432,
352318,
286791,
237640,
286797,
278605,
311375,
163920,
237646,
196692,
319573,
311383,
319590,
311400,
278635,
303212,
278639,
131192,
278648,
237693,
303230,
327814,
303241,
131209,
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,
320007,
287238,
279051,
172558,
279055,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
279082,
311850,
279084,
172591,
172598,
279095,
172607,
172609,
172612,
377413,
172614,
213575,
172618,
303690,
33357,
287309,
303696,
279124,
172634,
262752,
254563,
172644,
311911,
189034,
295533,
172655,
172656,
352880,
295538,
189039,
172660,
287349,
189040,
189044,
287355,
287360,
295553,
172675,
295557,
311942,
303751,
287365,
352905,
311946,
279178,
287371,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
172702,
287390,
303773,
172705,
287394,
172707,
303780,
164509,
287398,
205479,
279208,
287400,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
328384,
172737,
279231,
287427,
312005,
312006,
172748,
287436,
107212,
172751,
287440,
295633,
172755,
303827,
279255,
172760,
287450,
303835,
279258,
189149,
303838,
213724,
312035,
279267,
295654,
279272,
230128,
312048,
312050,
230131,
189169,
205564,
303871,
230146,
328453,
295685,
230154,
33548,
312077,
295695,
295701,
230169,
369433,
295707,
328476,
295710,
230175,
295720,
303914,
279340,
205613,
279353,
230202,
312124,
328508,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
279390,
230241,
279394,
303976,
336744,
303981,
303985,
303987,
328563,
279413,
303991,
303997,
295806,
295808,
295813,
304005,
320391,
304007,
213895,
304009,
304011,
230284,
304013,
295822,
279438,
189325,
189329,
295825,
304019,
189331,
58262,
304023,
304027,
279452,
234648,
410526,
279461,
279462,
304042,
213931,
230327,
304055,
287675,
197564,
230334,
304063,
304065,
213954,
189378,
156612,
295873,
213963,
197580,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
312321,
295945,
230413,
295949,
197645,
320528,
140312,
295961,
238620,
197663,
304164,
304170,
304175,
238641,
312374,
238652,
238655,
230465,
238658,
336964,
132165,
296004,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
205931,
279661,
205934,
164973,
312432,
279669,
337018,
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,
337335,
288185,
279991,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
288210,
370130,
288212,
222676,
288214,
148946,
239064,
329177,
288217,
280027,
288220,
288218,
239070,
288224,
280034,
288226,
280036,
288229,
280038,
288230,
288232,
370146,
320998,
288234,
288236,
288238,
288240,
288242,
296435,
288244,
288250,
296446,
321022,
402942,
148990,
296450,
206336,
230916,
230919,
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,
296626,
296634,
296637,
419522,
313027,
280260,
419525,
206536,
280264,
206539,
206541,
206543,
263888,
313044,
280276,
321239,
280283,
313052,
18140,
288478,
313055,
419555,
321252,
313066,
288494,
280302,
280304,
313073,
321266,
419570,
288499,
288502,
280314,
288510,
124671,
67330,
280324,
198405,
288519,
280331,
198416,
280337,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
296767,
288576,
345921,
280388,
337732,
304968,
280393,
280402,
173907,
313171,
313176,
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,
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,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
280888,
280891,
289087,
280897,
280900,
305480,
239944,
280906,
239947,
305485,
305489,
379218,
280919,
248153,
215387,
354653,
313700,
313705,
280937,
190832,
280946,
223606,
313720,
280956,
239997,
280959,
313731,
199051,
240011,
289166,
240017,
297363,
190868,
240021,
297365,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
289210,
305594,
281024,
289218,
289221,
289227,
436684,
281045,
281047,
215526,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
330244,
281095,
223752,
150025,
338440,
240132,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
281179,
338528,
338532,
281190,
199273,
281196,
19053,
158317,
313973,
297594,
281210,
158347,
264845,
182926,
133776,
182929,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
199364,
297671,
158409,
256716,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322314,
322318,
281361,
281372,
322341,
215850,
281388,
289593,
281401,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
281442,
174955,
224110,
207733,
207737,
158596,
183172,
338823,
322440,
314249,
240519,
183184,
142226,
289687,
240535,
224151,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
420829,
281567,
289762,
322534,
297961,
183277,
281581,
322550,
134142,
322563,
314372,
330764,
175134,
322599,
322610,
314421,
281654,
314427,
314433,
207937,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
289912,
248995,
306341,
306344,
306347,
322734,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
126190,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
257334,
216376,
380226,
298306,
224584,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
290171,
314747,
306555,
298365,
290174,
224641,
281987,
298372,
314756,
281990,
224647,
265604,
298377,
314763,
142733,
298381,
314768,
224657,
306581,
314773,
314779,
314785,
314793,
282025,
282027,
241068,
241070,
241072,
282034,
241077,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
290291,
282101,
241142,
191992,
290298,
151036,
290302,
282111,
290305,
175621,
306694,
192008,
323084,
257550,
290321,
282130,
323090,
290325,
282133,
241175,
290328,
282137,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
28219,
282186,
224849,
282195,
282199,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
282255,
282261,
175770,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
306856,
196133,
282295,
323260,
282300,
323266,
282310,
323273,
282319,
306897,
241362,
306904,
282328,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
241450,
282410,
306988,
306991,
315184,
323376,
315190,
241464,
159545,
282425,
298811,
118593,
307009,
413506,
307012,
241475,
298822,
315211,
282446,
307027,
315221,
323414,
315223,
241496,
241498,
307035,
307040,
110433,
241509,
110438,
298860,
110445,
282478,
315249,
110450,
315251,
282481,
315253,
315255,
339838,
315267,
282499,
315269,
241544,
282505,
241546,
241548,
298896,
298898,
282514,
241556,
298901,
44948,
241560,
282520,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
36779,
241581,
282542,
241583,
323504,
241586,
282547,
241588,
290739,
241590,
241592,
241598,
290751,
241600,
241605,
151495,
241610,
298975,
241632,
298984,
241640,
241643,
298988,
241646,
241649,
241652,
323574,
290807,
299003,
241661,
299006,
282623,
315396,
241669,
315397,
282632,
282639,
290835,
282645,
241693,
282654,
241701,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
307278,
192596,
176213,
307287,
307290,
217179,
315482,
192605,
315483,
233567,
299105,
200801,
217188,
299109,
307303,
315495,
356457,
45163,
307307,
315502,
192624,
307314,
323700,
299126,
233591,
299136,
307329,
315524,
307338,
233613,
241813,
307352,
299164,
241821,
299167,
315552,
184479,
184481,
315557,
184486,
307370,
307372,
184492,
307374,
307376,
299185,
323763,
184503,
176311,
299191,
307386,
258235,
307388,
307385,
307390,
176316,
299200,
184512,
307394,
299204,
307396,
184518,
307399,
323784,
233679,
307409,
307411,
176343,
299225,
233701,
307432,
184572,
184579,
282893,
323854,
291089,
282906,
291104,
233766,
176435,
307508,
315701,
332086,
307510,
307512,
168245,
307515,
307518,
282942,
282947,
323917,
110926,
282957,
233808,
323921,
315733,
323926,
233815,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299388,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
315801,
283033,
242075,
291226,
194654,
61855,
291231,
283042,
291238,
291241,
127403,
127405,
291247,
299440,
127407,
299444,
127413,
283062,
291254,
127417,
291260,
283069,
127421,
127424,
299457,
127429,
127434,
315856,
176592,
315860,
176597,
283095,
127447,
299481,
176605,
242143,
127457,
291299,
340454,
127463,
242152,
291305,
127466,
176620,
127469,
127474,
291314,
291317,
127480,
135672,
291323,
233979,
127485,
291330,
283142,
127494,
127497,
233994,
135689,
127500,
291341,
233998,
127506,
234003,
234006,
127511,
152087,
242202,
234010,
135707,
135710,
242206,
242208,
291361,
242220,
291378,
152118,
234038,
234041,
315961,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
135808,
291456,
373383,
299655,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
225948,
135839,
299680,
225954,
299684,
135844,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
119509,
226005,
226008,
299740,
242396,
201444,
299750,
283368,
234219,
283372,
185074,
226037,
283382,
316151,
234231,
234236,
226045,
242431,
234239,
209665,
234242,
299778,
242436,
226053,
234246,
226056,
234248,
291593,
242443,
234252,
242445,
234254,
291601,
234258,
242450,
242452,
234261,
201496,
234264,
234266,
234269,
283421,
234272,
234274,
152355,
299814,
234278,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
160572,
283452,
234302,
234307,
242499,
234309,
316233,
234313,
316235,
234316,
283468,
234319,
242511,
234321,
234324,
185173,
201557,
234329,
234333,
308063,
234336,
242530,
349027,
234338,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
234364,
291711,
234368,
291714,
234370,
291716,
234373,
316294,
201603,
226182,
308105,
234375,
324490,
226185,
234379,
234384,
234388,
234390,
324504,
234393,
209818,
308123,
324508,
234396,
291742,
226200,
234398,
234401,
291747,
291748,
234405,
291750,
234407,
324520,
324518,
324522,
234410,
291756,
291754,
226220,
324527,
291760,
234417,
201650,
324531,
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,
308231,
234504,
234507,
234510,
234515,
300054,
316439,
234520,
234519,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
144430,
234543,
234546,
275508,
300085,
234549,
300088,
234553,
234556,
234558,
316479,
234561,
316483,
160835,
234563,
308291,
234568,
234570,
316491,
234572,
300108,
234574,
300115,
234580,
234581,
242777,
234585,
275545,
234590,
234593,
234595,
234597,
300133,
234601,
300139,
234605,
160879,
234607,
275569,
234610,
316530,
300148,
234614,
398455,
144506,
234618,
234620,
275579,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
308373,
226453,
234647,
275606,
275608,
234650,
308379,
324757,
300189,
324766,
119967,
234653,
324768,
234657,
283805,
242852,
300197,
234661,
283813,
234664,
177318,
275626,
234667,
316596,
308414,
234687,
300223,
300226,
308418,
234692,
300229,
308420,
308422,
283844,
226500,
300234,
283850,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
300267,
161003,
300270,
300272,
120053,
300278,
275703,
316663,
300284,
275710,
300287,
292097,
300289,
161027,
300292,
300294,
275719,
234760,
177419,
300299,
242957,
300301,
283917,
177424,
349451,
275725,
349464,
415009,
283939,
259367,
292143,
283951,
300344,
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,
144814,
227426,
144820,
374196,
284084,
292279,
284087,
144826,
144828,
144830,
144832,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
292338,
226802,
316917,
292343,
308727,
300537,
316933,
316947,
308757,
308762,
284191,
316959,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
194101,
284213,
316983,
194103,
284215,
308790,
284218,
226877,
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,
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,
284337,
284339,
300726,
284343,
284346,
284350,
358080,
276160,
284354,
358083,
284358,
276166,
358089,
284362,
276170,
284365,
276175,
284368,
276177,
284370,
358098,
284372,
317138,
284377,
276187,
284379,
284381,
284384,
358114,
284386,
358116,
276197,
317158,
358119,
284392,
325353,
358122,
284394,
284397,
358126,
276206,
358128,
284399,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
300819,
317207,
284440,
300828,
300830,
276255,
300832,
325408,
300834,
317221,
227109,
358183,
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,
399252,
284566,
350106,
284572,
276386,
284579,
276388,
358312,
317353,
284585,
276395,
292776,
292784,
276402,
358326,
161718,
358330,
276410,
276411,
276418,
276425,
301009,
301011,
301013,
292823,
358360,
301017,
301015,
292828,
276446,
153568,
276452,
292839,
276455,
350186,
292843,
276460,
292845,
276464,
178161,
227314,
325624,
350200,
276472,
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,
284739,
292934,
243785,
276553,
350293,
350295,
309337,
194649,
227418,
350299,
350302,
227423,
350304,
178273,
309346,
194657,
194660,
350308,
309350,
309348,
292968,
309352,
309354,
301163,
350313,
350316,
227430,
301167,
276583,
350321,
276590,
284786,
276595,
350325,
252022,
227440,
350328,
292985,
301178,
350332,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
350366,
276638,
284837,
153765,
350375,
350379,
350381,
350383,
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,
227709,
285061,
366983,
317833,
178572,
285070,
285077,
178583,
227738,
317853,
276896,
317858,
342434,
285093,
317864,
285098,
276907,
235955,
276917,
293304,
293307,
293314,
309707,
293325,
129486,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
227810,
293346,
276964,
293352,
236013,
293364,
301562,
293370,
317951,
309764,
301575,
121352,
293387,
236043,
342541,
317963,
113167,
55822,
309779,
317971,
309781,
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,
318132,
342707,
154292,
277173,
285368,
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,
228128,
285474,
293666,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
285494,
301880,
285499,
301884,
310080,
293696,
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,
276579,
293811,
293817,
293820,
203715,
326603,
342994,
276586,
293849,
293861,
228327,
228328,
318442,
228330,
228332,
326638,
277486,
351217,
318450,
293876,
293877,
285686,
302073,
121850,
293882,
302075,
285690,
293887,
277504,
277507,
277511,
293899,
277519,
293908,
302105,
293917,
293939,
318516,
277561,
277564,
310336,
7232,
293956,
277573,
228422,
293960,
310344,
277577,
277583,
203857,
293971,
310355,
310359,
236632,
277594,
138332,
277598,
203872,
277601,
285792,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
367737,
285817,
302205,
285821,
392326,
285831,
294026,
302218,
285835,
162964,
384148,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
302241,
285862,
277671,
302248,
64682,
277678,
294063,
294065,
302258,
277687,
294072,
318651,
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,
277798,
130345,
277801,
113964,
277804,
384302,
285999,
285997,
113969,
277807,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
417086,
277822,
286016,
302403,
294211,
384328,
277832,
277836,
294221,
146765,
294223,
326991,
277839,
277842,
277847,
277850,
179547,
277853,
277857,
302436,
277860,
294246,
327015,
310632,
327017,
351594,
277864,
277869,
277872,
351607,
310648,
277880,
310651,
277884,
277888,
310657,
351619,
294276,
310659,
327046,
277892,
253320,
310665,
318858,
277894,
277898,
277903,
310672,
351633,
277905,
277908,
277917,
310689,
277921,
130468,
277928,
277932,
310703,
277937,
310710,
130486,
310712,
277944,
310715,
277947,
302526,
228799,
277950,
277953,
302534,
310727,
245191,
64966,
163272,
277959,
277963,
302541,
277966,
302543,
310737,
277971,
228825,
277978,
310749,
277981,
277984,
310755,
277989,
277991,
187880,
277995,
310764,
286188,
278000,
228851,
310772,
278003,
278006,
40440,
212472,
278009,
40443,
286203,
310780,
40448,
228864,
286214,
302603,
65038,
302614,
302617,
286233,
302621,
286240,
146977,
187936,
187939,
40484,
294435,
40486,
286246,
294440,
40488,
294439,
294443,
40491,
294445,
278057,
310831,
245288,
286248,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
327240,
40521,
286283,
40525,
40527,
212560,
400976,
228944,
40533,
147032,
40537,
40539,
40541,
278109,
40544,
40548,
40550,
40552,
286312,
40554,
286313,
310892,
40557,
40560,
188022,
122488,
294521,
343679,
294537,
310925,
286354,
278163,
302740,
122517,
278168,
179870,
327333,
229030,
212648,
278188,
302764,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
294601,
302793,
343757,
212690,
319187,
286420,
278227,
229076,
286425,
319194,
278235,
278238,
229086,
286432,
294625,
294634,
302838,
319226,
286460,
278274,
302852,
278277,
302854,
294664,
311048,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
319280,
278320,
319290,
229192,
302925,
188247,
280021,
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,
237508,
393177,
294876,
294879,
294883,
393190,
294890,
311279,
278513,
237555,
311283,
278516,
278519,
237562
] |
117f4b877630ad3e848a1a47496d3c29ac5747ca | 6547332009111c0022dada080d6f62afdc43664d | /Misc/Archives and Serialization/demoApp/demoApp/ViewController.swift | c2ab152e6431abf4261c1e00eae58273f2328249 | [] | no_license | RENCHILIU/iOS | b9fad9c8eb23311b2171e0a51f8409d52690b0ff | a9b3f69a1252ae8a0c9a7a378bb2017492a33e70 | refs/heads/master | 2023-05-25T03:37:00.791549 | 2023-05-12T00:36:22 | 2023-05-12T00:36:22 | 110,629,768 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 526 | swift | //
// ViewController.swift
// demoApp
//
// Created by liurenchi on 4/13/21.
//
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let request = URLRequest(url: URL(string: "https://reqres.in/api/users?page=2")!)
let task = URLSession.shared.dataTask(with: request) { (data, response, error) in
print(data)
print(response)
print(error)
}
task.resume()
}
}
| [
-1
] |
46fb1d70e2d69b7b65857ffeeeedf94742ad4a9c | f40539368caeff9355bf9d97edefc60bb15f927c | /RxSwiftLearning/Manager/Response+ObjectMapper.swift | b35b63f5e0b566b6819ef18579d3a548d7826621 | [
"MIT"
] | permissive | CoderHRXu/RxSwiftLearning | 319737af7749b85a479be95268564a6159c22a3b | f92334da43912dc9646f27865b435b98d3af28fb | refs/heads/master | 2021-08-06T05:04:53.363062 | 2017-11-03T07:08:21 | 2017-11-03T07:08:21 | 106,489,525 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,754 | swift | //
// Response+ObjectMapper.swift
// RxSwiftLearning
//
// Created by xuhaoran on 2017/10/11.
// Copyright © 2017年 xuhaoran. All rights reserved.
//
import Foundation
import RxSwift
import Moya
import ObjectMapper
// MARK: - Json -> Model
extension Response {
// 将json解析为单个model
public func mapObject<T:BaseMappable>(_ type : T.Type) throws -> T{
guard let object = Mapper<T>().map(JSONObject: try mapJSON()) else {
throw MoyaError.jsonMapping(self)
}
return object
}
// 将Json解析为多个Model,返回数组,对于不同的json格式需要对该方法进行修改
public func mapArray<T:BaseMappable>(_ type : T.Type) throws -> [T] {
guard let json = try mapJSON() as? [String : Any] else {
throw MoyaError.jsonMapping(self)
}
guard let jsonArray = (json["result"] as? [[String : Any]]) else {
throw MoyaError.jsonMapping(self)
}
return Mapper<T>().mapArray(JSONArray: jsonArray)
}
}
// MARK: - Json -> Observable<Model>
extension ObservableType where E == Response{
// 将Json解析为Observable<Model>
public func mapObject<T : BaseMappable>(_ type : T.Type) -> Observable<T>{
return flatMap{ response -> Observable<T> in
return Observable.just(try response.mapObject(T.self))
}
}
// 将Json解析为Observable<[Model]>
public func mapArray< T : BaseMappable>(_ type : T.Type) -> Observable<[T]>{
return flatMap { response -> Observable<[T]> in
return Observable.just(try response.mapArray(T.self))
}
}
}
| [
125149
] |
43b108096e933f86ad49624e8fa6712d66d734ef | e635020b6ecf8c8f9ad77d81d17016eb24b5507d | /PhotoTourist/ItemCell.swift | 741d96011c1588e1cf900b72c4505efd2949aca8 | [] | no_license | ManuelAurora/PhotoTourist | 999450c183c2d9b047920600a274b61a6c616232 | 79beb558c1c5ffc6af3bc088ccc95e18bb9c8b1f | refs/heads/master | 2021-01-20T19:53:24.209682 | 2017-01-16T08:23:23 | 2017-01-16T08:23:26 | 63,614,779 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 375 | swift | //
// ItemCell.swift
// PhotoTourist
//
// Created by Мануэль on 12.07.16.
// Copyright © 2016 AuroraInterplay. All rights reserved.
//
import UIKit
class ItemCell: UICollectionViewCell
{
@IBOutlet weak var blurView: UIView!
@IBOutlet weak var imageView: UIImageView!
@IBOutlet weak var activityIndicator: UIActivityIndicatorView!
}
| [
-1
] |
0756e3a05353779250ee7d3691c2f9b59c11830d | 35caaa9fe923745107315498587e37c4e6f50784 | /XO-game/GameViewController.swift | 0e81eba33a92be2eed3f04d08689941555cacd13 | [] | no_license | Spote777/XO-game | 5676585924531891f86bea8ea66b147ee9589533 | 4a8f220688975c9db6997c929b17070441127cba | refs/heads/main | 2023-04-05T01:45:02.502028 | 2021-05-02T11:31:39 | 2021-05-02T11:31:39 | 363,633,689 | 0 | 0 | null | 2021-05-02T11:27:01 | 2021-05-02T11:24:56 | Swift | UTF-8 | Swift | false | false | 5,857 | swift | //
// GameViewController.swift
// XO-game
//
// Created by Evgeny Kireev on 25/02/2019.
// Copyright © 2019 plasmon. All rights reserved.
//
import UIKit
enum GameLevel {
case withHuman
case withCPU
case fiveMove
}
class GameViewController: UIViewController {
var level: GameLevel?
private let gameBoard = Gameboard()
private var currentState: GameState! {
didSet {
currentState.begin()
}
}
private lazy var referee = Referee(gameboard: gameBoard)
private var counter = 0
private var invoker = PlayerMoveInvoker()
@IBOutlet var gameboardView: GameboardView!
@IBOutlet var firstPlayerTurnLabel: UILabel!
@IBOutlet var secondPlayerTurnLabel: UILabel!
@IBOutlet var winnerLabel: UILabel!
@IBOutlet var restartButton: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
setFirstState()
gameboardView.onSelectPosition = { [weak self] position in
guard let self = self else { return }
// self.gameboardView.placeMarkView(XView(), at: position)
self.currentState.addMark(at: position)
if self.currentState.isMoveCompleted {
self.counter += 1
self.setNextState()
}
}
}
@IBAction func restartButtonTapped(_ sender: UIButton) {
Log(action: .restartGame)
gameboardView.clear()
gameBoard.clear()
setFirstState()
}
private func setFirstState() {
counter = 0
// let player = Player.first
// currentState = PlayerState(player: player, gameViewController: self,
// gameBoard: gameBoard, gameBoardView: gameboardView, markViewPrototype: player.markViewPrototype)
switch level! {
case .fiveMove:
currentState = FiveMoveState(player: Player.first, gameViewController: self, gameBoard: gameBoard, gameBoardView: gameboardView, markViewPrototype: Player.first.markViewPrototype, invoker: invoker)
case .withCPU, .withHuman:
currentState = buildPlayerState(player: Player.first)
}
}
private func setNextState() {
// if let winner = referee.determineWinner() {
guard let level = level else {return}
if counter >= 9 {
currentState = GameOverState(winner: nil, gameViewController: self)
return
}
if level != .fiveMove, let winner = referee.determineWinner() {
currentState = GameOverState(winner: winner, gameViewController: self)
return
}
//}
// if counter >= 9 {
// currentState = GameOverState(winner: nil, gameViewController: self)
// return
// }
if level == .withHuman, let playerInputState = currentState as? PlayerState {
currentState = buildPlayerState(player: playerInputState.player.next)
return
}
if let playerInputState = currentState as? ComputerState {
currentState = buildPlayerState(player: playerInputState.player.next)
return
}
if level == .fiveMove, let playerInputState = currentState as? FiveMoveState {
gameboardView.clear()
gameBoard.clear()
if playerInputState.player == Player.second {
// расчитать игру
currentState = PlayoutState(invoker: invoker)
if let winner = referee.determineWinner() {
currentState = GameOverState(winner: winner, gameViewController: self)
return
}
return
}
let player = playerInputState.player.next
currentState = FiveMoveState(player: player, gameViewController: self, gameBoard: gameBoard, gameBoardView: gameboardView, markViewPrototype: player.markViewPrototype, invoker: invoker)
return
}
if let playerInputState = currentState as? PlayerState {
let player = playerInputState.player.next
// currentState = PlayerState(player: player, gameViewController: self,
// gameBoard: gameBoard, gameBoardView: gameboardView, markViewPrototype: player.markViewPrototype)
let state = ComputerState(player: player,
gameViewController: self,
gameBoard: gameBoard,
gameBoardView: gameboardView,
markViewPrototype: player.markViewPrototype
)
guard let nextMove = state.makeMove() else { return }
currentState = state
gameboardView.onSelectPosition!(nextMove)
}
}
private func buildPlayerState(player: Player) -> PlayerState {
return PlayerState(player: player,
gameViewController: self,
gameBoard: gameBoard,
gameBoardView: gameboardView,
markViewPrototype: player.markViewPrototype,
invoker: invoker
)
}
}
| [
-1
] |
01878acb3986764f28b8b091fefffb262e7adec4 | 087a570e9fa3025fd3d059b664bfee84048eed1d | /cheer_ios/LoginViewController.swift | 60a8ac1c88e82c9b9e4f95bcb7692f35c20962ba | [] | no_license | shin04/cheer_ios | b643ce47428d2290ad2f49a7449d4cc91032be26 | 2c9837a809a851eca7f9ceaed7fd74ab2e93fbd2 | refs/heads/master | 2020-07-02T16:05:29.345699 | 2019-10-17T14:59:10 | 2019-10-17T14:59:10 | 201,582,373 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,714 | swift | //
// LoginViewController.swift
// cheer_ios
//
// Created by 梶原大進 on 2019/09/24.
// Copyright © 2019年 梶原大進. All rights reserved.
//
import UIKit
import Alamofire
protocol LoginViewInterface: class {
var parameters: [String: Any]? { get }
func toHome()
}
class LoginViewController: UIViewController, UITextFieldDelegate, LoginViewInterface {
//var token: String?
@IBOutlet var usernameTextField: UITextField!
@IBOutlet var passwordTextField: UITextField!
var parameters: [String : Any]?
var presenter: LoginPresenter!
var url = CheerUrl.shared.baseUrl
var username: String?
var password: String?
override func viewDidLoad() {
super.viewDidLoad()
presenter = LoginPresenter(with: self)
usernameTextField.delegate = self
passwordTextField.delegate = self
usernameTextField.tag = 1
passwordTextField.tag = 2
}
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
if textField.tag == 1 {
username = usernameTextField.text!
} else if textField.tag == 2 {
password = passwordTextField.text!
}
textField.resignFirstResponder()
return true
}
func toHome() {
dismiss(animated: true, completion: nil)
}
@IBAction func login(_ sender: Any) {
if username != nil || password != nil {
let parameters: [String: Any] = [
"username": username!,
"password": password!,
]
self.parameters = parameters
presenter.loginButtonTapped()
}
}
}
| [
-1
] |
fb464799ef83f9631f18b1506f1fe957c086ef69 | a4a62ad21546340288abc9abff31d386657566e3 | /TaxiUser/VerifyPhoneViewController.swift | 720484ab9437288e2139537ad6bddbd98f369fa6 | [] | no_license | Ariel44r/CarFlashUser | 20321d2a28e88ffb163a1ef43acc99f43d50b23d | a47ee9f7eceae2d296caf433417039f2be3c7527 | refs/heads/master | 2020-03-20T02:26:15.663435 | 2018-06-22T18:26:28 | 2018-06-22T18:26:28 | 137,112,993 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 7,814 | swift | //
// VerifyPhoneViewController.swift
// YoTaxiCab Customer
//
// Created by AppOrio on 04/10/17.
// Copyright © 2017 apporio. All rights reserved.
//
import UIKit
class VerifyPhoneViewController: UIViewController,MainCategoryProtocol,MICountryPickerDelegate {
//@IBOutlet var container: UIView!
var checkotpdata : CheckOtpModel!
var forgotcheckotpdata : ForgotCheckOtpModel!
@IBOutlet weak var countrycodetext: UILabel!
@IBOutlet weak var enterphonetext: UITextField!
@IBOutlet weak var enterotptext: UITextField!
var otpvalue = "0"
@IBOutlet weak var pleaseenterdetailstext: UILabel!
@IBOutlet weak var getotpbtntext: UIButton!
@IBOutlet weak var verifyphonenumbertextlabel: UILabel!
@IBOutlet weak var submitbtntext: UIButton!
var matchString = ""
var selcetcountrycode = "+52"
var phonetext = ""
@IBOutlet weak var otpcontainer: UIView!
override func viewDidLoad() {
super.viewDidLoad()
pleaseenterdetailstext.text = "Please enter the One Time Password(OTP) received on your entered mobile number!".localized
verifyphonenumbertextlabel.text = "Verify Phone Number".localized
getotpbtntext.setTitle("GET OTP".localized, for: UIControlState.normal)
submitbtntext.setTitle("Submit".localized, for: UIControlState.normal)
enterphonetext.placeholder = "Enter Phone".localized
enterotptext.placeholder = "Enter Otp".localized
// self.container.edgeWithShadow()
// self.otpcontainer.edgeWithShadow()
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func backbtn(_ sender: Any) {
self.dismiss(animated: true, completion: nil)
}
func countryPicker(_ picker: MICountryPicker, didSelectCountryWithName name: String, code: String) {
}
func countryPicker(_ picker: MICountryPicker, didSelectCountryWithName name: String, code: String, dialCode: String)
{
selcetcountrycode = dialCode
countrycodetext.text = dialCode
self.dismiss(animated: true, completion: nil)
}
@IBAction func Selectcountrycode_btn(_ sender: Any) {
let picker = MICountryPicker { (name, code) -> () in
debugPrint(code)
}
picker.delegate = self
let backButton = UIBarButtonItem(title: "Back", style: UIBarButtonItemStyle.plain, target: self, action: #selector(backButtonTapped))
picker.navigationItem.leftBarButtonItem = backButton
// Display calling codes
picker.showCallingCodes = true
// or closure
picker.didSelectCountryClosure = { name, code in
}
// self.present(picker, animated: true, completion: nil)
let navcontroller = UINavigationController(rootViewController: picker)
self.present(navcontroller,animated: true,completion: nil)
}
func backButtonTapped() {
self.dismiss(animated: true, completion: nil)
}
@IBAction func getotp_btn_click(_ sender: Any) {
phonetext = self.enterphonetext.text!
if((phonetext.characters.count >= 11)){
//if phonetext == ""{
self.showalert(message: "Mobile number must be less than 11 digits.".localized)
}else{
enterotptext.becomeFirstResponder()
if self.matchString == "forgot"{
ApiManager.sharedInstance.protocolmain_Catagory = self
ApiManager.sharedInstance.ForgotGetOtpMethod(Phone: selcetcountrycode + self.enterphonetext.text!)
}else{
ApiManager.sharedInstance.protocolmain_Catagory = self
ApiManager.sharedInstance.GetOtpMethod(Phone: selcetcountrycode + self.enterphonetext.text!)
}
}
}
@IBAction func Submit_btn_click(_ sender: Any) {
phonetext = self.enterphonetext.text!
if phonetext == ""{
self.showalert(message: "Please Enter Mobile Number First".localized)
}else{
if otpvalue == self.enterotptext.text!
{
if self.matchString == "forgot"{
GlobalVarible.enteruserphonenumber = selcetcountrycode + self.enterphonetext.text!
let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle:nil)
let vc = storyBoard.instantiateViewController(withIdentifier: "ForgotPasswordViewController") as! ForgotPasswordViewController
self.present(vc, animated: true, completion: nil)
}else{
GlobalVarible.checkphonenumber = 1
GlobalVarible.enteruserphonenumber = selcetcountrycode + self.enterphonetext.text!
self.dismiss(animated: true, completion: nil)
}
}else{
self.showalert(message: "Please Enter Valid OTP".localized)
}
}
}
func showalert(message:String) {
DispatchQueue.main.async(execute: {
let alertController = UIAlertController(title: "Alert".localized, message:message, preferredStyle: .alert)
let OKAction = UIAlertAction(title: "ok".localized, style: .default) { (action) in
}
alertController.addAction(OKAction)
self.present(alertController, animated: true) {
}
})
}
func onProgressStatus(value: Int) {
if(value == 0 ){
MBProgressHUD.hide(for: self.view, animated: true)
}else if (value == 1){
let spinnerActivity = MBProgressHUD.showAdded(to: self.view, animated: true)
spinnerActivity.label.text = "Loading".localized
spinnerActivity.detailsLabel.text = "Please Wait!!".localized
spinnerActivity.isUserInteractionEnabled = false
}
}
func onSuccessExecution(msg: String) {
debugPrint("\(msg)")
}
func onerror(msg : String) {
MBProgressHUD.hide(for: self.view, animated: true)
self.showalert(message: msg)
}
func onSuccessParse(data: AnyObject) {
if(GlobalVarible.Api == "CheckOtpModel"){
checkotpdata = data as! CheckOtpModel
if(checkotpdata.result == 1){
self.otpvalue = checkotpdata.otp!
}else{
self.showalert(message: checkotpdata.msg!)
}
}
if(GlobalVarible.Api == "ForgotCheckOtpModel"){
forgotcheckotpdata = data as! ForgotCheckOtpModel
if(forgotcheckotpdata.result == 1){
self.otpvalue = forgotcheckotpdata.otp!
}else{
self.showalert(message: forgotcheckotpdata.msg!)
}
}
}
}
| [
-1
] |
ae0b2fd1da9e5ccdb12dd2f5fc13bbfd60cfd46a | e02987c62f48b637566b2cbae20d1b5561f9d693 | /You Are Awesome!/ViewController.swift | ddf36a0024e423f65e227f90905b6e777a98f5d9 | [] | no_license | iOS-Swift-Fall2017/you-are-awesome-part-2-mcdappdev | 0c0b43143b569fad136732fa64dbd84c9e9cf426 | a1409a012b95c011383329a2f89e2c7b1833c46a | refs/heads/master | 2021-06-26T17:07:18.196646 | 2017-09-11T16:16:50 | 2017-09-11T16:16:50 | 103,158,435 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,594 | swift | //
// ViewController.swift
// You Are Awesome!
//
// Created by Jimmy McDermott on 8/27/17.
// Copyright © 2017 162 LLC. All rights reserved.
//
import UIKit
import AVFoundation
class ViewController: UIViewController {
//MARK: - Variables
private var index = -1
private var imageNumber = -1
private var numberOfImages = 5
private var soundNumber = -1
private var numberOfSoundFiles = 3
private var awesomePlayer = AVAudioPlayer()
//MARK: - Outlets
@IBOutlet private weak var messageLabel: UILabel!
@IBOutlet private weak var awesomeImage: UIImageView!
@IBOutlet private weak var soundSwitch: UISwitch!
//MARK: - Functions
private func playSound(soundName: String, audioPlayer: inout AVAudioPlayer) {
if let sound = NSDataAsset(name: soundName) {
do {
audioPlayer = try AVAudioPlayer(data: sound.data)
audioPlayer.play()
} catch {
print("Error: Couldn't be played as a sound file")
}
} else {
print("ERROR: file \(soundName) didn't load")
}
}
private func nonRepeatingRandom(lastNumber: Int, maxValue: Int) -> Int {
var newIndex = -1
repeat {
newIndex = Int(arc4random_uniform(UInt32(maxValue)))
} while lastNumber == newIndex
return newIndex
}
@IBAction private func soundSwitchPressed(_ sender: UISwitch) {
if !soundSwitch.isOn && soundNumber != -1 {
awesomePlayer.stop()
}
}
@IBAction private func messageButtonPressed(_ sender: UIButton) {
let messages = ["You Are Fantastic!",
"You Are Great!",
"You are Amazing!",
"When the Genius Bar needs help, they call you!",
"You Brighten My Day!",
"You Are Da Bomb!",
"I can't wait to use your app!"]
index = nonRepeatingRandom(lastNumber: index, maxValue: messages.count)
messageLabel.text = messages[index]
awesomeImage.isHidden = false
imageNumber = nonRepeatingRandom(lastNumber: imageNumber, maxValue: numberOfImages)
awesomeImage.image = UIImage(named: "image\(imageNumber)")
if soundSwitch.isOn {
soundNumber = nonRepeatingRandom(lastNumber: soundNumber, maxValue: numberOfSoundFiles)
playSound(soundName: "sound\(soundNumber)", audioPlayer: &awesomePlayer)
}
}
}
| [
-1
] |
59f2b374053293cee88cc28d67fe5b18b222b79a | 2eca2ae47d05633abdc0afdea5d9cf4a48a36c08 | /News/Views/NewsSourcesView/NewsSourcesViewController.swift | 9219cb9fdc30c8b0a74bcb7049168f4502efdda3 | [] | no_license | mmirsat/News | 7e827e1942c8fcc2bf8bfb4bb25696d3fe71734f | 95acf9e8901d36314522c35c20c41c02dbc0aa59 | refs/heads/master | 2023-03-05T08:23:21.610570 | 2017-12-01T13:49:31 | 2017-12-01T13:49:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,326 | swift | //
// NewsSourcesViewController.swift
// News
//
// Created by mirsat on 27/11/17.
// Copyright © 2017 mirsat. All rights reserved.
//
import UIKit
import SwiftyJSON
class NewsSourcesViewController: UIViewController {
@IBOutlet weak var collectionView: UICollectionView!
private var newsSourceCollectionViewAdapter: CollectionViewAdapter<NewsSourceCollectionViewCell, NewsSource>!
fileprivate let reuseIdentifierForNewsSourceCell = "NewsSourceCollectionViewCell"
var newsSources: [NewsSource]!
var selectedSource: NewsSource!
override func viewDidLoad() {
super.viewDidLoad()
getNewsSources()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
func getNewsSources() {
NewsApi.getNewsSources { (data) in
if let sources = data {
self.newsSources = sources
self.setupCollectionView()
}
}
}
func setupCollectionView() {
collectionView.register(UINib(nibName: "NewsSourceCollectionViewCell", bundle: nil), forCellWithReuseIdentifier: reuseIdentifierForNewsSourceCell)
self.newsSourceCollectionViewAdapter = CollectionViewAdapter(
collectionView: self.collectionView,
cellReuseIdentifier: reuseIdentifierForNewsSourceCell,
items: newsSources,
cellConfigurationHandler: { (cell, source) in
cell.setNewsInformation(source: source)
},
cellSizeHandler: { (cell, item) -> (CGSize) in
let viewWidth = UIScreen.main.bounds.size.width
return CGSize(width: viewWidth / 2 - 20, height: viewWidth / 2 - 20)
},
didSelectItemHandler: { (item) in
self.selectedSource = item
self.performSegue(withIdentifier: "newsView", sender: nil)
})
self.collectionView.dataSource = self.newsSourceCollectionViewAdapter
self.collectionView.delegate = self.newsSourceCollectionViewAdapter
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "newsView" {
let vc = segue.destination as! NewsViewController
vc.selectedSource = self.selectedSource
}
}
}
| [
-1
] |
dbb8d0d61a83ed9fe45a4ac40901b249fb102e6a | 33e88e070931406460e08badad5cf154a2117055 | /Nussalergie/NeueRezeptViewController.swift | ddc869f7420d23d9fc9c93c964eb53e14e54ceaf | [] | no_license | Starking1/Nussalergie1 | a0eab0880a6a7d0fe9f4c13a2d89886ab671ed47 | e2f3b4dcea8867455d8af173e1c1ac50ba95b555 | refs/heads/master | 2020-05-21T20:35:33.439848 | 2016-09-23T15:19:50 | 2016-09-23T15:19:50 | 62,510,411 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 14,860 | swift | //
// NeueRezeptViewController.swift
// Nussalergie
//
// Created by timi on 08.07.16.
// Copyright © 2016 Scheissegal. All rights reserved.
//
import UIKit
import Firebase
class NeueRezeptViewController: UIViewController, UITextFieldDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate, UITableViewDelegate, UITableViewDataSource {
let rezeptNavigationTitle: String = "Neues Rezept"
let rezeptImageView: UIImageView = UIImageView()
let rezeptImageViewOverlayButton: UIButton = UIButton()
let ImageViewwidth: CGFloat = 150;
let rezeptNameLabel: UILabel = UILabel()
let rezeptNameTextfield: UITextField = UITextField()
let rezeptDauerLabel: UILabel = UILabel()
let rezeptDauerTextfield: UITextField = UITextField()
let rezeptZubereitungLabel: UILabel = UILabel()
let rezeptZubereitungsTextfield: UITextField = UITextField()
let ZubereitungsTextfieldheight: CGFloat = 200;
let rezeptZutatenLabel:UILabel = UILabel()
let rezeptZutatenButton: UIButton = UIButton()
let zutatenSearchTextfield: UITextField = UITextField()
var rezeptID: Int = Int()
let scrollView: UIScrollView = UIScrollView()
var zubereitungsDict = [String : AnyObject]()
let auswahlzutatenTableView: UITableView = UITableView()
var ausgewahlteZutat = [RezeptZutat]()
var zutatenArray = [RezeptZutat]()
let rootRef = FIRDatabase.database().reference()
let storageRef = FIRStorage.storage().reference()
let zutatenRef = FIRDatabase.database().reference().child("Zutaten")
var imagePicker: UIImagePickerController!
override func viewDidLoad() {
super.viewDidLoad()
self.navigationItem.title = "Neues Rezept"
auswahlzutatenTableView.delegate = self
auswahlzutatenTableView.dataSource = self
auswahlzutatenTableView.scrollEnabled = false
auswahlzutatenTableView.registerNib(UINib(nibName: "SearchedZutat", bundle: nil), forCellReuseIdentifier: "searchedCell")
scrollView.frame = CGRectMake(0, 0, view.frame.width, view.frame.height)
scrollView.contentSize = CGSize(width: view.frame.width, height: 2000)
rezeptImageView.frame = CGRectMake(view.frame.width - ImageViewwidth - 20, 20 ,ImageViewwidth,ImageViewwidth)
rezeptImageView.backgroundColor = UIColor.lightGrayColor()
rezeptImageView.image = UIImage.fontAwesomeIconWithName(.Camera, textColor: UIColor.blackColor(), size: CGSize(width: 50, height: 50))
rezeptImageView.layer.zPosition = -1
rezeptImageViewOverlayButton.frame = rezeptImageView.frame
rezeptImageViewOverlayButton.addTarget(self, action: #selector(pressedTakePicture), forControlEvents: .TouchUpInside)
rezeptNameLabel.frame = CGRectMake(20, 20, 100, 30)
rezeptNameLabel.text = "Name"
rezeptNameTextfield.frame = CGRectMake(20, 55, 100, 30)
rezeptNameTextfield.backgroundColor = UIColor.greenColor()
rezeptDauerLabel.frame = CGRectMake(20, 100, 100, 30)
rezeptDauerLabel.text = "Dauer"
rezeptDauerTextfield.frame = CGRectMake(20, 135, 100, 30)
rezeptDauerTextfield.keyboardType = .NumberPad
rezeptDauerTextfield.backgroundColor = UIColor.greenColor()
rezeptZubereitungLabel.frame = CGRectMake(20, 180, 100, 30)
rezeptZubereitungLabel.text = "Zubereitung"
rezeptZubereitungsTextfield.frame = CGRectMake(20, 205,view.frame.width - 40 , ZubereitungsTextfieldheight)
rezeptZubereitungsTextfield.backgroundColor = UIColor.greenColor()
rezeptZubereitungsTextfield.contentVerticalAlignment = UIControlContentVerticalAlignment.Top
rezeptZubereitungsTextfield.delegate = self
rezeptZutatenLabel.frame = CGRectMake(20, 210 + ZubereitungsTextfieldheight + 10, 100, 30)
rezeptZutatenLabel.text = "Zutaten"
zutatenSearchTextfield.frame = CGRectMake(20,250 + ZubereitungsTextfieldheight + 10,view.frame.width - 40,30)
zutatenSearchTextfield.placeholder = "neue Zutat"
zutatenSearchTextfield.addTarget(self, action: #selector(textFieldDidChange), forControlEvents: UIControlEvents.EditingChanged)
auswahlzutatenTableView.frame = CGRectMake(5, 290 + ZubereitungsTextfieldheight + 10, self.view.frame.width-10, 0)
// auswahlzutatenTableView.backgroundColor = UIColor.blueColor()
rezeptZutatenButton.frame = CGRectMake(view.frame.width - 120, 210 + ZubereitungsTextfieldheight + 10, 100, 30)
rezeptZutatenButton.setTitle("Posten", forState: .Normal)
rezeptZutatenButton.setTitleColor(UIColor.blueColor(), forState: .Normal)
rezeptZutatenButton.addTarget(self, action: Selector(), forControlEvents: .TouchUpInside)
scrollView.addSubview(rezeptImageView)
scrollView.addSubview(rezeptImageViewOverlayButton)
scrollView.addSubview(rezeptNameLabel)
scrollView.addSubview(rezeptNameTextfield)
scrollView.addSubview(rezeptDauerLabel)
scrollView.addSubview(rezeptDauerTextfield)
scrollView.addSubview(rezeptZubereitungLabel)
scrollView.addSubview(rezeptZubereitungsTextfield)
scrollView.addSubview(rezeptZutatenLabel)
scrollView.addSubview(rezeptZutatenButton)
scrollView.addSubview(zutatenSearchTextfield)
scrollView.addSubview(auswahlzutatenTableView)
view.addSubview(scrollView)
}
func pressedPostButton (sender: UIButton!){
//Generate Key For Storage
let key = self.rootRef.childByAutoId().key
//Picture Upload First
// Data in memory
let data: NSData = UIImageJPEGRepresentation(rezeptImageView.image!, 0.8)!;
// Create a reference to the file you want to upload
let riversRef = storageRef.child("images/\(key).jpg")
//Add metadata
let metadata = FIRStorageMetadata()
metadata.contentType = "image/jpeg"
// Upload the file to the path "images/*name*.jpg"
riversRef.putData(data, metadata: metadata) { metadata, error in
if (error != nil) {
print(error?.localizedDescription)
} else {
// Metadata contains file metadata such as size, content-type, and download URL.
//let downloadURL = metadata!.downloadURL
// This can be stored in the Firebase Realtime Database
// It can also be used by image loading libraries like SDWebImage
let post = ["bild": "\(key).jpg",
"name": self.rezeptNameTextfield.text!,
"zeit": Int(self.rezeptDauerTextfield.text!)!]
let zubereitung = ["text" : self.rezeptZubereitungsTextfield.text!,
"zutaten" : [["id" : 4,
"menge" : 250],
["id": 5,
"menge": 500]]]
let childUpdates = ["/Rezepte/\(key)": post,
"/Zubereitung/\(key)": zubereitung]
self.rootRef.updateChildValues(childUpdates)
}
}
}
func pressedTakePicture (sender: UIButton!){
presentImagePickerSheet()
}
func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) {
picker.dismissViewControllerAnimated(true, completion: nil)
rezeptImageView.image = info[UIImagePickerControllerEditedImage] as? UIImage
rezeptImageView.contentMode = .ScaleAspectFit
}
func textFieldDidBeginEditing(textField: UITextField) {
}
//.addTarget(self, action: #selector(pressedTakePicture), forControlEvents: .TouchUpInside)
func textFieldDidChange(textField: UISearchBar) {
findZutatenneuesRezept(textField.text!)
self.ausgewahlteZutat.removeAll()
}
func findZutatenneuesRezept(text: String)->Void{
if !text.isEmpty {
rootRef.child("Zutaten").queryOrderedByChild("name").queryStartingAtValue(text).queryEndingAtValue(text+"\u{f8ff}").observeSingleEventOfType(.Value , withBlock: { snapshot in
for z in snapshot.children{
let zutat = RezeptZutat()
zutat.name = z.value!["name"] as! String
zutat.einheit = z.value!["einheit"] as! String
print(zutat.name)
self.ausgewahlteZutat.append(zutat)
print(self.ausgewahlteZutat.description)
}
self.populateZutatenTableView()
})
}
}
func presentImagePickerSheet() {
let presentImagePickerController: UIImagePickerControllerSourceType -> () = { source in
let controller = UIImagePickerController()
controller.delegate = self
var sourceType = source
if (!UIImagePickerController.isSourceTypeAvailable(sourceType)) {
sourceType = .PhotoLibrary
print("Fallback to camera roll as a source since the simulator doesn't support taking pictures")
}
controller.sourceType = sourceType
controller.allowsEditing = true
self.presentViewController(controller, animated: true, completion: nil)
}
let alertController = UIAlertController(title: nil, message: nil, preferredStyle: .ActionSheet)
let cancelAction = UIAlertAction(title: "Cancel", style: .Cancel) {(action) in
}
alertController.addAction(cancelAction)
let newPhotoAction = UIAlertAction(title: "Neues Foto Aufnehmen", style: .Default) { (action) in
presentImagePickerController(.Camera)
}
alertController.addAction(newPhotoAction)
let photoLibAction = UIAlertAction(title: "Photo Library", style: .Default) { (action) in
presentImagePickerController(.PhotoLibrary)
}
alertController.addAction(photoLibAction)
self.presentViewController(alertController, animated: true) {}
}
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 2
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if section == 0{
return ausgewahlteZutat.count
}
else{
return zutatenArray.count
}
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("searchedCell", forIndexPath: indexPath)
var zutat = RezeptZutat()
let zutatenCellTextField = cell.viewWithTag(2) as? UITextField
var buttonImage = UIImage()
if indexPath.section == 1{
zutatenCellTextField?.userInteractionEnabled = false
buttonImage = UIImage.fontAwesomeIconWithName(.CheckCircleO, textColor: UIColor.blackColor(), size: CGSize(width: 30, height: 30))
zutat = zutatenArray[indexPath.row]
zutatenCellTextField?.text = "\(zutat.menge)"
}
if indexPath.section == 0{
zutatenCellTextField?.userInteractionEnabled = true
zutatenCellTextField?.text = ""
buttonImage = UIImage.fontAwesomeIconWithName(.CircleO, textColor: UIColor.blackColor(), size: CGSize(width: 30, height: 30))
zutat = ausgewahlteZutat[indexPath.row]
}
if let zutatenCellNameLabel = cell.viewWithTag(1) as? UILabel {
zutatenCellNameLabel.text = zutat.name
}
if let zutatenCellEinheitLabel = cell.viewWithTag(3) as? UILabel {
zutatenCellEinheitLabel.text = zutat.einheit
}
if let zutatenTakenButton = cell.viewWithTag(4) as? UIButton{
zutatenTakenButton.setTitle("", forState: .Normal)
zutatenTakenButton.setImage(buttonImage, forState: .Normal)
zutatenTakenButton.addTarget(self, action: #selector(pressedTakenButton), forControlEvents: .TouchUpInside)
}
cell.selectionStyle = .None
return cell
}
// MARK: UIImagePickerControllerDelegate
func pressedTakenButton (sender: UIButton) {
let touchPoint: CGPoint = sender.convertPoint(CGPointZero, toView: auswahlzutatenTableView)
let clickedButtonIndexPath: NSIndexPath = auswahlzutatenTableView.indexPathForRowAtPoint(touchPoint)!
let thisTextField: UITextField = (auswahlzutatenTableView.cellForRowAtIndexPath(clickedButtonIndexPath)?.viewWithTag(2) as? UITextField)!
auswahlzutatenTableView.beginUpdates()
if clickedButtonIndexPath.section == 0{
var done = false
for zutat in zutatenArray {
if (zutat.name == ausgewahlteZutat[clickedButtonIndexPath.row].name){
if !(thisTextField.text == "") {
zutat.menge += Int(thisTextField.text!)!
}
done = true;
}
}
if(!done){
zutatenArray.append(ausgewahlteZutat[clickedButtonIndexPath.row])
let newIndexPath = NSIndexPath(forRow: zutatenArray.count - 1, inSection:1)
auswahlzutatenTableView.insertRowsAtIndexPaths([newIndexPath], withRowAnimation: .Right)
if !(thisTextField.text == "") {
zutatenArray[zutatenArray.count-1].menge = Int(thisTextField.text!)!
}
thisTextField.text = ""
}
} else{
auswahlzutatenTableView.deleteRowsAtIndexPaths([clickedButtonIndexPath], withRowAnimation: .Right)
zutatenArray.removeAtIndex(clickedButtonIndexPath.row)
}
auswahlzutatenTableView.endUpdates()
populateZutatenTableView()
}
func imagePickerControllerDidCancel(picker: UIImagePickerController) {
dismissViewControllerAnimated(true, completion: nil)
}
func populateZutatenTableView() {
auswahlzutatenTableView.frame.size.height = CGFloat((self.ausgewahlteZutat.count + self.zutatenArray.count) * 44)
auswahlzutatenTableView.reloadData()
self.scrollView.contentSize.height = 250 + self.ZubereitungsTextfieldheight + 10 + auswahlzutatenTableView.frame.height + 40
}
}
| [
-1
] |
db61079567c826997a1d85029e3a94285f3d0188 | 85ed783f15b6ba906763a3e38d8f135c913c7f12 | /Felix Student/Models/Notification.swift | 6ef07112754606bb87c956b818b5992306b965f5 | [] | no_license | boidabhijeet/FelixStudent | cd9e4994a42007c3a9fa67beff5cedb976c31651 | 132a08cb18a54591537747cb2581f9adeecd2121 | refs/heads/main | 2023-07-17T03:34:27.478982 | 2021-08-04T13:20:34 | 2021-08-04T13:20:34 | 390,669,215 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,007 | swift | //
// Notification.swift
// Felix Student
//
// Created by Mac on 03/06/21.
//
import Foundation
import ObjectMapper
class Notification: Mappable {
var id = UUID()
var batchId: String = ""
var body: String = ""
var mediaUrl: String = ""
var notificationId: String = ""
var postedAt: String = ""
var sendToUid: String = ""
var title: String = ""
var type: String = ""
var readAt: Int = 0
var readStatus: Bool = false
required init?(map: Map) {
}
func mapping(map: Map) {
batchId <- map["batchId"]
body <- map["body"]
mediaUrl <- map["mediaUrl"]
notificationId <- map["notificationId"]
postedAt <- map["postedAt"]
sendToUid <- map["sendToUid"]
title <- map["title"]
type <- map["type"]
readAt <- map["readAt"]
readStatus <- map["readStatus"]
}
}
| [
-1
] |
a570ec768135468687f7db733a81807144a00276 | 27ef27b69460235de592847daf366b6000e7a20b | /millionaire/millionaire/Strategy/CreateQuestionStrategy.swift | cf2bff9171aacd096106fc6b38fb3b1628e60a2b | [] | no_license | galishanova/MillionaireGame | a39be2aef6ddf239a9aa0dacab4defe0a12e9b4a | 4f275d3cd5237f5a12613b36ec243f66f4490956 | refs/heads/master | 2023-06-24T14:20:01.105181 | 2021-07-22T16:45:35 | 2021-07-22T16:45:35 | 388,378,403 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 209 | swift | //
// CreateQuestionStrategy.swift
// millionaire
//
// Created by Regina Galishanova on 13.06.2021.
//
import Foundation
protocol CreateQuestionsStrategy {
func createQuestion() -> [Question]
}
| [
-1
] |
9ebb3f1d511c58fcbd3818f97a555f18baae339a | aa04a7f0196b604df93be62bf94b789a86b437c1 | /DataSourceControllerExampleApp/Data/Provider/DataProvider.swift | 5c756df192ee89c62250732000516296cfd37d6d | [
"MIT"
] | permissive | peredaniel/DataSourceController | 4906e0483c449f6ecdd014cfdfdcfd05b56e5211 | dc2d76a18a19dc4742214313c71a74ebf87fac0a | refs/heads/master | 2023-04-19T15:03:47.863930 | 2022-06-22T06:44:01 | 2022-06-22T06:44:01 | 189,750,051 | 1 | 0 | MIT | 2023-04-12T06:13:47 | 2019-06-01T15:42:52 | Swift | UTF-8 | Swift | false | false | 692 | swift | // Copyright © 2019 Pedro Daniel Prieto Martínez. Distributed under MIT License.
import Foundation
import UIKit
enum DataProvider {
private enum Constant {
static let assetName = "ProductsData"
}
static func loadDataModels() -> AppleStoreProducts {
guard let data = NSDataAsset(name: Constant.assetName)?.data,
let dataModels = try? JSONDecoder().decode(AppleStoreProducts.self, from: data)
else {
return .fallback
}
return dataModels
}
}
private extension AppleStoreProducts {
static var fallback: AppleStoreProducts {
AppleStoreProducts(phones: [], pads: [], tvs: [], watches: [])
}
}
| [
-1
] |
15bea8332d11d6631ed86786113471564b861930 | d8d5d033881096c4054538989ec49fc8fd3cda12 | /Tests/iOSClientExposureTests/Asset/AssetUserDataSpec.swift | efaf829af1c73857abf2495417fb196559f8f4ad | [
"Apache-2.0"
] | permissive | EricssonBroadcastServices/iOSClientExposure | af1a251ded47f2359fe6ec5c415d426d45e73ee2 | 2aa2e3a58a8563f7a2e12b70fb908b6823ab867b | refs/heads/master | 2023-07-05T18:59:59.560355 | 2023-06-27T15:15:09 | 2023-06-27T15:15:09 | 88,722,401 | 0 | 2 | Apache-2.0 | 2023-09-13T14:29:19 | 2017-04-19T08:47:47 | Swift | UTF-8 | Swift | false | false | 1,674 | swift | //
// AssetUserDataSpec.swift
// ExposureTests
//
// Created by Fredrik Sjöberg on 2017-09-29.
// Copyright © 2017 emp. All rights reserved.
//
import Foundation
import Quick
import Nimble
@testable import iOSClientExposure
class AssetUserDataSpec: QuickSpec {
override func spec() {
super.spec()
describe("JSON") {
it("should succeed with valid response") {
let json = AssetUserDataJSON.valid()
let result = json.decode(AssetUserData.self)
expect(result).toNot(beNil())
expect(result?.playHistory).toNot(beNil())
}
it("should init with empty or non matching response") {
let result = AssetUserDataJSON.incomplete().decode(AssetUserData.self)
expect(result).toNot(beNil())
}
it("should init with empty or non matching response") {
let json = AssetUserDataJSON.empty()
let result = json.decode(AssetUserData.self)
expect(result).toNot(beNil())
}
}
}
}
extension AssetUserDataSpec {
enum AssetUserDataJSON {
static func valid() -> [String: Any] {
return [
"playHistory": AssetUserPlayHistorySpec.AssetUserPlayHistoryJSON.valid()
]
}
static func incomplete() -> [String: Any] {
return [
"playHistory": [:]
]
}
static func empty() -> [String: Any] {
return [:]
}
}
}
| [
-1
] |
bf7771acfc6e7eaa2fed3578c76d2aead88d6cc5 | 386b060b8e49e632b20896d000c4b46b44ee1aa9 | /Desafio-3/Desafio-3/Heroes.swift | 6991cf0b6518361c98a28a540314a053e4552c4f | [] | no_license | RafaelKleinH/Desafio3 | 4de76f98f00c78e63b9f7883b38e4fdd42bd60d9 | e5a33c09e70a3fc1f47e3fadfa55b84797a1bf26 | refs/heads/main | 2023-03-27T18:29:15.786737 | 2021-03-12T19:03:43 | 2021-03-12T19:03:43 | 347,140,407 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 344 | swift | //
// Heroes.swift
// MediaNotas
//
// Created by Rafael Hartmann on 11/03/21.
//
import Foundation
struct Heroes: Codable {
let name: String
let realName: String
let powers: String
let team: String
let description: String
let appearances: [Apears]
}
struct Apears: Codable {
let nameAppear: String
}
| [
-1
] |
537fc661e5f7a5dadd0bba5030078dd0e011f572 | dd54d146937e948c78aee6795e1c76baad4b57a9 | /Crypto/Sources/KeychainItemAccess.swift | e143fe18599269946a74ffd921e5c248e6787569 | [] | no_license | hyperiumio/vault | 2d637419cfcc0c9bf9dd49dab7fbe9e4ad493fe7 | 9fd8423003a32e6bb3cd5e002b139c6c3a61cc57 | refs/heads/master | 2021-11-12T01:48:38.828211 | 2021-10-20T15:34:39 | 2021-10-20T15:34:39 | 216,332,141 | 4 | 0 | null | 2021-01-26T14:56:28 | 2019-10-20T08:44:20 | Swift | UTF-8 | Swift | false | false | 76 | swift | enum KeychainItemAccess {
case all
case currentBiometry
}
| [
-1
] |
bde89ebc41bffd03e426835d683a138e97f38fc4 | 31060fe97d53f6789a7f736d9fbd8b8f2b1f92ab | /14-rotation-deprecation/DeprecateToRotate/DeprecateToRotateTests/DeprecateToRotateTests.swift | 21695a2efbed7b74e8f0da7c14d56d7a8eb3de56 | [
"Apache-2.0"
] | permissive | agrippa1994/iOS8-day-by-day | 294f50a196a09cc9b06279e4ad2dcfb8fc593192 | 1bee7d51c127485344e7a6e00b145028b290cd02 | refs/heads/master | 2021-01-15T12:55:17.447251 | 2014-09-13T13:13:37 | 2014-09-13T13:13:37 | 24,000,459 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 936 | swift | //
// DeprecateToRotateTests.swift
// DeprecateToRotateTests
//
// Created by Sam Davies on 31/07/2014.
// Copyright (c) 2014 ShinobiControls. All rights reserved.
//
import UIKit
import XCTest
class DeprecateToRotateTests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// This is an example of a functional test case.
XCTAssert(true, "Pass")
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measureBlock() {
// Put the code you want to measure the time of here.
}
}
}
| [
276481,
276489,
276492,
278541,
278544,
276509,
278570,
159807,
276543,
280649,
276555,
223318,
278615,
288857,
278618,
227417,
194652,
194653,
276577,
276581,
276582,
43109,
276585,
223340,
276589,
227439,
276592,
284788,
227446,
276603,
276606,
141450,
311435,
276627,
276632,
184475,
227492,
196773,
227495,
129203,
176314,
227528,
276684,
282831,
278742,
278746,
155867,
278753,
196834,
276709,
276710,
276715,
233715,
157944,
227576,
227585,
276744,
227592,
276748,
276753,
157970,
276760,
278810,
276764,
276774,
262450,
278846,
164162,
276813,
278862,
278863,
276821,
276822,
276831,
276835,
276847,
278898,
178571,
278954,
278965,
276919,
276920,
278969,
127427,
127428,
278985,
279002,
276958,
276962,
276963,
227813,
279018,
279019,
279022,
276998,
186893,
223767,
289304,
223769,
277017,
279065,
277029,
277048,
301634,
369220,
277066,
166507,
189036,
189037,
277101,
189043,
277118,
184962,
277133,
225933,
225936,
277138,
277141,
277142,
225943,
164512,
225956,
225962,
209581,
154291,
154294,
303803,
199366,
225997,
226001,
164563,
277203,
277204,
203478,
119513,
201442,
226033,
226035,
209660,
234241,
226051,
209670,
277254,
226058,
234256,
234263,
234268,
105246,
228129,
281377,
234280,
277289,
293672,
234283,
152365,
277294,
234286,
226097,
162621,
234301,
234304,
295744,
162626,
234311,
234312,
234317,
277327,
234323,
234326,
277339,
297822,
234335,
234340,
174949,
234343,
234346,
234349,
400239,
277360,
213876,
277366,
234361,
226170,
234367,
234372,
226184,
234377,
234381,
226194,
234387,
234392,
279456,
277410,
234404,
226214,
256937,
234409,
234412,
226222,
234419,
277435,
287677,
234430,
226241,
275397,
234438,
226249,
234450,
234451,
234454,
234457,
275418,
234463,
234466,
277480,
179176,
183279,
234482,
234492,
277505,
234498,
277510,
234503,
277513,
234506,
234509,
277517,
197647,
277518,
295953,
275469,
234517,
281625,
234530,
234534,
275495,
234539,
275500,
310317,
277550,
275505,
275506,
234548,
203830,
277563,
7229,
7230,
7231,
277566,
156733,
234560,
234565,
277574,
234569,
207953,
296018,
277585,
234583,
234584,
275547,
277596,
234594,
277603,
234603,
281707,
275571,
234612,
285814,
398457,
234622,
275590,
234631,
253063,
277640,
302217,
226451,
275607,
119963,
234652,
275625,
208043,
226476,
275628,
226479,
277690,
277694,
203989,
195811,
285929,
204022,
120055,
120056,
204041,
277792,
199971,
277800,
113962,
277803,
277806,
113966,
226608,
226609,
277809,
277821,
277824,
277825,
15686,
277831,
226632,
277838,
277841,
222548,
277845,
277844,
224605,
218462,
224606,
142689,
302438,
277862,
281962,
277868,
173420,
277871,
279919,
275831,
275832,
277882,
142716,
275838,
275839,
277890,
277891,
148867,
275847,
277896,
277897,
277900,
230799,
296338,
277907,
206228,
277911,
226711,
226712,
277919,
277920,
277925,
277927,
277936,
277939,
277940,
173491,
277943,
296375,
277946,
277949,
277952,
296387,
163269,
277962,
282060,
277965,
306639,
277969,
277974,
228823,
228824,
277977,
277980,
226781,
277983,
277988,
277993,
277994,
296425,
277997,
306673,
278002,
278008,
153095,
175625,
192010,
65041,
204313,
278060,
228917,
288326,
282183,
226888,
276046,
226906,
243292,
226910,
239198,
276088,
278140,
188031,
276097,
276100,
276101,
312972,
278160,
278162,
239250,
276116,
276117,
276120,
278170,
280220,
276126,
276129,
278191,
278195,
296628,
276148,
278201,
276156,
278214,
280267,
323276,
276179,
276180,
18138,
216795,
216796,
276195,
313065,
12010,
276210,
276219,
171776,
278285,
276238,
227091,
184086,
278299,
276253,
276257,
278307,
288547,
159533,
200498,
276279,
276282,
276283,
276287,
307011,
276298,
276311,
280410,
276325,
292712,
276332,
173936,
313203,
110452,
276344,
276350,
227199,
1923,
40850,
282518,
44952,
247712,
227238,
276394,
276400,
276401,
276408,
161722,
276413,
237504,
276421,
276422,
284619,
276430,
153552,
276443,
153566,
276450,
317415,
276462,
276463,
276468,
276469,
278518,
276475
] |
5ef5dcdece4f4452133e8708875ce6d162132843 | 1c113eb291f3bc99e48c317c5c5743a9354b98a0 | /CgExercise/CgExercise/CGHomeCVCell.swift | 7224cee48f92950034903131e781cad491d3ae33 | [] | no_license | rajendrakd91/DemoRepo | 20d6d879cf58f23a01315437b9491ca9a797321f | 48288cb8934e47fbaaa198019fdd1fdb1602c61a | refs/heads/master | 2020-03-10T01:07:23.090047 | 2018-04-12T05:09:12 | 2018-04-12T05:09:12 | 129,101,123 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,249 | swift | //
// CGHomeCVCell.swift
// CgExercise
//
// Created by Test User 1 on 11/04/18.
// Copyright © 2018 Capgemini. All rights reserved.
//
import UIKit
class CGHomeCVCell: UICollectionViewCell {
@IBOutlet weak var imageView: UIImageView!
@IBOutlet weak var titleLabel: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
func configureCell(model: FactModel?) {
if let factObj = model {
if let textStr = factObj.title {
titleLabel.text = textStr
}else {
titleLabel.text = "No Data"
}
imageView.image = nil
print(factObj.title)
if let url = factObj.imageHref {
// imageView.downloadImageFromUrl(url)
APP_DEL.imageLoader.obtainImageWithPath(imagePath: url, completionHandler: { (image) in
if image != nil {
DispatchQueue.main.async {
self.imageView.image = image
}
}
})
}
}
}
}
//let imageCache = NSCache()
| [
-1
] |
ac2afc5f57ef40dc20c9a8740b05c5f26a2a8ca4 | 831619c4ee32cefb42c34cbc5a22353dde40db40 | /ThreeStepsProfil/Views/ProfilOneSpotLocationCell.swift | 435de2302d594b0ccd9e507d4d9ade431258d416 | [] | no_license | CoachThys/ThreeStepsProfil | 8600caebc9e2e8f55460b14f59dcb328bb1dafc9 | fb035602c0a83a118842ea2d1253d65c035942d2 | refs/heads/master | 2021-05-09T22:40:32.460841 | 2020-10-07T05:43:46 | 2020-10-07T05:43:46 | 118,761,335 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,293 | swift | //
// ProfilOneSpotLocationCell.swift
// ThreeStepsProfil
//
// Created by CoachThys on 24/01/2018.
// Copyright © 2018 CoachThys. All rights reserved.
//
import UIKit
import GoogleMaps
class ProfilOneSpotLocationCell: UITableViewCell {
// MARK - Views
let containerView: UIView = {
let v = UIView()
v.backgroundColor = .clear
return v
} ()
let mapContainer: UIView = {
let v = UIView()
v.backgroundColor = .yellow
return v
}()
var myMapView: UIView = {
var v = UIView()
v.backgroundColor = .black
return v
} ()
let titleLabel : UILabel = {
let label = UILabel()
label.text = ""
label.font = UIFont(name: "HelveticaNeue-Thin", size: 10.0)
label.numberOfLines = 0
label.lineBreakMode = .byWordWrapping
// label.backgroundColor = .orange
return label
}()
// MARK - Properties
var mapIsSet = false
var spot:Spot? {
didSet {
if !mapIsSet {
setupMap()
mapIsSet = true
}
}
}
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupViews()
}
// MARK - Functions
fileprivate func setupViews() {
contentView.addSubview(containerView)
containerView.anchor(top: contentView.topAnchor, left: contentView.leftAnchor, bottom: contentView.bottomAnchor, right: contentView.rightAnchor, paddingTop: 6, paddingLeft: 12, paddingBottom: 12, paddingRight: 12, width: 0, height: 0)
containerView.addSubview(titleLabel)
containerView.addSubview(mapContainer)
mapContainer.anchor(top: nil, left: containerView.leftAnchor, bottom: containerView.bottomAnchor, right: containerView.rightAnchor, paddingTop: 0, paddingLeft: 0, paddingBottom: 0, paddingRight: 0, width: 0, height: 250)
titleLabel.anchor(top: containerView.topAnchor, left: containerView.leftAnchor, bottom: mapContainer.topAnchor, right: containerView.rightAnchor, paddingTop: 0, paddingLeft: 0, paddingBottom: 3, paddingRight: 0, width: 0, height: 0)
}
fileprivate func setupMap() {
GMSServices.provideAPIKey("AIzaSyAYOxXLk6JpFsG3J79xovx3n0a2ZDoCznk")
let camera = GMSCameraPosition.camera(withLatitude: 55.0, longitude: 85.0, zoom: 10)
myMapView = GMSMapView.map(withFrame: self.mapContainer.bounds, camera: camera)
myMapView.isUserInteractionEnabled = false
containerView.addSubview(myMapView)
myMapView.anchor(top: mapContainer.topAnchor, left: mapContainer.leftAnchor, bottom: mapContainer.bottomAnchor, right: mapContainer.rightAnchor, paddingTop: 0, paddingLeft: 0, paddingBottom: 0, paddingRight: 0, width: 0, height: 250)
let marker = GMSMarker()
marker.position = camera.target
// marker.icon = UIImage(named:"profil-select")
marker.map = myMapView as? GMSMapView
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
| [
-1
] |
311acb6ca1f1a1aa8179a2510bd1768e95cf528c | e9a016ab7aa39142e50ee78578ebbe967a58bfc4 | /MatePet/FBLoginViewController.swift | 8ea232bce4fdd864d129597723d29f1cc195e68d | [] | no_license | b004020018/MatePet | 68c960bd3ed224d2794d6488812173a9dd26eb8c | 5aaac0213ec8cfd5ea8df74f3e8bf77503375f74 | refs/heads/master | 2020-05-25T15:41:07.232510 | 2016-11-07T10:50:51 | 2016-11-07T10:50:51 | 69,635,672 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,581 | swift | //
// FBLoginViewController.swift
// MatePet
//
// Created by RosalieRabbit on 2016/9/28.
// Copyright © 2016年 RosalieRabbit. All rights reserved.
//
import UIKit
import Firebase
import FBSDKCoreKit
import FBSDKLoginKit
import Crashlytics
class FBLoginViewController: UIViewController {
let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
@IBOutlet weak var unLoginBrowseButton: UIButton!
@IBAction func unLoginBrowseButton(sender: UIButton) {
self.appDelegate.isLogin = false
self.dismissViewControllerAnimated(true, completion: nil)
let parent = self.presentingViewController as? UITabBarController
parent?.selectedIndex = 0
print("browse")
}
@IBOutlet weak var FBLoginButton: UIButton!
@IBAction func FBLoginButton(sender: UIButton) {
let facebookLogin = FBSDKLoginManager()
facebookLogin.logInWithReadPermissions(["public_profile", "email"], fromViewController: self, handler:{(facebookResult, facebookError) -> Void in
if facebookError != nil { print("Facebook login failed. Error \(facebookError)")
} else if facebookResult.isCancelled { print("Facebook login was cancelled.")
} else {
let credential = FIRFacebookAuthProvider.credentialWithAccessToken(FBSDKAccessToken.currentAccessToken().tokenString)
FIRAuth.auth()?.signInWithCredential(credential) {(user, error) in
//store user Data
guard let user = user else { fatalError() }
let userDefault = NSUserDefaults.standardUserDefaults()
for profile in user.providerData {
userDefault.setValue(profile.uid, forKey: "userFacebookID")
}
userDefault.setValue(user.uid, forKey: "userFirebaseID")
userDefault.setValue(user.displayName, forKey: "userName")
userDefault.setValue(user.email, forKey: "userEmail")
userDefault.setURL(user.photoURL, forKey: "userPhoto")
userDefault.synchronize()
self.appDelegate.isLogin = true
self.dismissViewControllerAnimated(true, completion: nil)
print("login FB")
}
}
})
}
override func viewDidLoad() {
self.FBLoginButton.layer.cornerRadius = 5
self.unLoginBrowseButton.layer.cornerRadius = 5
}
}
| [
-1
] |
8975e86966bc87926212657f23c5d3f5eb9b27ab | 6728faff59a09980d00ed1b3b501044c6831c3af | /TableviewDropMenu/TableViewCellNames.swift | 9e9c3e08b9f8e1172a765b962a434ca4136403da | [
"MIT"
] | permissive | X901/TableviewDropMenu-Swift-3 | fa6a852b6a0a4fcba09488fe62d2ecf719db8f30 | 00325165f177ee508566c9377f89d7937fdadb47 | refs/heads/master | 2021-01-22T02:03:32.086284 | 2017-05-02T15:25:18 | 2017-05-02T15:25:18 | 81,024,152 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 536 | swift | //
// TableViewCellNames.swift
// TableviewDropMenu
//
// Created by X901 on 9/30/16.
// Copyright © 2016 X901. All rights reserved.
//
import UIKit
class TableViewCellNames: UITableViewCell {
@IBOutlet weak var ListNames: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}
| [
300801,
384002,
379140,
328709,
288390,
346761,
242571,
242574,
287247,
277904,
283152,
298255,
307219,
282898,
289684,
278303,
257823,
131745,
284450,
337317,
360485,
356391,
111912,
311211,
369452,
313389,
281014,
296758,
155576,
313528,
354742,
380220,
300350,
306623,
399679,
393537,
306625,
349123,
201155,
306626,
317379,
327370,
289226,
380234,
307277,
276814,
358870,
291544,
348504,
287066,
259165,
346078,
282590,
200543,
131808,
355170,
37219,
237542,
213096,
323561,
249067,
277355,
271089,
213878,
244602,
305659,
305661
] |
3fbb5833525e9ed508360fd6660880452818c98a | 26a79dbaea98f36d8a5138a1f2c49c9dedc4104f | /Umbrella/Providers/Result.swift | 50ffa24de98532c7d177bdc21392855ba342564b | [] | no_license | elliottminns/Umbrella | d7281b890d888c47a643d80ea5ae9e901ab4a63b | 252e5865460e8c6ba56739723b87baee0664dca7 | refs/heads/master | 2021-01-18T18:18:25.701294 | 2016-08-02T13:27:33 | 2016-08-02T13:27:33 | 62,842,001 | 1 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 227 | swift | //
// Result.swift
// Umbrella
//
// Created by Elliott Minns on 05/07/2016.
// Copyright © 2016 Elliott Minns. All rights reserved.
//
import Foundation
enum Result<T> {
case Success(T)
case Failure(ErrorType)
} | [
-1
] |
9325eadc707a9b387494cdcec4f03d3255695d85 | 02626a26cba13401136b38aaeb7bd4d55466d2f4 | /Testtab/AppDelegate.swift | b3a02e7ee3c26e08fe1fa1ca6e5d9f3f1ebefe59 | [
"MIT"
] | permissive | ajays1091/TestPodApp | 01b6f0a3839c96aafb7df9fd84c07aca9dd872f0 | 590c9193737cb317ac4879ee0a7d31611bdea796 | refs/heads/master | 2022-06-22T23:18:37.956768 | 2020-05-13T12:21:36 | 2020-05-13T12:21:36 | 263,601,880 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,413 | swift | //
// AppDelegate.swift
// Testtab
//
// Created by Ajay Hegde on 13/05/20.
// Copyright © 2020 Ajay Hegde. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
// MARK: UISceneSession Lifecycle
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
}
| [
393222,
393224,
393230,
393250,
344102,
393261,
393266,
163891,
213048,
376889,
385081,
393275,
376905,
327756,
254030,
286800,
368727,
180313,
368735,
180320,
376931,
368752,
417924,
262283,
377012,
327871,
180416,
377036,
180431,
377046,
377060,
327914,
205036,
393456,
393460,
336123,
418043,
385280,
336128,
262404,
180490,
368911,
262416,
262422,
377117,
262436,
336180,
262454,
393538,
262472,
344403,
213332,
65880,
262496,
418144,
262499,
213352,
246123,
262507,
262510,
213372,
385419,
393612,
262550,
262552,
385440,
385443,
385451,
262573,
393647,
385458,
262586,
344511,
262592,
360916,
369118,
328177,
328179,
328182,
328189,
328192,
164361,
328206,
410128,
393747,
254490,
188958,
385570,
33316,
377383,
197159,
352821,
188987,
418363,
369223,
385609,
385616,
352856,
352864,
369253,
262760,
352874,
352887,
254587,
377472,
148105,
377484,
352918,
98968,
344744,
361129,
336555,
385713,
434867,
164534,
336567,
164538,
328378,
328386,
344776,
352968,
352971,
418507,
352973,
385742,
385748,
361179,
189153,
369381,
361195,
418553,
344831,
336643,
344835,
344841,
361230,
336659,
418580,
418585,
434970,
369435,
418589,
262942,
418593,
336675,
328484,
418598,
418605,
336696,
361273,
328515,
336708,
328519,
336711,
361288,
328522,
336714,
426841,
197468,
361309,
361315,
361322,
328573,
377729,
369542,
361360,
222128,
345035,
345043,
386003,
386011,
386018,
386022,
435187,
328702,
328714,
361489,
386069,
386073,
336921,
336925,
345118,
377887,
345133,
345138,
386101,
197707,
345169,
156761,
361567,
148578,
345199,
386167,
361593,
410745,
361598,
214149,
345222,
386186,
337047,
345246,
214175,
337071,
337075,
345267,
386258,
328924,
66782,
222437,
328941,
386285,
386291,
345376,
353570,
345379,
410917,
345382,
345399,
378169,
369978,
337222,
337229,
337234,
263508,
402791,
345448,
271730,
378227,
271745,
181638,
353673,
181643,
181654,
230809,
181670,
181673,
337329,
181681,
181684,
181690,
361917,
181696,
337349,
181703,
337365,
271839,
329191,
361960,
116210,
337398,
329226,
419339,
419343,
419349,
345625,
419355,
370205,
419359,
419362,
394786,
370213,
419368,
419376,
206395,
214593,
419400,
419402,
353867,
419406,
419410,
345701,
394853,
222830,
370297,
403070,
353919,
403075,
198280,
345736,
403091,
345749,
345757,
345762,
419491,
345765,
419497,
419501,
370350,
419506,
419509,
337592,
419512,
419517,
337599,
419527,
419530,
419535,
272081,
394966,
419542,
419544,
181977,
345818,
419547,
419550,
419559,
337642,
419563,
337645,
370415,
141051,
337659,
337668,
362247,
395021,
362255,
321299,
116509,
345887,
378663,
345905,
354106,
354111,
247617,
354117,
370503,
329544,
345930,
370509,
354130,
247637,
337750,
370519,
313180,
354142,
345964,
345967,
345970,
345974,
403320,
354172,
247691,
337808,
247700,
329623,
436126,
436132,
337833,
362413,
337844,
346057,
247759,
346063,
329697,
354277,
190439,
247789,
354313,
346139,
436289,
378954,
395339,
338004,
100453,
329832,
329855,
329885,
411805,
346272,
362660,
100524,
387249,
379066,
387260,
256191,
395466,
346316,
411861,
411864,
411868,
411873,
379107,
411876,
387301,
346343,
338152,
387306,
387312,
346355,
436473,
321786,
379134,
411903,
379152,
395538,
387349,
338199,
387352,
182558,
338211,
395566,
248111,
362822,
436555,
190796,
321879,
379233,
354673,
321910,
248186,
420236,
379278,
272786,
354727,
338352,
330189,
338381,
338386,
256472,
338403,
338409,
248308,
199164,
330252,
199186,
420376,
330267,
354855,
10828,
199249,
174695,
248425,
191084,
338543,
191092,
346742,
330383,
354974,
150183,
174774,
248504,
174777,
223934,
355024,
273108,
355028,
264918,
183005,
436962,
338660,
338664,
264941,
207619,
264964,
338700,
256786,
199452,
363293,
396066,
346916,
396069,
215853,
355122,
355131,
355140,
355143,
338763,
355150,
330580,
355166,
265055,
355175,
387944,
355179,
330610,
330642,
355218,
412599,
207808,
379848,
396245,
248792,
248798,
347105,
257008,
183282,
265207,
330748,
265214,
330760,
330768,
248862,
396328,
158761,
199728,
330800,
396336,
396339,
339001,
388154,
388161,
347205,
248904,
330826,
248914,
412764,
339036,
257120,
265320,
248951,
420984,
330889,
347287,
248985,
339097,
44197,
380070,
339112,
249014,
330958,
330965,
265432,
388319,
388347,
175375,
159005,
175396,
208166,
273708,
372015,
347441,
372018,
199988,
44342,
175415,
396600,
437566,
175423,
437570,
437575,
437583,
331088,
437587,
331093,
396633,
175450,
437595,
175457,
208227,
175460,
175463,
265580,
437620,
175477,
249208,
175483,
175486,
249214,
175489,
249218,
249227,
249234,
175513,
175516,
396705,
175522,
355748,
396722,
208311,
388542,
372163,
216517,
380360,
216522,
339404,
372176,
208337,
339412,
413141,
339417,
249308,
339420,
339424,
339428,
339434,
249328,
69113,
372228,
208398,
380432,
175635,
339503,
265778,
265795,
396872,
265805,
224853,
224857,
257633,
224870,
372327,
257646,
372337,
224884,
224887,
224890,
224894,
372353,
224897,
216707,
339588,
126596,
421508,
224904,
224909,
159374,
11918,
339601,
126610,
224913,
224916,
224919,
126616,
208538,
224922,
224926,
224929,
224932,
257704,
224936,
224942,
257712,
224947,
257716,
257720,
224953,
257724,
224959,
257732,
224965,
224969,
339662,
224975,
257747,
224981,
224986,
224993,
257761,
257764,
224999,
339695,
225012,
257787,
225020,
339710,
257790,
225025,
257794,
339721,
257801,
257804,
225038,
257807,
225043,
167700,
372499,
225048,
257819,
225053,
225058,
257833,
225066,
257836,
413484,
225070,
225073,
372532,
257845,
225079,
397112,
225082,
397115,
225087,
225092,
225096,
323402,
257868,
257871,
225103,
397139,
225108,
225112,
257883,
257886,
225119,
257890,
339814,
225127,
257896,
274280,
257901,
225137,
339826,
257908,
225141,
257912,
257916,
225148,
257920,
225155,
339844,
225165,
397200,
225170,
380822,
225175,
225180,
118691,
184244,
372664,
372702,
372706,
356335,
380918,
405533,
430129,
266294,
266297,
217157,
421960,
356439,
421990,
266350,
356466,
266362,
381068,
225423,
250002,
250004,
225429,
356506,
225437,
135327,
225441,
438433,
225444,
438436,
225447,
225450,
258222,
225455,
430256,
225458,
225461,
225466,
389307,
225470,
381120,
372929,
430274,
225475,
389320,
225484,
225487,
225490,
225493,
266453,
225496,
225499,
225502,
225505,
356578,
217318,
225510,
225514,
225518,
372976,
381176,
389380,
61722,
356637,
356640,
356643,
356646,
266536,
356649,
356655,
332080,
340275,
356660,
397622,
332090,
225597,
332097,
201028,
348488,
332106,
332117,
348502,
250199,
250202,
332125,
250210,
348525,
332152,
250238,
389502,
332161,
356740,
332172,
373145,
340379,
389550,
324030,
266687,
160234,
127471,
340472,
324094,
266754,
324099,
324102,
324111,
340500,
324117,
324131,
332324,
381481,
324139,
356907,
324142,
356916,
324149,
324155,
348733,
324160,
324164,
348743,
381512,
324170,
324173,
324176,
389723,
332380,
381545,
340627,
184982,
373398,
258721,
332453,
332459,
389805,
332463,
381617,
332471,
332483,
332486,
373449,
332493,
357069,
357073,
332511,
332520,
340718,
332533,
348924,
373510,
389926,
152370,
348978,
340789,
348982,
398139,
127814,
357206,
389978,
430939,
357211,
357214,
201579,
201582,
349040,
340849,
201588,
430965,
381813,
324472,
398201,
119674,
324475,
430972,
340861,
324478,
340858,
324481,
373634,
398211,
324484,
324487,
381833,
324492,
324495,
324498,
430995,
324501,
324510,
422816,
324513,
398245,
201637,
324524,
340909,
324533,
5046,
324538,
324541,
398279,
340939,
340941,
209873,
340957,
431072,
398306,
340963,
209895,
201711,
349172,
381946,
349180,
439294,
431106,
209943,
250914,
357410,
185380,
357418,
209965,
209968,
209971,
209975,
209979,
209987,
209990,
341071,
349267,
250967,
210010,
341091,
210025,
210027,
210030,
210036,
210039,
210044,
349308,
160895,
152703,
349311,
210052,
349319,
210055,
210067,
210071,
210077,
210080,
210084,
251044,
185511,
210088,
210095,
210098,
210115,
332997,
210127,
333009,
210131,
333014,
210138,
210143,
218354,
251128,
218360,
275706,
275712,
275715,
275721,
349459,
333078,
251160,
349484,
349491,
251189,
415033,
251210,
357708,
210260,
259421,
365921,
333154,
251235,
333162,
234866,
390516,
333175,
357755,
251271,
136590,
112020,
349590,
357792,
259515,
415166,
415185,
366034,
366038,
415191,
415193,
415196,
415199,
423392,
333284,
415207,
366056,
366061,
415216,
210420,
415224,
423423,
415257,
415263,
366117,
415270,
144939,
415278,
415281,
415285,
210487,
415290,
415293,
349761,
415300,
333386,
333399,
366172,
333413,
423528,
423532,
210544,
415353,
333439,
415361,
267909,
153227,
333498,
333511,
210631,
259788,
358099,
153302,
333534,
366307,
366311,
431851,
366318,
210672,
366321,
366325,
210695,
268041,
210698,
366348,
210706,
399128,
333594,
358191,
210739,
366387,
399159,
358200,
325440,
366401,
341829,
325446,
46920,
341834,
341838,
341843,
415573,
358234,
341851,
350045,
399199,
259938,
399206,
268143,
358255,
399215,
358259,
341876,
333689,
243579,
325504,
333698,
333708,
333724,
382890,
350146,
358339,
333774,
358371,
350189,
350193,
333818,
350202,
350206,
350213,
268298,
350224,
350231,
333850,
350237,
350240,
350244,
350248,
178218,
350251,
350256,
350259,
350271,
243781,
350285,
374864,
342111,
342133,
374902,
432271,
333997,
334011,
260289,
350410,
260298,
350416,
350422,
211160,
350425,
268507,
334045,
350445,
375026,
358644,
350458,
350461,
350464,
325891,
350467,
350475,
375053,
268559,
350480,
432405,
350486,
350490,
325914,
325917,
350493,
350498,
350504,
358700,
350509,
391468,
358704,
358713,
358716,
383306,
334161,
383321,
383330,
383333,
391530,
383341,
334203,
268668,
194941,
391563,
366990,
268701,
416157,
342430,
375208,
326058,
375216,
334262,
334275,
326084,
358856,
195039,
334304,
334311,
375277,
334321,
350723,
186897,
342545,
334358,
342550,
342554,
334363,
358941,
350761,
252461,
334384,
358961,
383536,
334394,
252482,
219718,
334407,
334420,
350822,
375400,
334465,
334468,
162445,
326290,
342679,
342683,
260766,
342710,
244409,
260797,
334528,
260801,
350917,
154317,
391894,
154328,
416473,
64230,
113388,
342766,
375535,
203506,
342776,
391937,
391948,
326416,
375568,
375571,
162591,
326441,
326451,
326454,
375612,
244540,
326460,
260924,
326467,
244551,
326473,
326477,
326485,
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,
359366,
326598,
359382,
359388,
383967,
343015,
359407,
261108,
244726,
261111,
383997,
261129,
359451,
261147,
211998,
261153,
261159,
359470,
359476,
343131,
384098,
384101,
367723,
384107,
187502,
343154,
384114,
212094,
351364,
384135,
384139,
384143,
351381,
384151,
384160,
384168,
367794,
244916,
384181,
367800,
384188,
351423,
384191,
384198,
326855,
244937,
384201,
253130,
343244,
384208,
146642,
384224,
359649,
343270,
351466,
384246,
351479,
384249,
343306,
261389,
359694,
253200,
261393,
384275,
384283,
245020,
384288,
245029,
171302,
351534,
376110,
245040,
384314,
425276,
384323,
212291,
343365,
212303,
367965,
343393,
343398,
367980,
425328,
343409,
154999,
253303,
343417,
327034,
245127,
384397,
245136,
245142,
245145,
343450,
245148,
245151,
245154,
245157,
245162,
327084,
359865,
384443,
146876,
327107,
384453,
327110,
327115,
327117,
359886,
359890,
343507,
368092,
343534,
343539,
368119,
343544,
368122,
409091,
359947,
359955,
359983,
343630,
327275,
245357,
138864,
155254,
155273,
368288,
245409,
425638,
425649,
155322,
425662,
155327,
245460,
155351,
155354,
212699,
245475,
155363,
245483,
155371,
409335,
155393,
155403,
155422,
360223,
155438,
155442,
155447,
360261,
155461,
376663,
155482,
261981,
425822,
155487,
376671,
155490,
155491,
327531,
261996,
376685,
261999,
262002,
327539,
425845,
262005,
147317,
262008,
262011,
155516,
155521,
155525,
360326,
376714,
262027,
155531,
262030,
262033,
262036,
262039,
262042,
155549,
262045,
262048,
262051,
327589,
155559,
155562,
155565,
393150,
384977,
393169,
155611,
155619,
253923,
155621,
327654,
253926,
393203,
360438,
253943,
393206,
393212,
155646
] |
d2910ac7387a457d51c63fe6f4722245bd89541e | 19e1173b2f65306b86913efef8088297ae380668 | /ProjectWorld-Weather/ProjectWorld-WeatherUITests/ProjectWorld_WeatherUITests.swift | 5fd42b9ad212cf850e59c4e15f731514dadf9b8a | [] | no_license | mnajay3/ProjectWorld_WeatherAPP | a70f4c08d967407fe23109e3ce326bfb689b4fde | ac1f47438d8efbc4ec9bb58561f1764783304f86 | refs/heads/master | 2021-09-03T14:58:56.108305 | 2018-01-10T00:22:41 | 2018-01-10T00:22:41 | 110,149,186 | 1 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 3,308 | swift | //
// ProjectWorld_WeatherUITests.swift
// ProjectWorld-WeatherUITests
//
// Created by Naga Murala on 11/11/17.
// Copyright © 2017 Naga Murala. All rights reserved.
//
import XCTest
class ProjectWorld_WeatherUITests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
// In UI tests it is usually best to stop immediately when a failure occurs.
continueAfterFailure = false
// UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
XCUIApplication().launch()
// In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testHappyPath() {
let themeCollectionView = XCUIApplication().collectionViews.containing(.image, identifier:"theme").element
themeCollectionView.tap()
themeCollectionView.tap()
themeCollectionView.tap()
themeCollectionView.tap()
}
func testWeatherwithValidCity() {
let app = XCUIApplication()
app.collectionViews.containing(.image, identifier:"theme").element.tap()
let collectionViewsQuery = app.collectionViews
let textField = collectionViewsQuery.cells.otherElements.containing(.staticText, identifier:"London").children(matching: .other).element(boundBy: 2).children(matching: .other).element.children(matching: .textField).element
textField.waitForExistence(timeout: 2)
textField.tap()
textField.waitForExistence(timeout: 2)
textField.typeText("San Antonio")
textField.waitForExistence(timeout: 2)
collectionViewsQuery/*@START_MENU_TOKEN@*/.buttons["Find"]/*[[".cells.buttons[\"Find\"]",".buttons[\"Find\"]"],[[[-1,1],[-1,0]]],[0]]@END_MENU_TOKEN@*/.tap()
textField.waitForExistence(timeout: 2)
}
func testWeatherWithEmptyCity() {
let app = XCUIApplication()
app.collectionViews.containing(.image, identifier:"theme").element.tap()
app.collectionViews/*@START_MENU_TOKEN@*/.buttons["Find"]/*[[".cells.buttons[\"Find\"]",".buttons[\"Find\"]"],[[[-1,1],[-1,0]]],[0]]@END_MENU_TOKEN@*/.tap()
app.alerts["Required"].buttons["Click"].tap()
}
func testWeatherNavigateNextScreen() {
let app = XCUIApplication()
let collectionView = app.otherElements.containing(.button, identifier:"WeatherInformation").children(matching: .collectionView).element
collectionView.waitForExistence(timeout: 2.0)
collectionView.tap()
collectionView.waitForExistence(timeout: 2.0)
collectionView.tap()
app.buttons["WeatherInformation"].tap()
app.waitForExistence(timeout: 2.0)
app.waitForExistence(timeout: 2.0)
app.buttons["Back"].tap()
app.waitForExistence(timeout: 2.0)
}
}
| [
-1
] |
1049900c4bb4d8f0967dd7185ae18e47221c6427 | 14fb00f1c6a07fdcbdff2366fcbdef7609f876db | /GuessTheFlag/AppDelegate.swift | 0ace045b9a72fed489bd7256082c1583ea005899 | [] | no_license | multitudes/GuessTheFlag | 1ecfe87b1785d83c30742f391a1c5d7719206ce4 | d35dd979d7abd314efd380703d0264f274c4fa28 | refs/heads/master | 2020-08-24T16:11:50.839990 | 2019-10-22T16:34:48 | 2019-10-22T16:34:48 | 216,861,507 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,710 | swift | //
// AppDelegate.swift
// GuessTheFlag
//
// Created by Laurent B on 13/10/2019.
// Copyright © 2019 Laurent B. All rights reserved.
//
import UIKit
import CoreData
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
// MARK: UISceneSession Lifecycle
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
// MARK: - Core Data stack
lazy var persistentContainer: NSPersistentContainer = {
/*
The persistent container for the application. This implementation
creates and returns a container, having loaded the store for the
application to it. This property is optional since there are legitimate
error conditions that could cause the creation of the store to fail.
*/
let container = NSPersistentContainer(name: "GuessTheFlag")
container.loadPersistentStores(completionHandler: { (storeDescription, error) in
if let error = error as NSError? {
// Replace this implementation with code to handle the error appropriately.
// fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
/*
Typical reasons for an error here include:
* The parent directory does not exist, cannot be created, or disallows writing.
* The persistent store is not accessible, due to permissions or data protection when the device is locked.
* The device is out of space.
* The store could not be migrated to the current model version.
Check the error message to determine what the actual problem was.
*/
fatalError("Unresolved error \(error), \(error.userInfo)")
}
})
return container
}()
// MARK: - Core Data Saving support
func saveContext () {
let context = persistentContainer.viewContext
if context.hasChanges {
do {
try context.save()
} catch {
// Replace this implementation with code to handle the error appropriately.
// fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
let nserror = error as NSError
fatalError("Unresolved error \(nserror), \(nserror.userInfo)")
}
}
}
}
| [
199680,
379906,
253443,
418820,
249351,
328199,
384007,
379914,
372747,
199180,
326668,
377866,
329233,
350738,
186387,
349202,
262677,
324121,
245274,
377371,
345630,
384032,
362529,
349738,
394795,
404523,
262701,
245293,
349744,
361524,
337975,
343609,
375867,
333373,
418366,
152127,
339009,
413250,
214087,
352840,
377930,
337994,
370253,
330319,
200784,
173647,
436306,
333395,
244308,
374358,
329815,
254042,
402522,
326239,
322658,
340579,
244329,
333422,
349295,
204400,
173169,
339571,
330868,
344693,
268921,
343167,
192639,
344707,
330884,
336516,
266374,
385670,
346768,
268434,
409236,
333988,
336548,
379048,
377001,
356520,
361644,
402614,
361655,
325308,
339132,
343231,
403138,
337092,
244933,
322758,
337606,
367816,
257738,
342736,
245460,
257751,
385242,
366300,
165085,
350433,
345826,
395495,
363755,
346348,
343276,
325358,
338158,
212722,
251122,
350453,
338679,
393465,
351482,
264961,
115972,
268552,
346890,
362251,
328460,
333074,
356628,
257814,
333592,
397084,
342813,
257824,
362272,
377120,
334631,
389416,
336680,
384298,
254252,
204589,
271150,
366383,
328497,
257842,
339768,
326969,
384828,
386365,
204606,
375615,
257852,
339792,
358737,
389970,
361299,
155476,
366931,
257880,
330584,
361305,
362843,
429406,
374112,
353633,
439137,
355184,
361333,
332156,
337277,
260992,
245120,
380802,
389506,
264583,
337290,
155020,
337813,
348565,
250262,
155044,
333221,
373671,
333736,
252845,
356781,
288174,
268210,
370610,
210356,
342452,
370102,
338362,
327612,
358335,
380352,
201157,
187334,
333766,
339400,
347081,
349128,
358347,
393670,
336325,
272848,
379856,
155603,
219091,
399317,
249302,
379863,
372697,
155102,
329182,
182754,
360429,
338927,
330224,
379895,
201723,
257020,
254461
] |
62c9f1c0b79f814dc1b0576087124e0ab3f719fb | 7542765885394b6f918067e41f7a37f7244776cb | /Everything App/AppDelegate.swift | 69b4af95747764ac1b4a42a00215700d7a9751aa | [] | no_license | VsevolodTe/Everything-App | 3ad709cfc62a2e2e9aa5a96c0ae890954b6b1264 | cac9c0048fcbfa8ed334854bf74aa606aba38e4b | refs/heads/master | 2020-05-09T13:24:53.189880 | 2019-04-22T16:49:19 | 2019-04-22T16:49:19 | 181,151,279 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,180 | swift | //
// AppDelegate.swift
// Everything App
//
// Created by Гость on 13/04/2019.
// Copyright © 2019 Гость. 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,
229388,
294924,
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,
319544,
204856,
229432,
286776,
286778,
352318,
286791,
237640,
278605,
286797,
311375,
163920,
237646,
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,
131264,
286916,
295110,
286922,
286924,
286926,
319694,
286928,
131281,
278743,
278747,
295133,
155872,
319716,
237807,
303345,
286962,
131314,
229622,
327930,
278781,
278783,
278785,
237826,
319751,
278792,
286987,
319757,
311569,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
295220,
287032,
155966,
319809,
319810,
278849,
319814,
311623,
319818,
311628,
229709,
319822,
287054,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
319879,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
278980,
98756,
278983,
319945,
278986,
319947,
278990,
278994,
311767,
279003,
279006,
188895,
172512,
287202,
279010,
279015,
172520,
319978,
279020,
172526,
311791,
279023,
172529,
279027,
319989,
180727,
164343,
279035,
311804,
287230,
279040,
303617,
287234,
279045,
172550,
303623,
320007,
287238,
172552,
279051,
172558,
279055,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
279082,
311850,
279084,
172591,
172598,
279095,
172607,
172609,
172612,
377413,
172614,
172618,
303690,
33357,
287309,
279124,
172634,
262752,
254563,
172644,
311911,
189034,
295533,
172655,
172656,
352880,
189039,
295538,
172660,
189040,
189044,
287349,
287355,
287360,
295553,
172675,
295557,
311942,
303751,
287365,
352905,
311946,
279178,
287371,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
287390,
303773,
164509,
172705,
287394,
172702,
303780,
172707,
287398,
205479,
279208,
287400,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
328384,
279231,
287427,
312006,
107208,
107212,
172748,
287436,
172751,
287440,
295633,
172755,
303827,
279255,
172760,
287450,
303835,
279258,
189149,
303838,
213724,
279267,
312035,
295654,
279272,
312048,
230128,
312050,
230131,
189169,
205564,
303871,
230146,
328453,
295685,
230154,
33548,
312077,
295695,
295701,
230169,
369433,
295707,
328476,
295710,
230175,
303914,
279340,
205613,
279353,
230202,
312124,
328508,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
279390,
230241,
279394,
303976,
336744,
303985,
303987,
328563,
279413,
303991,
303997,
295806,
295808,
304005,
295813,
304007,
320391,
213895,
304009,
304011,
230284,
304013,
279438,
189325,
213902,
189329,
295822,
189331,
304019,
295825,
58262,
304023,
279452,
234648,
410526,
279461,
279462,
304042,
213931,
304055,
230327,
287675,
230334,
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,
304170,
304175,
238641,
312374,
238652,
238655,
230465,
238658,
296004,
132165,
336964,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
361576,
296040,
205931,
296044,
279661,
205934,
164973,
312432,
279669,
337018,
189562,
279679,
304258,
279683,
222340,
66690,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
165038,
238766,
230576,
238770,
304311,
230592,
312518,
279750,
230600,
230607,
148690,
320727,
279769,
304348,
279777,
304354,
296163,
320740,
279781,
304360,
320748,
279788,
279790,
304370,
296189,
320771,
312585,
296202,
296205,
230674,
320786,
230677,
296213,
296215,
320792,
230681,
230679,
214294,
304416,
230689,
173350,
312622,
296243,
312630,
222522,
296253,
222525,
296255,
312639,
230718,
296259,
378181,
296262,
230727,
296264,
238919,
320840,
296267,
296271,
222545,
230739,
312663,
337244,
222556,
230752,
312676,
230760,
173418,
410987,
148843,
230763,
230768,
296305,
312692,
230773,
304505,
181626,
304506,
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,
288214,
280021,
239064,
329177,
288217,
280027,
288220,
288218,
239070,
288224,
280034,
288226,
280036,
288229,
280038,
288230,
288232,
370146,
288234,
320998,
288236,
288238,
288240,
288242,
296435,
288244,
288250,
148990,
321022,
206336,
402942,
296446,
296450,
230916,
230919,
214535,
304651,
370187,
304653,
230923,
402969,
230940,
222752,
108066,
296486,
296488,
157229,
239152,
230961,
157236,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
288344,
280152,
239194,
280158,
403039,
370272,
181854,
239202,
370279,
312938,
280183,
280185,
280188,
280191,
116354,
280194,
280208,
280211,
288408,
280218,
280222,
419489,
190118,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
419522,
313027,
280260,
419525,
206536,
280264,
206539,
206541,
206543,
263888,
280276,
313044,
321239,
280283,
18140,
313052,
288478,
313055,
419555,
321252,
313066,
280302,
288494,
280304,
313073,
419570,
288499,
321266,
288502,
280314,
288510,
124671,
67330,
280324,
198405,
288519,
280331,
198416,
280337,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
296767,
288576,
345921,
280388,
337732,
304968,
280393,
280402,
173907,
313176,
42842,
280419,
321381,
296809,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280464,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
280487,
313258,
321458,
296883,
124853,
214966,
10170,
296890,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
354265,
354270,
239586,
313320,
354281,
231404,
124913,
165876,
321528,
313340,
239612,
288764,
239617,
313347,
288773,
313358,
305176,
321560,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
378941,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
149599,
280671,
149601,
321634,
149603,
223327,
329830,
280681,
313451,
223341,
280687,
215154,
313458,
280691,
313464,
329850,
321659,
280702,
288895,
321670,
215175,
141446,
288909,
141455,
141459,
280725,
313498,
100520,
288936,
280747,
288940,
280755,
288947,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
321740,
313548,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
157930,
280811,
280817,
125171,
157940,
280819,
182517,
280823,
280825,
280827,
280830,
280831,
280833,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
280888,
280891,
289087,
280897,
280900,
239944,
305480,
280906,
239947,
305485,
305489,
379218,
280919,
248153,
215387,
354653,
313700,
313705,
280937,
190832,
280946,
223606,
313720,
280956,
239997,
280959,
313731,
240011,
199051,
289166,
240017,
297363,
190868,
297365,
240021,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
305594,
289210,
281024,
289218,
289221,
289227,
436684,
281045,
281047,
215526,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
330244,
281095,
223752,
338440,
150025,
240132,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
281135,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
281179,
338528,
338532,
281190,
199273,
281196,
158317,
19053,
313973,
297594,
281210,
158347,
264845,
182926,
133776,
182929,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
199364,
297671,
158409,
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,
183172,
158596,
338823,
322440,
314249,
240519,
183184,
142226,
240535,
289687,
224151,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
420829,
281567,
289762,
322534,
297961,
183277,
281581,
322550,
134142,
322563,
314372,
330764,
175134,
322599,
322610,
314421,
281654,
314427,
314433,
207937,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
289912,
248995,
306341,
306344,
306347,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
126190,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
257334,
216376,
298306,
380226,
224584,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
306555,
314747,
298365,
290171,
290174,
224641,
281987,
314756,
298372,
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,
192008,
323084,
257550,
282127,
290321,
282130,
323090,
282133,
290325,
241175,
290328,
282137,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
28219,
282186,
224849,
282195,
282199,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
282255,
282261,
175770,
298651,
323229,
282269,
298655,
323231,
61092,
282277,
306856,
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,
307009,
413506,
241475,
307012,
298822,
148946,
315211,
282446,
307027,
315221,
323414,
315223,
241496,
241498,
307035,
307040,
110433,
282465,
241509,
110438,
298860,
110445,
282478,
315249,
110450,
315251,
282481,
315253,
315255,
339838,
315267,
282499,
315269,
241544,
282505,
241546,
241548,
298896,
298898,
282514,
241556,
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,
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,
307307,
45163,
315502,
192624,
307314,
323700,
299126,
233591,
299136,
307329,
307338,
233613,
241813,
307352,
299164,
241821,
184479,
299167,
184481,
315557,
184486,
307370,
307372,
184492,
307374,
307376,
299185,
323763,
176311,
299191,
307385,
307386,
258235,
307388,
176316,
307390,
184503,
299200,
184512,
307394,
307396,
299204,
184518,
307399,
323784,
307409,
307411,
176343,
299225,
233701,
307432,
184572,
282881,
184579,
282893,
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,
291231,
61855,
283042,
291238,
291241,
127403,
127405,
127407,
291247,
299440,
299444,
127413,
283062,
291254,
127417,
291260,
283069,
127421,
127424,
299457,
127429,
127431,
315856,
176592,
315860,
176597,
283095,
127447,
299481,
176605,
242143,
127457,
291299,
340454,
127463,
242152,
291305,
127466,
176620,
127469,
127474,
291314,
291317,
135672,
233979,
291323,
291330,
283142,
127494,
127497,
233994,
135689,
127500,
291341,
233998,
127506,
234003,
234006,
127511,
152087,
283161,
242202,
234010,
135707,
135710,
242206,
242208,
291361,
242220,
291378,
152118,
234038,
234041,
315961,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
135808,
291456,
373383,
299655,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
225948,
135839,
299680,
225954,
135844,
299684,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
119509,
226005,
226008,
242396,
299740,
201444,
299750,
283368,
234219,
283372,
185074,
226037,
283382,
316151,
234231,
234236,
226045,
242431,
234239,
209665,
234242,
299778,
242436,
226053,
234246,
226056,
234248,
291593,
242443,
234252,
242445,
234254,
291601,
242450,
234258,
242452,
234261,
348950,
201496,
234264,
234266,
234269,
283421,
234272,
234274,
152355,
234278,
299814,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
160572,
283452,
234302,
234307,
242499,
234309,
316233,
234313,
316235,
234316,
283468,
242511,
234319,
234321,
234324,
201557,
185173,
234329,
234333,
308063,
234336,
234338,
349027,
242530,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
226171,
234364,
291711,
234368,
234370,
201603,
291714,
234373,
316294,
226182,
234375,
308105,
226185,
234379,
324490,
291716,
234384,
234388,
234390,
324504,
234393,
209818,
308123,
324508,
234396,
226200,
234398,
291742,
234401,
291747,
291748,
234405,
291750,
234407,
324520,
324518,
234410,
291754,
291756,
324522,
226220,
324527,
291760,
234417,
201650,
324531,
234414,
234422,
226230,
324536,
275384,
234428,
291773,
234431,
242623,
324544,
324546,
234434,
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,
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,
308291,
316483,
234563,
234568,
234570,
316491,
300108,
234572,
234574,
300115,
234580,
234581,
242777,
234585,
275545,
234590,
234593,
234595,
300133,
234597,
234601,
300139,
234605,
160879,
234607,
275569,
234610,
316530,
300148,
234614,
398455,
144506,
234618,
275579,
234620,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
308373,
226453,
234647,
275606,
275608,
234650,
308379,
324757,
234653,
300189,
119967,
324766,
324768,
283805,
234657,
242852,
234661,
283813,
300197,
234664,
177318,
275626,
234667,
316596,
308414,
300223,
234687,
300226,
308418,
283844,
300229,
308420,
308422,
226500,
234692,
283850,
300234,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
300267,
161003,
300270,
300272,
120053,
300278,
316663,
275703,
300284,
275710,
300287,
300289,
292097,
161027,
300292,
300294,
275719,
234760,
177419,
300299,
242957,
283917,
300301,
177424,
349451,
275725,
349464,
415009,
283939,
259367,
292143,
283951,
300344,
226617,
243003,
283963,
226628,
283973,
300357,
177482,
283983,
316758,
357722,
316766,
316768,
292192,
218464,
292197,
316774,
243046,
218473,
284010,
324978,
136562,
275834,
333178,
275836,
275840,
316803,
316806,
226696,
316811,
226699,
316814,
226703,
300433,
234899,
226709,
357783,
316824,
316826,
144796,
300448,
144807,
144810,
144812,
284076,
144814,
144820,
284084,
284087,
292279,
144826,
144828,
144830,
144832,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
226787,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
226802,
292338,
316917,
292343,
308727,
300537,
316933,
316947,
308757,
308762,
284191,
316959,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
284213,
194101,
284215,
316983,
194103,
284218,
226877,
292414,
284223,
284226,
284228,
292421,
226886,
284231,
128584,
243268,
284234,
366155,
317004,
276043,
284238,
226895,
284241,
292433,
284243,
300628,
284245,
194130,
284247,
317015,
235097,
243290,
276053,
284249,
284251,
300638,
284253,
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,
292485,
292479,
276098,
284297,
317066,
284299,
317068,
276109,
284301,
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,
276166,
284358,
358089,
284362,
276170,
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,
325408,
300832,
300834,
317221,
227109,
358183,
186151,
276268,
300845,
243504,
300850,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
300872,
153417,
292681,
358224,
284499,
276308,
284502,
317271,
178006,
276315,
292700,
284511,
227175,
292715,
300912,
284529,
292721,
300915,
284533,
292729,
317306,
284540,
292734,
325512,
169868,
276365,
358292,
284564,
317332,
399252,
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,
292839,
276455,
350186,
292843,
276460,
292845,
276464,
178161,
227314,
276466,
350200,
276472,
325624,
317435,
276476,
276479,
276482,
350210,
276485,
317446,
178181,
276490,
350218,
292876,
350222,
317456,
276496,
317458,
178195,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
276528,
178224,
243762,
309298,
325685,
325689,
235579,
276539,
235581,
178238,
325692,
276544,
243779,
284739,
292934,
243785,
276553,
350293,
350295,
309337,
194649,
227418,
350302,
227423,
194654,
178273,
309346,
194657,
309348,
350308,
309350,
227426,
309352,
350313,
309354,
301163,
350316,
194660,
227430,
276583,
276590,
350321,
284786,
276595,
301167,
350325,
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,
309450,
301258,
276685,
309455,
276689,
309462,
301272,
276699,
309468,
194780,
309471,
301283,
317672,
317674,
325867,
243948,
194801,
227571,
309491,
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,
276843,
293227,
276848,
293232,
186744,
211324,
227709,
285061,
366983,
317833,
178572,
285070,
285077,
178583,
227738,
317853,
276896,
317858,
342434,
285093,
317864,
285098,
276907,
235955,
276917,
293304,
293307,
293314,
309707,
293325,
129486,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
227810,
293346,
276964,
293352,
236013,
293364,
301562,
293370,
317951,
309764,
301575,
121352,
236043,
317963,
342541,
55822,
113167,
309779,
317971,
309781,
277011,
55837,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
285236,
23094,
277054,
244288,
219714,
129603,
318020,
301636,
301639,
301643,
277071,
285265,
399955,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
309871,
121458,
277106,
170618,
170619,
309885,
309888,
277122,
227975,
277128,
285320,
301706,
318092,
326285,
334476,
318094,
277136,
277139,
227992,
334488,
318108,
285340,
318110,
227998,
137889,
383658,
285357,
318128,
277170,
342707,
318132,
154292,
293555,
277173,
285368,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
342745,
137946,
342747,
342749,
113378,
203491,
228069,
277223,
342760,
285417,
56041,
56043,
56045,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
228113,
285459,
277273,
293659,
326430,
228128,
293666,
285474,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
285494,
301880,
285499,
301884,
310080,
293696,
277317,
277322,
277329,
162643,
310100,
301911,
301913,
277337,
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,
276579,
293811,
293817,
293820,
203715,
326603,
342994,
276586,
293849,
293861,
228327,
228328,
228330,
318442,
228332,
326638,
277486,
351217,
318450,
293876,
293877,
285686,
302073,
285690,
121850,
293882,
302075,
244731,
293887,
277504,
277507,
277511,
293899,
277519,
293908,
302105,
293917,
293939,
318516,
277561,
277564,
310336,
7232,
293956,
277573,
228422,
310344,
277577,
293960,
277583,
203857,
310355,
293971,
310359,
236632,
277594,
138332,
277598,
203872,
277601,
285792,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
285817,
367737,
302205,
285821,
392326,
285831,
253064,
302218,
285835,
294026,
384148,
162964,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
302241,
285862,
277671,
302248,
64682,
277678,
294063,
294065,
302258,
277687,
294072,
318651,
294076,
277695,
318657,
244930,
302275,
130244,
302277,
228550,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
302296,
384222,
310498,
285927,
318698,
302315,
195822,
228592,
294132,
138485,
228601,
204026,
228606,
204031,
64768,
310531,
285958,
138505,
228617,
318742,
204067,
277798,
130345,
277801,
113964,
285997,
384302,
285999,
277804,
113969,
277807,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
417086,
277822,
286016,
302403,
294211,
384328,
277832,
277836,
146765,
294221,
326991,
294223,
277839,
277842,
277847,
277850,
179547,
277853,
146784,
277857,
302436,
277860,
294246,
327015,
310632,
327017,
351594,
277864,
277869,
277872,
351607,
310648,
277880,
310651,
277884,
277888,
310657,
310659,
351619,
294276,
327046,
277892,
253320,
310665,
318858,
277894,
277898,
277903,
310672,
351633,
277905,
277908,
277917,
310689,
277921,
130468,
228776,
277928,
277932,
310703,
277937,
310710,
130486,
310712,
277944,
310715,
277947,
302526,
228799,
277950,
277953,
302534,
245191,
310727,
64966,
163272,
277959,
292968,
302541,
277963,
302543,
277966,
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,
187936,
146977,
286240,
187939,
40484,
294435,
40486,
286246,
40488,
278057,
245288,
40491,
294439,
294440,
294443,
310831,
294445,
286248,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
327240,
40521,
286283,
40525,
40527,
400976,
212560,
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,
302793,
294601,
343757,
212690,
278227,
286420,
319187,
229076,
286425,
319194,
278235,
278238,
229086,
286432,
294625,
294634,
302838,
319226,
286460,
278274,
302852,
278277,
302854,
311048,
294664,
352008,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
319280,
278320,
319290,
229192,
302925,
188247,
188252,
237409,
229233,
294776,
360317,
294785,
327554,
360322,
40840,
40851,
294803,
188312,
294811,
319390,
40865,
319394,
294817,
294821,
311209,
180142,
294831,
188340,
40886,
319419,
294844,
294847,
237508,
393177,
294876,
294879,
294883,
393190,
294890,
311279,
278513,
237555,
311283,
278516,
278519,
237562
] |
a488ba5783971283d439f3915af664400cfc2544 | 63c0e6391f2505ea878b3cdcfb99ce74c0bc345c | /MC1-DailyTImer/TaskList/TaskList.swift | 68212309a42cc1030346f7d7f75718435e526903 | [] | no_license | muhamadVi/MC1-DailyTImer | aa91ac1471c5fead54ed6e57469f6a1fabda4074 | fdef663da1bc1a69391278db2ddbbdc305ff2d5d | refs/heads/master | 2021-05-25T17:11:27.722378 | 2020-11-30T15:46:30 | 2020-11-30T15:46:30 | 253,836,604 | 2 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 6,981 | swift | //
// TaskList.swift
// MC1-DailyTImer
//
// Created by Muhamad Vicky on 07/04/20.
// Copyright © 2020 Muhamad Vicky. All rights reserved.
//
import UIKit
class TaskList: UIViewController, UITableViewDataSource, UITableViewDelegate {
@IBOutlet weak var editNameBtn: UIButton!
@IBOutlet weak var nameTxt: UITextField!
@IBOutlet weak var taskTable: UITableView!
@IBOutlet weak var toStartBtn: UIButton!
let addTaskFile = AddTask()
var userName = ""
// let donker = UIColor(hex: "#142850")
// let krem = UIColor(hex: "#EBCFB2")
var upcomingTasks: [Task] = []
var completedTasks: [Task] = []
var dataReceived: [Task] = []
var selectedCell = 0
override func viewDidLoad() {
super.viewDidLoad()
let backgroundImage = UIImageView(frame: UIScreen.main.bounds)
backgroundImage.image = UIImage(named: "BackgroundTaskList.png")
backgroundImage.contentMode = UIView.ContentMode.scaleAspectFill
self.view.insertSubview(backgroundImage, at: 0)
toStartBtn.isHidden = true
checkStatus()
taskTable.reloadData()
taskTable.dataSource = self
taskTable.delegate = self
nameTxt.isEnabled = false
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(self.endEditing (_:)))
tapGesture.cancelsTouchesInView = false //nambah ini doang 1 baris
self.view.addGestureRecognizer(tapGesture)
// Untuk Meng-set Nama
nameTxt.text = userName
}
func checkStatus(){
var currentValue = 0
for task in upcomingTasks {
if(task.status == false){
completedTasks.insert(task, at: 0)
upcomingTasks.remove(at: currentValue)
}
currentValue += 1
}
}
@objc func endEditing (_ sender: UITapGestureRecognizer){
nameTxt.isEnabled = false
}
func numberOfSections(in tableView: UITableView) -> Int {
return 2
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView?
{
let headerView = UIView(frame: CGRect(x: 0, y: 0, width: tableView.bounds.size.width, height: 30))
headerView.backgroundColor = UIColor.init(displayP3Red: 28/255.0, green: 28/255.0, blue: 28/255.0, alpha: 1.0)
let headerLabel = UILabel(frame: CGRect(x: 20, y: 10, width:tableView.bounds.size.width, height: tableView.bounds.size.height))
headerLabel.textColor = UIColor.init(displayP3Red: 235/255.0, green: 207/255.0, blue: 178/255.0, alpha: 1.0)
if section == 0 {
headerLabel.text = "Your Upcoming Task"
}else{
headerLabel.text = "Your Completed Task"
}
headerLabel.sizeToFit()
headerView.addSubview(headerLabel)
return headerView
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 44
}
func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
let sectionName: String
switch section {
case 0:
sectionName = NSLocalizedString("Your Upcoming Task", comment: "mySectionName")
case 1:
sectionName = NSLocalizedString("Your Completed Task", comment: "myOtherSectionName")
default:
sectionName = ""
}
return sectionName
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if section == 0 {
return upcomingTasks.count
}
return completedTasks.count
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 70
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "taskCell", for: indexPath) as! taskTableViewCell
let task = indexPath.section == 0 ? upcomingTasks[indexPath.row] : completedTasks[indexPath.row]
cell.taskNameLb?.text = task.taskName
cell.taskDescLb?.text = task.taskDesc
if task.priority == "High" {
cell.priorityImage.image = #imageLiteral(resourceName: "HighIcon")
}else if task.priority == "Medium"{
cell.priorityImage.image = #imageLiteral(resourceName: "MediumIcon")
}else if task.priority == "Low"{
cell.priorityImage.image = #imageLiteral(resourceName: "LowIcon")
}
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if indexPath.section == 0 {
let task = upcomingTasks[indexPath.row]
performSegue(withIdentifier: "toStartSession", sender: task)
self.selectedCell = indexPath.row
}
tableView.deselectRow(at: indexPath, animated: true)
}
@IBAction func editNameClicked(_ sender: Any) {
nameTxt.isEnabled = true
nameTxt.becomeFirstResponder()
}
@IBAction func ToAddTask(_ sender: Any) {
self.performSegue(withIdentifier: "toAddTask", sender: nil)
}
@IBAction func ToStartSession(_ sender: Any) {
let task = upcomingTasks[0]
self.performSegue(withIdentifier: "toStartSession", sender: task)
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "toAddTask"{
}else if segue.identifier == "toStartSession"{
if let destination = segue.destination as? Session{
destination.initUI(task: sender as! Task)
}
}
}
@IBAction func unwindToTaskList(_ unwindSegue: UIStoryboardSegue) {
if let dariSession = unwindSegue.source as? Session{
// Use data from the view controller which initiated the unwind segue
dataReceived.insert(dariSession.dataPassed[0], at:0)
upcomingTasks[self.selectedCell] = dataReceived[0]
checkStatus()
taskTable.reloadData()
dataReceived.removeAll()
}
}
@IBAction func unwindToTaskListFromAddTask(sender: UIStoryboardSegue) {
if let sourceViewController = sender.source as? AddTask {
dataReceived.insert(sourceViewController.dataPassed[0], at:0)
upcomingTasks.insert(dataReceived[0], at: 0)
dataReceived.removeAll()
taskTable.reloadData()
}
}
}
class taskTableViewCell: UITableViewCell {
@IBOutlet weak var taskNameLb: UILabel!
@IBOutlet weak var taskDescLb: UILabel!
@IBOutlet weak var priorityImage: UIImageView!
}
| [
-1
] |
a693a0160ad20074cf0030f04397663c7aad3206 | 5a44268b7b4cc0df4186b7ef68ce4e05ae8c8b99 | /KFECinema/KFECinema/Theater/Controllers/TheaterViewController.swift | 3d22d4c6d7dba22d1e8f528617fa2895cbe8246e | [] | no_license | vinod2324/sampleApps | 0db1f44c6f249132c8e30586374630dc6ea489d8 | e04bcb9e8a75b58dc63baa50cab57341e43bac7b | refs/heads/main | 2023-01-23T00:42:05.283693 | 2020-12-06T21:47:34 | 2020-12-06T21:47:34 | 318,825,707 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 660 | swift | //
// TheaterViewController.swift
// KFECinema
//
// Created by VIMAL KUMAR VEERACHAMY on 12/6/20.
//
import UIKit
class TheaterViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/
}
| [
-1
] |
69266b7ce14da94cee00c3ad8fb8089f124f03d0 | 92d86b8bbfbbfd8466ba64760a842e89977152fa | /playing-with-samples/Coordinator02-advanced/Coordinator02-advanced/Controllers/BuyViewController.swift | e158d5602ff37f0e4d08c6181b28c6ed7da6abfe | [] | no_license | ozolc/hacking-with-swift | a04e1e227d23b0d1d28b3bc1918eab0f659b9867 | 44b0ae2ba1d276c06aba556db3be292bdbd860d2 | refs/heads/master | 2020-05-24T19:59:06.031376 | 2019-10-08T14:28:30 | 2019-10-08T14:28:30 | 187,446,897 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 509 | swift | //
// BuyViewController.swift
// Coordinator01
//
// Created by Maksim Nosov on 07/10/2019.
// Copyright © 2019 Maksim Nosov. All rights reserved.
//
import UIKit
class BuyViewController: UIViewController, Storyboarded {
weak var coordinator: BuyCoordinator?
override func viewDidLoad() {
super.viewDidLoad()
}
// override func viewDidDisappear(_ animated: Bool) {
// super.viewDidDisappear(animated)
// coordinator?.didFinishBuying()
// }
}
| [
-1
] |
00052328c57d4d170543403a21497edb4fae8d1b | 20126e527f91dce0f7233158cad85aa166a8ac2d | /Pods/OktaAuth/Okta/OktaRevoke.swift | 466f804706b960bea9fbf72426d855e1483be149 | [
"Apache-2.0"
] | permissive | santiweight/Hotspot | c35ac54f2b0dd2cda00f5b4a1e53380867c1670c | 918ed53b8cde83346ceb68dcf18f9718ec2ec458 | refs/heads/master | 2020-04-01T12:36:59.569850 | 2018-12-14T04:11:26 | 2018-12-14T04:11:26 | 153,215,790 | 1 | 0 | null | 2018-11-28T21:48:57 | 2018-10-16T03:16:06 | Swift | UTF-8 | Swift | false | false | 2,066 | swift | /*
* Copyright (c) 2017, Okta, Inc. and/or its affiliates. All rights reserved.
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (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.
*/
public struct Revoke {
var token: String?
init(token: String?, callback: @escaping ([String: Any]?, OktaError?) -> Void) {
self.token = token
// Revoke the token
if let revokeEndpoint = getRevokeEndpoint() {
// Build introspect request
let headers = [
"Accept": "application/json",
"Content-Type": "application/x-www-form-urlencoded"
]
let data = "token=\(self.token!)&client_id=\(OktaAuth.configuration?["clientId"] as! String)"
OktaApi.post(revokeEndpoint, headers: headers, postData: data) { response, error in callback(response, error) }
} else {
callback(nil, .error(error: "Error finding the revocation endpoint"))
}
}
func getRevokeEndpoint() -> URL? {
// Get the revocation endpoint from the discovery URL, or build it
if let discoveryEndpoint = OktaAuth.tokens?.authState?.lastAuthorizationResponse.request.configuration.discoveryDocument?.discoveryDictionary["revocation_endpoint"] {
return URL(string: discoveryEndpoint as! String)
}
let issuer = OktaAuth.configuration?["issuer"] as! String
if issuer.range(of: "oauth2") != nil {
return URL(string: Utils.removeTrailingSlash(issuer) + "/v1/revoke")
}
return URL(string: Utils.removeTrailingSlash(issuer) + "/oauth2/v1/revoke")
}
}
| [
-1
] |
982ca97ce7ed7df14cf2ec0990c16c96fe70c294 | 5cbe468097da1ec63b89f11e334fcc753dd6b521 | /ios/qwios/Pods/Socket.IO-Client-Swift/SwiftIO/SocketParser.swift | 2534b3f2f06f903331b467f535a308484c99457d | [
"MIT",
"Apache-2.0"
] | permissive | jbeale/QuizMe | cefad1025355d3e52b37e8589d4c2490a037fb36 | 7d879a0b7b4e6427322ed64ce668669ea79284cb | refs/heads/master | 2020-12-26T04:49:27.907070 | 2015-04-17T02:51:09 | 2015-04-17T02:51:09 | 29,605,231 | 2 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 8,357 | swift | //
// SocketParser.swift
// Socket.IO-Swift
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
import Foundation
private let shredder = SocketParser.PacketShredder()
class SocketParser {
// Translation of socket.io-parser#deconstructPacket
private class PacketShredder {
var buf = ContiguousArray<NSData>()
func shred(data:AnyObject) -> AnyObject {
if let bin = data as? NSData {
let placeholder = ["_placeholder" :true, "num": buf.count]
buf.append(bin)
return placeholder
} else if let arr = data as? NSArray {
var newArr = NSMutableArray(array: arr)
for i in 0..<arr.count {
newArr[i] = shred(arr[i])
}
return newArr
} else if let dict = data as? NSDictionary {
var newDict = NSMutableDictionary(dictionary: dict)
for (key, value) in newDict {
newDict[key as NSCopying] = shred(value)
}
return newDict
} else {
return data
}
}
func deconstructPacket(packet:SocketPacket) {
if packet.data == nil {
return
}
var data = packet.data!
for i in 0..<data.count {
if data[i] is NSArray || data[i] is NSDictionary {
data[i] = shred(data[i])
} else if let bin = data[i] as? NSData {
data[i] = ["_placeholder" :true, "num": buf.count]
buf.append(bin)
}
}
packet.data = data
packet.binary = buf
buf.removeAll(keepCapacity: true)
}
}
// Translation of socket.io-client#decodeString
class func parseString(str:String) -> SocketPacket? {
let arr = Array(str)
let type = String(arr[0])
if arr.count == 1 {
return SocketPacket(type: SocketPacketType(str: type))
}
var id = nil as Int?
var nsp = ""
var i = 0
var placeholders = -1
if type == "5" || type == "6" {
var buf = ""
while arr[++i] != "-" {
buf += String(arr[i])
if i == arr.count {
break
}
}
if buf.toInt() == nil || arr[i] != "-" {
NSLog("Error parsing \(str)")
return nil
} else {
placeholders = buf.toInt()!
}
}
if arr[i + 1] == "/" {
while ++i < arr.count {
let c = arr[i]
if c == "," {
break
}
nsp += String(c)
}
}
if i + 1 >= arr.count {
return SocketPacket(type: SocketPacketType(str: type),
nsp: nsp, placeholders: placeholders, id: id)
}
let next = String(arr[i + 1])
if next.toInt() != nil {
var c = ""
while ++i < arr.count {
if let int = String(arr[i]).toInt() {
c += String(arr[i])
} else {
--i
break
}
}
id = c.toInt()
}
if i + 1 < arr.count {
let d = String(arr[++i...arr.count-1])
let noPlaceholders = d["(\\{\"_placeholder\":true,\"num\":(\\d*)\\})"] ~= "\"~~$2\""
let data = SocketParser.parseData(noPlaceholders) as [AnyObject]
return SocketPacket(type: SocketPacketType(str: type), data: data,
nsp: nsp, placeholders: placeholders, id: id)
}
return nil
}
// Parses data for events
class func parseData(data:String) -> AnyObject? {
var err:NSError?
let stringData = data.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)
let parsed:AnyObject? = NSJSONSerialization.JSONObjectWithData(stringData!,
options: NSJSONReadingOptions.AllowFragments, error: &err)
if err != nil {
// println(err)
return nil
}
return parsed
}
class func parseForEmit(packet:SocketPacket) {
shredder.deconstructPacket(packet)
}
// Parses messages recieved
class func parseSocketMessage(stringMessage:String, socket:SocketIOClient) {
if stringMessage == "" {
return
}
func checkNSP(nsp:String) -> Bool {
if nsp == "" && socket.nsp != "/" {
return true
} else {
return false
}
}
let p = parseString(stringMessage) as SocketPacket!
if p.type == SocketPacketType.EVENT {
if checkNSP(p.nsp) {
return
}
socket.handleEvent(p.getEvent(), data: p.data, isInternalMessage: false, wantsAck: p.id, withAckType: 3)
} else if p.type == SocketPacketType.ACK {
if checkNSP(p.nsp) {
return
}
socket.handleAck(p.id!, data: p.data)
} else if p.type == SocketPacketType.BINARY_EVENT {
if checkNSP(p.nsp) {
return
}
socket.waitingData.append(p)
} else if p.type == SocketPacketType.BINARY_ACK {
if checkNSP(p.nsp) {
return
}
p.justAck = true
socket.waitingData.append(p)
} else if p.type == SocketPacketType.CONNECT {
if p.nsp == "" && socket.nsp != "/" {
socket.joinNamespace()
} else if p.nsp != "" && socket.nsp == "/" {
socket.didConnect()
} else {
socket.didConnect()
}
} else if p.type == SocketPacketType.DISCONNECT {
socket.didForceClose(message: "Got Disconnect")
}
}
// Handles binary data
class func parseBinaryData(data:NSData, socket:SocketIOClient) {
// NSLog(data.base64EncodedStringWithOptions(NSDataBase64EncodingOptions.allZeros))
if socket.waitingData.count == 0 {
NSLog("Got data when not remaking packet")
return
}
let shouldExecute = socket.waitingData[0].addData(data)
if !shouldExecute {
return
}
let packet = socket.waitingData.removeAtIndex(0)
packet.fillInPlaceholders()
if !packet.justAck {
socket.handleEvent(packet.getEvent(), data: packet.data,
wantsAck: packet.id, withAckType: 6)
} else {
socket.handleAck(packet.id!, data: packet.data)
}
}
}
| [
-1
] |
0ec6ac163ceae76c798542d9fe170078b0177fa5 | 56a2c4e48553abf50dccf24d2f45bf2fb58ce672 | /WebSocket.swift | 11578f6fe71c9fcb74f71744133c677addba8b14 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | thandang/Starscream | 01158a98fa05b35ee7f4334d0b3fc5f3f6efbd30 | d5f690123fd4510ce2f9ea6765c3c78ab8e2415d | refs/heads/master | 2021-01-17T20:33:05.561143 | 2015-12-07T19:37:30 | 2015-12-07T19:37:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 31,185 | swift | //////////////////////////////////////////////////////////////////////////////////////////////////
//
// Websocket.swift
//
// Created by Dalton Cherry on 7/16/14.
// Copyright (c) 2014-2015 Dalton Cherry.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//////////////////////////////////////////////////////////////////////////////////////////////////
import Foundation
import CoreFoundation
import Security
public protocol WebSocketDelegate: class {
func websocketDidConnect(socket: WebSocket)
func websocketDidDisconnect(socket: WebSocket, error: NSError?)
func websocketDidReceiveMessage(socket: WebSocket, text: String)
func websocketDidReceiveData(socket: WebSocket, data: NSData)
}
public protocol WebSocketPongDelegate: class {
func websocketDidReceivePong(socket: WebSocket)
}
public class WebSocket : NSObject, NSStreamDelegate {
enum OpCode : UInt8 {
case ContinueFrame = 0x0
case TextFrame = 0x1
case BinaryFrame = 0x2
//3-7 are reserved.
case ConnectionClose = 0x8
case Ping = 0x9
case Pong = 0xA
//B-F reserved.
}
public enum CloseCode : UInt16 {
case Normal = 1000
case GoingAway = 1001
case ProtocolError = 1002
case ProtocolUnhandledType = 1003
// 1004 reserved.
case NoStatusReceived = 1005
//1006 reserved.
case Encoding = 1007
case PolicyViolated = 1008
case MessageTooBig = 1009
}
public static let ErrorDomain = "WebSocket"
enum InternalErrorCode : UInt16 {
// 0-999 WebSocket status codes not used
case OutputStreamWriteError = 1
}
//Where the callback is executed. It defaults to the main UI thread queue.
public var queue = dispatch_get_main_queue()
var optionalProtocols : [String]?
//Constant Values.
let headerWSUpgradeName = "Upgrade"
let headerWSUpgradeValue = "websocket"
let headerWSHostName = "Host"
let headerWSConnectionName = "Connection"
let headerWSConnectionValue = "Upgrade"
let headerWSProtocolName = "Sec-WebSocket-Protocol"
let headerWSVersionName = "Sec-WebSocket-Version"
let headerWSVersionValue = "13"
let headerWSKeyName = "Sec-WebSocket-Key"
let headerOriginName = "Origin"
let headerWSAcceptName = "Sec-WebSocket-Accept"
let BUFFER_MAX = 4096
let FinMask: UInt8 = 0x80
let OpCodeMask: UInt8 = 0x0F
let RSVMask: UInt8 = 0x70
let MaskMask: UInt8 = 0x80
let PayloadLenMask: UInt8 = 0x7F
let MaxFrameSize: Int = 32
class WSResponse {
var isFin = false
var code: OpCode = .ContinueFrame
var bytesLeft = 0
var frameCount = 0
var buffer: NSMutableData?
}
public weak var delegate: WebSocketDelegate?
public weak var pongDelegate: WebSocketPongDelegate?
public var onConnect: ((Void) -> Void)?
public var onDisconnect: ((NSError?) -> Void)?
public var onText: ((String) -> Void)?
public var onData: ((NSData) -> Void)?
public var onPong: ((Void) -> Void)?
public var headers = [String: String]()
public var voipEnabled = false
public var selfSignedSSL = false
public var security: SSLSecurity?
public var enabledSSLCipherSuites: [SSLCipherSuite]?
public var isConnected :Bool {
return connected
}
private var url: NSURL
private var inputStream: NSInputStream?
private var outputStream: NSOutputStream?
private var isRunLoop = false
private var connected = false
private var isCreated = false
private var writeQueue = NSOperationQueue()
private var readStack = [WSResponse]()
private var inputQueue = [NSData]()
private var fragBuffer: NSData?
private var certValidated = false
private var didDisconnect = false
//used for setting protocols.
public init(url: NSURL, protocols: [String]? = nil) {
self.url = url
writeQueue.maxConcurrentOperationCount = 1
optionalProtocols = protocols
}
///Connect to the websocket server on a background thread
public func connect() {
guard !isCreated else { return }
dispatch_async(queue) { [weak self] in
self?.didDisconnect = false
}
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0)) { [weak self] in
self?.isCreated = true
self?.createHTTPRequest()
self?.isCreated = false
}
}
/**
Disconnect from the server. I send a Close control frame to the server, then expect the server to respond with a Close control frame and close the socket from its end. I notify my delegate once the socket has been closed.
If you supply a non-nil `forceTimeout`, I wait at most that long (in seconds) for the server to close the socket. After the timeout expires, I close the socket and notify my delegate.
If you supply a zero (or negative) `forceTimeout`, I immediately close the socket (without sending a Close control frame) and notify my delegate.
- Parameter forceTimeout: Maximum time to wait for the server to close the socket.
*/
public func disconnect(forceTimeout forceTimeout: NSTimeInterval? = nil) {
switch forceTimeout {
case .Some(let seconds) where seconds > 0:
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(seconds * Double(NSEC_PER_SEC))), queue) { [unowned self] in
self.disconnectStream(nil)
}
fallthrough
case .None:
writeError(CloseCode.Normal.rawValue)
default:
self.disconnectStream(nil)
break
}
}
///write a string to the websocket. This sends it as a text frame.
public func writeString(str: String) {
dequeueWrite(str.dataUsingEncoding(NSUTF8StringEncoding)!, code: .TextFrame)
}
///write binary data to the websocket. This sends it as a binary frame.
public func writeData(data: NSData) {
dequeueWrite(data, code: .BinaryFrame)
}
//write a ping to the websocket. This sends it as a control frame.
//yodel a sound to the planet. This sends it as an astroid. http://youtu.be/Eu5ZJELRiJ8?t=42s
public func writePing(data: NSData) {
dequeueWrite(data, code: .Ping)
}
//private methods below!
//private method that starts the connection
private func createHTTPRequest() {
let urlRequest = CFHTTPMessageCreateRequest(kCFAllocatorDefault, "GET",
url, kCFHTTPVersion1_1).takeRetainedValue()
var port = url.port
if port == nil {
if ["wss", "https"].contains(url.scheme) {
port = 443
} else {
port = 80
}
}
addHeader(urlRequest, key: headerWSUpgradeName, val: headerWSUpgradeValue)
addHeader(urlRequest, key: headerWSConnectionName, val: headerWSConnectionValue)
if let protocols = optionalProtocols {
addHeader(urlRequest, key: headerWSProtocolName, val: protocols.joinWithSeparator(","))
}
addHeader(urlRequest, key: headerWSVersionName, val: headerWSVersionValue)
addHeader(urlRequest, key: headerWSKeyName, val: generateWebSocketKey())
addHeader(urlRequest, key: headerOriginName, val: url.absoluteString)
addHeader(urlRequest, key: headerWSHostName, val: "\(url.host!):\(port!)")
for (key,value) in headers {
addHeader(urlRequest, key: key, val: value)
}
if let cfHTTPMessage = CFHTTPMessageCopySerializedMessage(urlRequest) {
let serializedRequest = cfHTTPMessage.takeRetainedValue()
initStreamsWithData(serializedRequest, Int(port!))
}
}
//Add a header to the CFHTTPMessage by using the NSString bridges to CFString
private func addHeader(urlRequest: CFHTTPMessage, key: NSString, val: NSString) {
CFHTTPMessageSetHeaderFieldValue(urlRequest, key, val)
}
//generate a websocket key as needed in rfc
private func generateWebSocketKey() -> String {
var key = ""
let seed = 16
for _ in 0..<seed {
let uni = UnicodeScalar(UInt32(97 + arc4random_uniform(25)))
key += "\(Character(uni))"
}
let data = key.dataUsingEncoding(NSUTF8StringEncoding)
let baseKey = data?.base64EncodedStringWithOptions(NSDataBase64EncodingOptions(rawValue: 0))
return baseKey!
}
//Start the stream connection and write the data to the output stream
private func initStreamsWithData(data: NSData, _ port: Int) {
//higher level API we will cut over to at some point
//NSStream.getStreamsToHostWithName(url.host, port: url.port.integerValue, inputStream: &inputStream, outputStream: &outputStream)
var readStream: Unmanaged<CFReadStream>?
var writeStream: Unmanaged<CFWriteStream>?
let h: NSString = url.host!
CFStreamCreatePairWithSocketToHost(nil, h, UInt32(port), &readStream, &writeStream)
inputStream = readStream!.takeRetainedValue()
outputStream = writeStream!.takeRetainedValue()
guard let inStream = inputStream, let outStream = outputStream else { return }
inStream.delegate = self
outStream.delegate = self
if ["wss", "https"].contains(url.scheme) {
inStream.setProperty(NSStreamSocketSecurityLevelNegotiatedSSL, forKey: NSStreamSocketSecurityLevelKey)
outStream.setProperty(NSStreamSocketSecurityLevelNegotiatedSSL, forKey: NSStreamSocketSecurityLevelKey)
} else {
certValidated = true //not a https session, so no need to check SSL pinning
}
if voipEnabled {
inStream.setProperty(NSStreamNetworkServiceTypeVoIP, forKey: NSStreamNetworkServiceType)
outStream.setProperty(NSStreamNetworkServiceTypeVoIP, forKey: NSStreamNetworkServiceType)
}
if selfSignedSSL {
let settings: [NSObject: NSObject] = [kCFStreamSSLValidatesCertificateChain: NSNumber(bool:false), kCFStreamSSLPeerName: kCFNull]
inStream.setProperty(settings, forKey: kCFStreamPropertySSLSettings as String)
outStream.setProperty(settings, forKey: kCFStreamPropertySSLSettings as String)
}
if let cipherSuites = self.enabledSSLCipherSuites {
if let sslContextIn = CFReadStreamCopyProperty(inputStream, kCFStreamPropertySSLContext) as! SSLContextRef?,
sslContextOut = CFWriteStreamCopyProperty(outputStream, kCFStreamPropertySSLContext) as! SSLContextRef? {
let resIn = SSLSetEnabledCiphers(sslContextIn, cipherSuites, cipherSuites.count)
let resOut = SSLSetEnabledCiphers(sslContextOut, cipherSuites, cipherSuites.count)
if resIn != errSecSuccess {
let error = self.errorWithDetail("Error setting ingoing cypher suites", code: UInt16(resIn))
disconnectStream(error)
return
}
if resOut != errSecSuccess {
let error = self.errorWithDetail("Error setting outgoing cypher suites", code: UInt16(resOut))
disconnectStream(error)
return
}
}
}
isRunLoop = true
inStream.scheduleInRunLoop(NSRunLoop.currentRunLoop(), forMode: NSDefaultRunLoopMode)
outStream.scheduleInRunLoop(NSRunLoop.currentRunLoop(), forMode: NSDefaultRunLoopMode)
inStream.open()
outStream.open()
let bytes = UnsafePointer<UInt8>(data.bytes)
outStream.write(bytes, maxLength: data.length)
while(isRunLoop) {
NSRunLoop.currentRunLoop().runMode(NSDefaultRunLoopMode, beforeDate: NSDate.distantFuture() as NSDate)
}
}
//delegate for the stream methods. Processes incoming bytes
public func stream(aStream: NSStream, handleEvent eventCode: NSStreamEvent) {
if let sec = security where !certValidated && [.HasBytesAvailable, .HasSpaceAvailable].contains(eventCode) {
let possibleTrust: AnyObject? = aStream.propertyForKey(kCFStreamPropertySSLPeerTrust as String)
if let trust: AnyObject = possibleTrust {
let domain: AnyObject? = aStream.propertyForKey(kCFStreamSSLPeerName as String)
if sec.isValid(trust as! SecTrustRef, domain: domain as! String?) {
certValidated = true
} else {
let error = errorWithDetail("Invalid SSL certificate", code: 1)
disconnectStream(error)
return
}
}
}
if eventCode == .HasBytesAvailable {
if aStream == inputStream {
processInputStream()
}
} else if eventCode == .ErrorOccurred {
disconnectStream(aStream.streamError)
} else if eventCode == .EndEncountered {
disconnectStream(nil)
}
}
//disconnect the stream object
private func disconnectStream(error: NSError?) {
writeQueue.waitUntilAllOperationsAreFinished()
if let stream = inputStream {
stream.removeFromRunLoop(NSRunLoop.currentRunLoop(), forMode: NSDefaultRunLoopMode)
stream.close()
}
if let stream = outputStream {
stream.removeFromRunLoop(NSRunLoop.currentRunLoop(), forMode: NSDefaultRunLoopMode)
stream.close()
}
outputStream = nil
isRunLoop = false
certValidated = false
doDisconnect(error)
connected = false
}
///handles the incoming bytes and sending them to the proper processing method
private func processInputStream() {
let buf = NSMutableData(capacity: BUFFER_MAX)
let buffer = UnsafeMutablePointer<UInt8>(buf!.bytes)
let length = inputStream!.read(buffer, maxLength: BUFFER_MAX)
guard length > 0 else { return }
if !connected {
connected = processHTTP(buffer, bufferLen: length)
if !connected {
let response = CFHTTPMessageCreateEmpty(kCFAllocatorDefault, false).takeRetainedValue()
CFHTTPMessageAppendBytes(response, buffer, length)
let code = CFHTTPMessageGetResponseStatusCode(response)
doDisconnect(errorWithDetail("Invalid HTTP upgrade", code: UInt16(code)))
}
} else {
var process = false
if inputQueue.count == 0 {
process = true
}
inputQueue.append(NSData(bytes: buffer, length: length))
if process {
dequeueInput()
}
}
}
///dequeue the incoming input so it is processed in order
private func dequeueInput() {
guard !inputQueue.isEmpty else { return }
let data = inputQueue[0]
var work = data
if let fragBuffer = fragBuffer {
let combine = NSMutableData(data: fragBuffer)
combine.appendData(data)
work = combine
self.fragBuffer = nil
}
let buffer = UnsafePointer<UInt8>(work.bytes)
processRawMessage(buffer, bufferLen: work.length)
inputQueue = inputQueue.filter{$0 != data}
dequeueInput()
}
///Finds the HTTP Packet in the TCP stream, by looking for the CRLF.
private func processHTTP(buffer: UnsafePointer<UInt8>, bufferLen: Int) -> Bool {
let CRLFBytes = [UInt8(ascii: "\r"), UInt8(ascii: "\n"), UInt8(ascii: "\r"), UInt8(ascii: "\n")]
var k = 0
var totalSize = 0
for i in 0..<bufferLen {
if buffer[i] == CRLFBytes[k] {
k++
if k == 3 {
totalSize = i + 1
break
}
} else {
k = 0
}
}
if totalSize > 0 {
if validateResponse(buffer, bufferLen: totalSize) {
dispatch_async(queue) { [weak self] in
guard let s = self else { return }
s.onConnect?()
s.delegate?.websocketDidConnect(s)
}
totalSize += 1 //skip the last \n
let restSize = bufferLen - totalSize
if restSize > 0 {
processRawMessage((buffer+totalSize),bufferLen: restSize)
}
return true
}
}
return false
}
///validates the HTTP is a 101 as per the RFC spec
private func validateResponse(buffer: UnsafePointer<UInt8>, bufferLen: Int) -> Bool {
let response = CFHTTPMessageCreateEmpty(kCFAllocatorDefault, false).takeRetainedValue()
CFHTTPMessageAppendBytes(response, buffer, bufferLen)
if CFHTTPMessageGetResponseStatusCode(response) != 101 {
return false
}
if let cfHeaders = CFHTTPMessageCopyAllHeaderFields(response) {
let headers = cfHeaders.takeRetainedValue() as NSDictionary
if let acceptKey = headers[headerWSAcceptName] as? NSString {
if acceptKey.length > 0 {
return true
}
}
}
return false
}
///process the websocket data
private func processRawMessage(buffer: UnsafePointer<UInt8>, bufferLen: Int) {
let response = readStack.last
if response != nil && bufferLen < 2 {
fragBuffer = NSData(bytes: buffer, length: bufferLen)
return
}
if let response = response where response.bytesLeft > 0 {
var len = response.bytesLeft
var extra = bufferLen - response.bytesLeft
if response.bytesLeft > bufferLen {
len = bufferLen
extra = 0
}
response.bytesLeft -= len
response.buffer?.appendData(NSData(bytes: buffer, length: len))
processResponse(response)
let offset = bufferLen - extra
if extra > 0 {
processExtra((buffer+offset), bufferLen: extra)
}
return
} else {
let isFin = (FinMask & buffer[0])
let receivedOpcode = OpCode(rawValue: (OpCodeMask & buffer[0]))
let isMasked = (MaskMask & buffer[1])
let payloadLen = (PayloadLenMask & buffer[1])
var offset = 2
if (isMasked > 0 || (RSVMask & buffer[0]) > 0) && receivedOpcode != .Pong {
let errCode = CloseCode.ProtocolError.rawValue
doDisconnect(errorWithDetail("masked and rsv data is not currently supported", code: errCode))
writeError(errCode)
return
}
let isControlFrame = (receivedOpcode == .ConnectionClose || receivedOpcode == .Ping)
if !isControlFrame && (receivedOpcode != .BinaryFrame && receivedOpcode != .ContinueFrame &&
receivedOpcode != .TextFrame && receivedOpcode != .Pong) {
let errCode = CloseCode.ProtocolError.rawValue
doDisconnect(errorWithDetail("unknown opcode: \(receivedOpcode)", code: errCode))
writeError(errCode)
return
}
if isControlFrame && isFin == 0 {
let errCode = CloseCode.ProtocolError.rawValue
doDisconnect(errorWithDetail("control frames can't be fragmented", code: errCode))
writeError(errCode)
return
}
if receivedOpcode == .ConnectionClose {
var code = CloseCode.Normal.rawValue
if payloadLen == 1 {
code = CloseCode.ProtocolError.rawValue
} else if payloadLen > 1 {
let codeBuffer = UnsafePointer<UInt16>((buffer+offset))
code = codeBuffer[0].bigEndian
if code < 1000 || (code > 1003 && code < 1007) || (code > 1011 && code < 3000) {
code = CloseCode.ProtocolError.rawValue
}
offset += 2
}
if payloadLen > 2 {
let len = Int(payloadLen-2)
if len > 0 {
let bytes = UnsafePointer<UInt8>((buffer+offset))
let str: NSString? = NSString(data: NSData(bytes: bytes, length: len), encoding: NSUTF8StringEncoding)
if str == nil {
code = CloseCode.ProtocolError.rawValue
}
}
}
doDisconnect(errorWithDetail("connection closed by server", code: code))
writeError(code)
return
}
if isControlFrame && payloadLen > 125 {
writeError(CloseCode.ProtocolError.rawValue)
return
}
var dataLength = UInt64(payloadLen)
if dataLength == 127 {
let bytes = UnsafePointer<UInt64>((buffer+offset))
dataLength = bytes[0].bigEndian
offset += sizeof(UInt64)
} else if dataLength == 126 {
let bytes = UnsafePointer<UInt16>((buffer+offset))
dataLength = UInt64(bytes[0].bigEndian)
offset += sizeof(UInt16)
}
if bufferLen < offset || UInt64(bufferLen - offset) < dataLength {
fragBuffer = NSData(bytes: buffer, length: bufferLen)
return
}
var len = dataLength
if dataLength > UInt64(bufferLen) {
len = UInt64(bufferLen-offset)
}
var data: NSData!
if len < 0 {
len = 0
data = NSData()
} else {
data = NSData(bytes: UnsafePointer<UInt8>((buffer+offset)), length: Int(len))
}
if receivedOpcode == .Pong {
dispatch_async(queue) { [weak self] in
guard let s = self else { return }
s.onPong?()
s.pongDelegate?.websocketDidReceivePong(s)
}
let step = Int(offset+numericCast(len))
let extra = bufferLen-step
if extra > 0 {
processRawMessage((buffer+step), bufferLen: extra)
}
return
}
var response = readStack.last
if isControlFrame {
response = nil //don't append pings
}
if isFin == 0 && receivedOpcode == .ContinueFrame && response == nil {
let errCode = CloseCode.ProtocolError.rawValue
doDisconnect(errorWithDetail("continue frame before a binary or text frame", code: errCode))
writeError(errCode)
return
}
var isNew = false
if response == nil {
if receivedOpcode == .ContinueFrame {
let errCode = CloseCode.ProtocolError.rawValue
doDisconnect(errorWithDetail("first frame can't be a continue frame",
code: errCode))
writeError(errCode)
return
}
isNew = true
response = WSResponse()
response!.code = receivedOpcode!
response!.bytesLeft = Int(dataLength)
response!.buffer = NSMutableData(data: data)
} else {
if receivedOpcode == .ContinueFrame {
response!.bytesLeft = Int(dataLength)
} else {
let errCode = CloseCode.ProtocolError.rawValue
doDisconnect(errorWithDetail("second and beyond of fragment message must be a continue frame",
code: errCode))
writeError(errCode)
return
}
response!.buffer!.appendData(data)
}
if let response = response {
response.bytesLeft -= Int(len)
response.frameCount++
response.isFin = isFin > 0 ? true : false
if isNew {
readStack.append(response)
}
processResponse(response)
}
let step = Int(offset+numericCast(len))
let extra = bufferLen-step
if extra > 0 {
processExtra((buffer+step), bufferLen: extra)
}
}
}
///process the extra of a buffer
private func processExtra(buffer: UnsafePointer<UInt8>, bufferLen: Int) {
if bufferLen < 2 {
fragBuffer = NSData(bytes: buffer, length: bufferLen)
} else {
processRawMessage(buffer, bufferLen: bufferLen)
}
}
///process the finished response of a buffer
private func processResponse(response: WSResponse) -> Bool {
if response.isFin && response.bytesLeft <= 0 {
if response.code == .Ping {
let data = response.buffer! //local copy so it is perverse for writing
dequeueWrite(data, code: OpCode.Pong)
} else if response.code == .TextFrame {
let str: NSString? = NSString(data: response.buffer!, encoding: NSUTF8StringEncoding)
if str == nil {
writeError(CloseCode.Encoding.rawValue)
return false
}
dispatch_async(queue) { [weak self] in
guard let s = self else { return }
s.onText?(str! as String)
s.delegate?.websocketDidReceiveMessage(s, text: str! as String)
}
} else if response.code == .BinaryFrame {
let data = response.buffer! //local copy so it is perverse for writing
dispatch_async(queue) { [weak self] in
guard let s = self else { return }
s.onData?(data)
s.delegate?.websocketDidReceiveData(s, data: data)
}
}
readStack.removeLast()
return true
}
return false
}
///Create an error
private func errorWithDetail(detail: String, code: UInt16) -> NSError {
var details = [String: String]()
details[NSLocalizedDescriptionKey] = detail
return NSError(domain: WebSocket.ErrorDomain, code: Int(code), userInfo: details)
}
///write a an error to the socket
private func writeError(code: UInt16) {
let buf = NSMutableData(capacity: sizeof(UInt16))
let buffer = UnsafeMutablePointer<UInt16>(buf!.bytes)
buffer[0] = code.bigEndian
dequeueWrite(NSData(bytes: buffer, length: sizeof(UInt16)), code: .ConnectionClose)
}
///used to write things to the stream
private func dequeueWrite(data: NSData, code: OpCode) {
guard isConnected else { return }
writeQueue.addOperationWithBlock { [weak self] in
//stream isn't ready, let's wait
guard let s = self else { return }
var offset = 2
let bytes = UnsafeMutablePointer<UInt8>(data.bytes)
let dataLength = data.length
let frame = NSMutableData(capacity: dataLength + s.MaxFrameSize)
let buffer = UnsafeMutablePointer<UInt8>(frame!.mutableBytes)
buffer[0] = s.FinMask | code.rawValue
if dataLength < 126 {
buffer[1] = CUnsignedChar(dataLength)
} else if dataLength <= Int(UInt16.max) {
buffer[1] = 126
let sizeBuffer = UnsafeMutablePointer<UInt16>((buffer+offset))
sizeBuffer[0] = UInt16(dataLength).bigEndian
offset += sizeof(UInt16)
} else {
buffer[1] = 127
let sizeBuffer = UnsafeMutablePointer<UInt64>((buffer+offset))
sizeBuffer[0] = UInt64(dataLength).bigEndian
offset += sizeof(UInt64)
}
buffer[1] |= s.MaskMask
let maskKey = UnsafeMutablePointer<UInt8>(buffer + offset)
SecRandomCopyBytes(kSecRandomDefault, Int(sizeof(UInt32)), maskKey)
offset += sizeof(UInt32)
for i in 0..<dataLength {
buffer[offset] = bytes[i] ^ maskKey[i % sizeof(UInt32)]
offset += 1
}
var total = 0
while true {
if !s.isConnected {
break
}
guard let outStream = s.outputStream else { break }
let writeBuffer = UnsafePointer<UInt8>(frame!.bytes+total)
let len = outStream.write(writeBuffer, maxLength: offset-total)
if len < 0 {
var error: NSError?
if let streamError = outStream.streamError {
error = streamError
} else {
let errCode = InternalErrorCode.OutputStreamWriteError.rawValue
error = s.errorWithDetail("output stream error during write", code: errCode)
}
s.doDisconnect(error)
break
} else {
total += len
}
if total >= offset {
break
}
}
}
}
///used to preform the disconnect delegate
private func doDisconnect(error: NSError?) {
guard !didDisconnect else { return }
dispatch_async(queue) { [weak self] in
guard let s = self else { return }
s.didDisconnect = true
s.onDisconnect?(error)
s.delegate?.websocketDidDisconnect(s, error: error)
}
}
}
| [
229859,
381351,
162665,
313098,
38188,
131613,
141214
] |
5dca00d5e4a1f23708a951a614f3f2d2e5f0917a | 043f309b00d8cfdd98457af3868e2f800a97db5e | /Cuddly/Cuddly/ViewModel/BookMarksViewModel.swift | 6c789214941b670ad7fdfae8b2e4c4be81371336 | [] | no_license | Korirmitchelle/cuddly-octo-engine | bf919069be75177f2861b0ea67f09f9211a94aac | 1ff943ca8e8e2e616e14e1a2686dda3712bcf15d | refs/heads/master | 2023-03-06T13:48:58.570609 | 2023-02-24T17:43:18 | 2023-02-24T17:43:18 | 297,589,468 | 0 | 0 | null | 2023-02-24T17:43:19 | 2020-09-22T08:47:20 | Swift | UTF-8 | Swift | false | false | 807 | swift | //
// BookMarksViewModel.swift
// Cuddly
//
// Created by Mitchelle Korir on 24/02/2023.
// Copyright © 2023 Mitch. All rights reserved.
//
import Foundation
class BookMarksViewModel {
var locations = [String]()
var geocoder = GeocoderService()
weak var locationDelegate: GeocoderDelegate?
init(delegate: GeocoderDelegate){
locationDelegate = delegate
}
func getCoordinateFrom(address: String) {
geocoder.getCoordinateFrom(address: address, completion: {location,error in
guard let location = location, error == nil else {
self.locationDelegate?.locationQueryFailed(with: error)
return
}
self.locationDelegate?.foundLocation(location: location, name: address)
})
}
}
| [
-1
] |
7aeeb7ab5bd900aca2ddb6c84596ca2c7eae147e | 7c7633fd746db5c86c623ff58ffa4ad8dec9f53d | /MindvalleyFramework/NetworkLayer2/Manager/URLSessionManager.swift | 59891570fd8675fee743bbdf3c642c478e41326d | [] | no_license | rathodmayur93/MindvalleyFramework | 61cc82d4aa273ba8ffc8976c01307488ce51ef55 | 8fee1e5de39939567a0057ae0edf1aedfa6b51fd | refs/heads/master | 2020-12-09T14:53:01.656136 | 2020-01-12T04:50:04 | 2020-01-12T04:50:04 | 233,339,700 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,600 | swift | //
// URLSessionManager.swift
// MindValleyNetworking
//
// Created by ds-mayur on 1/4/20.
// Copyright © 2020 Mayur Rathod. All rights reserved.
//
import Foundation
/// Used to manage URL session Request, DataTask, and currently processing API Calls.
final class URLSessionManager : NSObject, URLSessionDelegate {
static var shared: URLSessionManager = URLSessionManager()
/// URL Session manager required for API Calls.
public var sessionManager: URLSession = URLSession(configuration: .default)
/// Used to cache API Calls currently in process.
private var dataTaskStorage: [String: SessionDataTaskModel] = [:]
/// Used for synchronizing DataTask stored for processing parallel and similar request.
fileprivate let queue = DispatchQueue(label: "SynchronizedDictionary", attributes: .concurrent)
/// Use to set If new dataTask is created for API Calls, If any url request is already in process it appends completionHandler to DataStorage so similar call can never be called again untill that request is in process.
///
/// - Parameters:
/// - dataTask: URL Request Data Task, stored in DataTaskStorage, and for future if need to cancel request.
/// - endPoint: Use for API Call identification purpose
/// - completion: CompletionHandler of requested Service, If call already in process on success of api calls fire All completionHandlers requested for API Call.
func set(_ dataTask: URLSessionDataTask?, for endPoint: APIRequestConvertible, completion: @escaping completionHandler) {
queue.sync {
if let url = try! endPoint.urlRequest().url?.absoluteString {
var dataTaskModel: SessionDataTaskModel?
if self.dataTaskStorage.keys.contains(url) {
dataTaskModel = self.dataTaskStorage[url]
if let dataTask = dataTask {
dataTaskModel?.dataTask = dataTask
}
dataTaskModel?.currentRequestCount += 1
dataTaskModel?.completionHandlers[endPoint.requestUniqueIdentifier] = completion
} else {
if let dataTask = dataTask {
dataTaskModel = SessionDataTaskModel(dataTask: dataTask, currentRequestCount: 1, completionHandlers: [endPoint.requestUniqueIdentifier: completion])
}
}
if let dataTaskModel = dataTaskModel {
dataTaskStorage[url] = dataTaskModel
}
}
}
}
/// Use to identify If can cancel call, It is based on number of API Request currently for any url request.
///
/// - Parameter url: Url for which need to check Cancel Request.
/// - Returns: Bool Based on If can cancel Any API Request.
func canCancelRequest(for url: String) -> Bool {
var canCancel: Bool = false
queue.sync {
canCancel = dataTaskStorage[url]?.currentRequestCount == 1
}
return canCancel
}
/// If API Request completed remove DataTask stored for that Call from storage.
///
/// - Parameter url: The URL (key) against which DataTask is stored.
func requestCompleted(for url: String) {
queue.sync {
dataTaskStorage.removeValue(forKey: url)
}
}
/// Used to get DataTask
///
/// - Parameter url: API Call URL against which DataTask is requested.
/// - Returns: Returns data task if contains.
func getDataTask(for url: String) -> URLSessionDataTask? {
var dataTask: URLSessionDataTask?
queue.sync {
dataTask = dataTaskStorage[url]?.dataTask
}
return dataTask
}
/// If there are more than 1 request for any task, It removes completion handler for that request, else removes the dataTask from storage.
///
/// - Parameter endPoint: Endpoint against which DataTask was requested.
func removeRequest(for endPoint: APIRequestConvertible) {
queue.sync {
if let url = try! endPoint.urlRequest().url?.absoluteString,
dataTaskStorage.keys.contains(url) {
if var dataTaskModel = dataTaskStorage[url],
dataTaskModel.completionHandlers.keys.contains(endPoint.requestUniqueIdentifier),
dataTaskModel.currentRequestCount > 1 {
dataTaskModel.completionHandlers.removeValue(forKey: endPoint.requestUniqueIdentifier)
dataTaskModel.currentRequestCount -= 1
dataTaskStorage[url] = dataTaskModel
} else {
dataTaskStorage.removeValue(forKey: url)
}
}
}
}
/// Use to return completion handlers stored for any API Request.
///
/// - Parameter url: DataTaskModel stored against url.
/// - Returns: Array of Completion Handlers
func getCompletions(for url: String) -> [completionHandler] {
var completions: [completionHandler] = []
queue.sync {
if let dataTask = dataTaskStorage[url] {
completions = Array(dataTask.completionHandlers.values)
}
}
return completions
}
/// Use to remove all request stored in local Cache.
func removeAllRequest() {
dataTaskStorage.removeAll()
}
}
| [
-1
] |
46344dcb761687849fd281eaf1cc8b406ef6ac0e | 85641bd7fd32f45927eab5b32315b2bc16803908 | /Yousic/Controllers/LoginSignupViewController.swift | 94d166bd28d8937e8b9cfed140ef7c12c2813654 | [] | no_license | adlythebaud/Yousique | 6bc95a51978f522c8be9afaa9a57707da32c4542 | 342e1dd925176d11d44ab90ac200783cfd531c13 | refs/heads/master | 2021-07-08T00:46:08.309704 | 2017-10-07T07:42:10 | 2017-10-07T07:42:10 | 105,834,926 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 6,381 | swift | //
// ViewController.swift
// Yousic
//
// Created by Adly Thebaud on 10/4/17.
// Copyright © 2017 ThebaudHouse. All rights reserved.
// Call it Yousique!
import UIKit
import Firebase
class LoginSignupViewController: UIViewController {
//MARK: Member Variables
var ref: DatabaseReference!
var usersRef: DatabaseReference!
var signupIsShowing: Bool = true
//MARK: Outlets
@IBOutlet weak var emailTextField: UITextField!
@IBOutlet weak var usernameTextField: UITextField!
@IBOutlet weak var passwordTextField: UITextField!
@IBOutlet weak var mainActionButton: UIButton!
@IBOutlet weak var secondaryActionButton: UIButton!
@IBOutlet weak var signupErrorLabel: UILabel!
//MARK: Actions
/**********************************************************
* NAME: mainActionButtonTapped
*
* DESCRIPTION: authenticate a user into database.
***********************************************************/
@IBAction func mainActionButtonTapped(_ sender: Any) {
registerNewUser()
}
/**********************************************************
* NAME: secondaryActionButtonTapped
*
* DESCRIPTION: switch between login and signup views.
***********************************************************/
@IBAction func secondaryActionButtonTapped(_ sender: Any) {
if signupIsShowing {
// show login
emailTextField.isHidden = true
mainActionButton.titleLabel?.text = "Login"
secondaryActionButton.titleLabel?.text = "Sign Up"
signupIsShowing = false
} else if !signupIsShowing {
// show the sign up!
emailTextField.isHidden = false
mainActionButton.titleLabel?.text = "Sign Up"
secondaryActionButton.titleLabel?.text = "Login"
signupIsShowing = true
}
}
/**********************************************************
* NAME: unwindToLogin
*
* DESCRIPTION: change views when logout button is tapped.
***********************************************************/
@IBAction func unwindToLogin(unwindSegue: UIStoryboardSegue) {
// should I do any logging out firebase code here?
}
//MARK: Methods
/**********************************************************
* NAME: viewDidLoad
*
* DESCRIPTION: called when the view is loaded
***********************************************************/
override func viewDidLoad() {
super.viewDidLoad()
// view setup
setupView()
// instantiate reference to our database.
ref = Database.database().reference(fromURL: "https://spottystarter.firebaseio.com/")
}
/**********************************************************
* NAME: setupView
*
* DESCRIPTION: do additional view set up
***********************************************************/
func setupView() {
mainActionButton.titleLabel?.text = "Sign Up"
secondaryActionButton.titleLabel?.text = "Login"
signupErrorLabel.isHidden = true
}
/**********************************************************
* NAME: displaySignupError
*
* DESCRIPTION: If there is an error in signing up, let
* user know.
***********************************************************/
func displaySignupError(_ error: Error?) {
signupErrorLabel.textColor = UIColor.red
signupErrorLabel.text = "\(error?.localizedDescription)"
signupErrorLabel.isHidden = false
}
/**********************************************************
* NAME: registerNewUser
*
* DESCRIPTION: register a new user in my authorization
* and keep their data in the database!
***********************************************************/
func registerNewUser() {
guard let email = emailTextField.text, let username = usernameTextField.text, let password = passwordTextField.text else {
// do some error handling here.
print("invalid forms")
return
}
Auth.auth().createUser(withEmail: email, password: password) { (user: User?, error) in
// if this if statement is false, then we've successfully authenticated!
if error != nil {
// self.displaySignupError(error)
print(error)
return
}
// make a dictionary of values to send to Firebase
let valuesToSendToFirebase = ["Username": username, "Email": email]
guard let uid = user?.uid else {
return
}
// create a reference to the uid child of the users which is child of database
self.usersRef = self.ref.child("users").child(uid)
// update the "users" part of the database.
self.usersRef.updateChildValues(valuesToSendToFirebase, withCompletionBlock: { (err, ref) in
if err != nil {
print(err)
return
}
})
// once done, perform segue.
self.performSegue(withIdentifier: "toHomeScreen", sender: nil)
}
}
/**********************************************************
* NAME: clearTextFields
*
* DESCRIPTION: clear text fields when user logs in
***********************************************************/
func clearTextFields() {
emailTextField.text = ""
usernameTextField.text = ""
passwordTextField.text = ""
}
/**********************************************************
* NAME: showLoginScreen
*
* DESCRIPTION: show the login screen when the login button
* is tapped.
***********************************************************/
func showLoginScreen() {
emailTextField.isHidden = true
mainActionButton.titleLabel?.text = "Login"
secondaryActionButton.titleLabel?.text = "Sign Up"
signupIsShowing = false
}
/**********************************************************
* NAME: showSignupScreen
*
* DESCRIPTION: show sign up screen when sign up button is
* tapped.
***********************************************************/
func showSignupScreen() {
emailTextField.isHidden = false
mainActionButton.titleLabel?.text = "Sign Up"
secondaryActionButton.titleLabel?.text = "Login"
signupIsShowing = true
}
}
| [
-1
] |
da35eb785e3d3f92dae26c1bd314e0eac963c149 | db42917164e20b972fcf9e3c40f3eee0494f1761 | /AppTodoList_Swift/DetalheViewController.swift | 28ad6c6d459a08e7b288ccae3a6b10138c5bd334 | [] | no_license | Diego-MB/AppTodoList_Swift | 2366b07ee2f7218ce1d49e6f0fcdd6841b25a0a4 | 8c9cdd4c3ed4aedc34459a3613f16235d48c5c41 | refs/heads/main | 2023-02-02T12:57:37.211987 | 2020-12-18T17:34:41 | 2020-12-18T17:34:41 | 322,279,753 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,832 | swift | //
// DetalheViewController.swift
// AppTodoList_Swift
//
// Created by Sundek on 18/12/20.
//
import UIKit
import CoreData
class DetalheViewController: UIViewController {
@IBOutlet weak var tituloTarefa: UILabel!
@IBOutlet weak var descricaoTarefa: UILabel!
@IBOutlet weak var dataHoraTarefa: UILabel!
@IBOutlet weak var prioridadeTarefa: UILabel!
var context: NSManagedObjectContext!
var tarefa: NSManagedObject!
override func viewDidLoad() {
super.viewDidLoad()
recuperarTarefa()
}
//Recarrega a tela com novos valores
override func viewDidAppear(_ animated: Bool) {
recuperarTarefa()
}
//Botão para enviar as informações para a tela seguinte
@IBAction func editar(_ sender: Any) {
performSegue(withIdentifier: "editarTarefa", sender: self.tarefa)
}
//Prepara a segue
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "editarTarefa" {
let viewDestino = segue.destination as! TarefaViewController
viewDestino.title = "Editar Tarefa"
viewDestino.tarefa = sender as? NSManagedObject
}
}
//Recupera as informações
func recuperarTarefa() {
if tarefa != nil {
if let tituloRecuperado = tarefa.value(forKey: "titulo") {
self.tituloTarefa.text = tituloRecuperado as? String
}
if let descricaoRecuperado = tarefa.value(forKey: "descricao") {
self.descricaoTarefa.text = descricaoRecuperado as? String
}
if let dataHoraRecuperado = tarefa.value(forKey: "data") {
self.dataHoraTarefa.text = formatarData(data: dataHoraRecuperado as! Date)
}
if let prioridadeRecuperado = tarefa.value(forKey: "prioridade") {
self.prioridadeTarefa.text = prioridadeRecuperado as? String
trocaCorLabel(nome: prioridadeRecuperado as! String)
}
}
}
//Formata a data
func formatarData(data: Date) -> String {
let formataData = DateFormatter()
formataData.dateFormat = "dd/MM/yyyy hh:mm"
return formataData.string(from: data)
}
func trocaCorLabel(nome: String) {
switch nome {
case "Baixo":
prioridadeTarefa.textColor = UIColor(hexString: "#FFCA00")
case "Médio":
prioridadeTarefa.textColor = UIColor(hexString: "#FF9600")
case "Alto":
prioridadeTarefa.textColor = UIColor(hexString: "#FF3D54")
default:
prioridadeTarefa.textColor = UIColor(hexString: "#FFCA00")
}
}
}
| [
-1
] |
521c052d321ad39a7bf0e82418f8c12ba85fbdce | 1e9d7642d836b773ae934747d275208d41b06da1 | /LocationFinder/Presentation/Protocol/Mapper/MappableViewModel.swift | 80964eeb2f4a8f79b5f250eaa3bd544471f8ff63 | [] | no_license | viniciusromani/location-finder | 4dc9d1f63b75a453af7c3a6e17068a09f7eaf268 | 44db08459e660b884f91e3d7df485749674c328a | refs/heads/master | 2020-03-20T23:18:53.500347 | 2018-07-15T20:55:33 | 2018-07-15T20:55:33 | 137,840,337 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 344 | swift | //
// MappableViewModel.swift
// LocationFinder
//
// Created by Vinicius Romani on 19/06/18.
// Copyright © 2018 Vinicius Romani. All rights reserved.
//
import Foundation
protocol MappableViewModel {
associatedtype Model: MappableModel
init(mapping model: Model)
static func array(mapping models: [Model]) -> [Self]
}
| [
-1
] |
36fc5728f577391a67da6bb33aec0abe3f50ca92 | dc5800ea66108e9c11245da9b7ea91bd6b2a512b | /MealsProject/Module/RandomScreen/RandomScreenRouter.swift | 03102f8f4aa443e0d815522091a230ad0a41a818 | [] | no_license | Starchenkov/MealsProject | ed36df35502428f96e42a45ebd531852982971ad | b357a52ec0000aa85cb538f605788feebeca294b | refs/heads/master | 2023-06-09T11:33:00.770068 | 2021-06-26T14:23:03 | 2021-06-26T14:23:03 | 378,093,209 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 944 | swift | //
// RandomScreenRouter.swift
// MealsProject
//
// Created by Sergey Starchenkov on 13.06.2021.
//
import UIKit
protocol IRandomScreenRouter
{
func showFullMeal(user: UserModel, meal: MealModel)
}
class RandomScreenRouter: IRandomScreenRouter
{
var controller: UIViewController?
func showFullMeal(user: UserModel, meal: MealModel) {
let mealStorage = CoreDataStorage.instance
let router = FullScreenRouter()
let presenter = FullScreenPresenter(user: user, meal: meal, mealStorage: mealStorage, router: router)
let controller = FullScreenViewController(presenter: presenter)
router.controller = controller
let navigationController = UINavigationController(rootViewController: controller)
navigationController.modalPresentationStyle = .fullScreen
self.controller?.navigationController?.present(navigationController, animated: true, completion: nil)
}
}
| [
-1
] |
836c53c0f759e1eb611f0fb2c9da0aa66ddaa5d8 | 06e89340a710928227e7f3b0cb3bc241efcebbb5 | /Driver/Scan/ScanViewController.swift | 5b88f26e090338b409cbd59af10de4414f7c5e0a | [] | no_license | lizhihui0215/Driver | 1cd97510c55a4ab477cf2309de045163f1f82e57 | 343316aa3e933d00caf745a90396e0ff61bd6b44 | refs/heads/main | 2023-05-27T23:58:06.129215 | 2021-06-15T13:42:13 | 2021-06-15T13:42:13 | 369,403,884 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,304 | swift | //
// Created by lizhihui on 2021/5/1.
// Copyright (c) 2021 ZhiHui.Li. All rights reserved.
//
import BrightFutures
import Foundation
import ZLPhotoBrowser
class ScanViewController: BaseViewController {
@IBOutlet var scanAnimationImageView: ScanAnimationImageView!
@IBOutlet var torchButton: UIButton!
@IBOutlet var buttonStackView: UIStackView!
var viewModel: ScanViewModel!
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
stopScanning()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
navigationController?.navigationBar.isHidden = false
startScanning()
}
override func viewDidLoad() {
super.viewDidLoad()
guard let previewLayer = viewModel.previewLayer else { return }
view.layer.backgroundColor = UIColor.clear.cgColor
view.layer.insertSublayer(previewLayer, at: 0)
viewModel.previewLayer?.frame = UIScreen.main.bounds
startScanning()
if !viewModel.isTorchAvailable {
buttonStackView.removeArrangedSubview(torchButton)
torchButton.removeFromSuperview()
}
}
private func stopScanning() {
viewModel.stopScanning()
scanAnimationImageView.stopAnimation()
}
private func startScanning() {
guard PermissionManager.shared.isCameraAuthorization else {
alert(message: "请打开您的相机权限,以便于您能正常使用扫一扫扫描识别条码或者二维码,或者拍摄照片上传照片等功能")
return
}
scanAnimationImageView.startAnimation()
viewModel.startScanning().onSuccess { [weak self] _ in
guard let self = self else { return }
`self`.scanAnimationImageView.stopAnimation()
`self`.perform(segue: StoryboardSegue.Main.scanFinished, sender: self)
}
}
@IBAction func flashTapped(_ sender: UIButton) {
sender.isSelected = !sender.isSelected
viewModel.torchMode = sender.isSelected ? .on : .off
}
@IBAction func finishedTapped(_ sender: UIButton) {
viewModel.finished().onSuccess { [weak self] identifier in
guard let self = self else { return }
`self`.performSegue(withIdentifier: identifier, sender: self)
}
}
@IBAction func albumTapped(_ sender: UIButton) {
guard PermissionManager.shared.isLibraryAuthorization else {
alert(message: "请打开您的相册权限,以便于您能正常使用扫一扫扫描识别条码或者二维码,或者拍摄照片上传照片等功能")
return
}
let photoPreviewSheet = ZLPhotoPreviewSheet()
photoPreviewSheet.selectImageBlock = { [weak self] images, assets, isOriginal in
guard let self = self, let image = images.first else { return }
_ = `self`.viewModel.discernMetadataObject(from: image)
log.info("image: ", context: images)
log.info("assets: ", context: assets)
log.info("isOriginal: ", context: isOriginal)
`self`.perform(segue: StoryboardSegue.Main.scanFinished, sender: self)
}
photoPreviewSheet.showPhotoLibrary(sender: self)
}
}
| [
-1
] |
89593d9b21910fe257717fdc4109f1de8b0194a6 | 0e718e75ac6a78ea21f8bed6a6418b79b51287ac | /FoHo/ShoppingCartTableViewController.swift | dffc58ff169b8e07a5c2f6df986cb49611ce5286 | [] | no_license | simomario22/FoHo | 3e5c25670d28ff87a9953425f371dbb47a1ead9d | 2a1baefbe4ba535630635d90f27d7d9fe327f3a4 | refs/heads/master | 2020-03-22T06:07:21.324578 | 2017-05-09T19:09:55 | 2017-05-09T19:09:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,449 | swift | //
// ShoppingCartTableViewController.swift
// FoHo
//
// Created by Scott Williams on 4/21/17.
// Copyright © 2017 FohoDuo. All rights reserved.
//
import UIKit
import CoreData
//Load the ingredients saved from the shopping cart database.
//allow the user to delete them as needed
//maybe allow manual entry?
//https://www.raywenderlich.com/145809/getting-started-core-data-tutorial
class ShoppingCartTableViewController: UITableViewController {
var items: [NSManagedObject] = []
override func viewDidLoad() {
super.viewDidLoad()
tableView.register(UITableViewCell.self,
forCellReuseIdentifier: "Cell")
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
//1
guard let appDelegate =
UIApplication.shared.delegate as? AppDelegate else {
return
}
let managedContext = appDelegate.persistentContainer.viewContext
//2
let fetchRequest = NSFetchRequest<NSManagedObject>(entityName: "Item")
//3
do {
items = try managedContext.fetch(fetchRequest)
} catch let error as NSError {
print("Could not fetch. \(error), \(error.userInfo)")
}
}
override func viewDidAppear(_ animated: Bool) {
self.tableView.reloadData()
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let reuseIdentifier = "Cell"
let cell = tableView.dequeueReusableCell(withIdentifier: reuseIdentifier, for: indexPath)
let item = items[indexPath.row]
cell.textLabel!.text = item.value(forKeyPath: "name") as? String
cell.selectionStyle = .none
return cell
}
//code to delete an entry from the table view
override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
if editingStyle == .delete {
let appDelegate = UIApplication.shared.delegate as? AppDelegate
let managedContext = appDelegate?.persistentContainer.viewContext
managedContext?.delete(items[indexPath.row] as NSManagedObject)
do {
try managedContext?.save()
} catch let error as NSError {
print("Could not save \(error), \(error.userInfo)")
}
//makes sure that if a new item is added it is unselected
tableView.cellForRow(at: indexPath)?.backgroundColor = UIColor.white
tableView.beginUpdates()
items.remove(at: indexPath.row)
tableView.deleteRows(at: [indexPath], with: .fade)
tableView.endUpdates()
}
}
func tableView(tableView: UITableView!, canEditRowAtIndexPath indexPath: NSIndexPath!) -> Bool {
return true
}
//some crazy function to set up the "+" item button
@IBAction func addItem(_ sender: UIBarButtonItem) {
let alert = UIAlertController(title: "Add New Item", message: "to shopping cart", preferredStyle: .alert)
let saveAction = UIAlertAction(title: "Add", style: .default) {
[unowned self] action in
guard let textField = alert.textFields?.first,
let itemToSave = textField.text else {
return
}
self.save(itemName: itemToSave)
self.tableView.reloadData()
}
let cancelAction = UIAlertAction(title: "Cancel", style: .default)
alert.addTextField()
alert.addAction(saveAction)
alert.addAction(cancelAction)
present(alert, animated: true)
}
//Saves an item to the database
func save(itemName: String) {
guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else {
return
}
//1
let managedContext = appDelegate.persistentContainer.viewContext
//2
let entity = NSEntityDescription.entity(forEntityName: "Item", in: managedContext)!
let item = NSManagedObject(entity: entity, insertInto: managedContext)
//3
item.setValue(itemName, forKeyPath: "name")
//4
do {
try managedContext.save()
items.append(item)
} catch let error as NSError {
print("Could not save. \(error), \(error.userInfo)")
}
}
// MARK: - Table view data source
override func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return items.count
}
//function for changing a cell color when it is clicked
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let cell = tableView.cellForRow(at: indexPath)
if cell?.backgroundColor == #colorLiteral(red: 0.2187472284, green: 0.7748631835, blue: 0.3660549819, alpha: 1) {
cell?.backgroundColor = UIColor.white
}
else {
cell?.backgroundColor = #colorLiteral(red: 0.2187472284, green: 0.7748631835, blue: 0.3660549819, alpha: 1)
}
}
}
| [
-1
] |
c9e71d24c22e00cb022225c3fec99bacdbc8b8df | 389d4313f040571ddb570709106be67e8506b1c3 | /Sources/SkiaSwift/GRDefinitions.swift | 0e16d59b520c96f681ce54437c604c5897c92321 | [] | no_license | swiftfn/SkiaSwift | fccc1b983b148622d82e56d26567e51efb7df675 | 1270b5ab221b4804136537d3cfe5a770fb6a5302 | refs/heads/master | 2020-09-01T04:56:43.353527 | 2019-11-06T22:47:24 | 2019-11-06T22:47:24 | 218,885,319 | 10 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 7,376 | swift | import CSkia
// Swift sees C's enums as UInt32
public enum SurfaceOrigin: UInt32 {
case topLeft,
bottomLeft
}
public enum PixelConfig: UInt32 {
case unknown,
alpha8,
gray8,
rgb565,
rgba4444,
rgba8888,
rgb888,
bgra8888,
srgba8888,
sbgra8888,
rgba1010102,
rgbaFloat,
rgFloat,
alphaHalf,
rgbaHalf
}
public enum Backend: UInt32 {
case metal,
openGl,
vulkan
static func fromC(_ backend: gr_backend_t) -> Backend {
Backend(rawValue: backend.rawValue)!
}
}
public enum GlBackendState: UInt32 {
case none = 0,
renderTarget = 1, // 1 << 0
textureBinding = 2, // 1 << 1
view = 4, // 1 << 2, scissor and viewport
blend = 8, // 1 << 3
msaaEnable = 16, // 1 << 4
vertex = 32, // 1 << 5
stencil = 64, // 1 << 6
pixelStore = 128, // 1 << 7
program = 256, // 1 << 8
fixedFunction = 512, // 1 << 9
misc = 1024, // 1 << 10
pathRendering = 2048, // 1 << 11
all = 0xffff
}
public enum BackendState: UInt32 {
case none = 0,
all = 0xffffffff
}
public typealias GlFramebufferInfo = gr_gl_framebufferinfo_t
public typealias GlTextureInfo = gr_gl_textureinfo_t
public extension ColorType {
func toGlSizedFormat() -> Int {
switch (self) {
case .unknown:
return 0
case .alpha8:
return GlSizedFormat.ALPHA8
case .rgb565:
return GlSizedFormat.RGB565
case .argb4444:
return GlSizedFormat.RGBA4
case .rgba8888:
return GlSizedFormat.RGBA8
case .rgb888x:
return GlSizedFormat.RGB8
case .bgra8888:
return GlSizedFormat.BGRA8
case .rgba1010102:
return GlSizedFormat.RGB10_A2
case .rgb101010x:
return 0
case .gray8:
return GlSizedFormat.LUMINANCE8
case .rgbaF16:
return GlSizedFormat.RGBA16F
}
}
func toPixelConfig() -> PixelConfig {
switch (self) {
case .unknown:
return PixelConfig.unknown
case .alpha8:
return PixelConfig.alpha8
case .gray8:
return PixelConfig.gray8
case .rgb565:
return PixelConfig.rgb565
case .argb4444:
return PixelConfig.rgba4444
case .rgba8888:
return PixelConfig.rgba8888
case .rgb888x:
return PixelConfig.rgb888
case .bgra8888:
return PixelConfig.bgra8888
case .rgba1010102:
return PixelConfig.rgba1010102
case .rgbaF16:
return PixelConfig.rgbaHalf
case .rgb101010x:
return PixelConfig.unknown
}
}
}
public extension PixelConfig {
func toGlSizedFormat() -> Int {
switch (self) {
case .alpha8:
return GlSizedFormat.ALPHA8
case .gray8:
return GlSizedFormat.LUMINANCE8
case .rgb565:
return GlSizedFormat.RGB565
case .rgba4444:
return GlSizedFormat.RGBA4
case .rgba8888:
return GlSizedFormat.RGBA8
case .rgb888:
return GlSizedFormat.RGB8
case .bgra8888:
return GlSizedFormat.BGRA8
case .srgba8888:
return GlSizedFormat.SRGB8_ALPHA8
case .sbgra8888:
return GlSizedFormat.SRGB8_ALPHA8
case .rgba1010102:
return GlSizedFormat.RGB10_A2
case .rgbaFloat:
return GlSizedFormat.RGBA32F
case .rgFloat:
return GlSizedFormat.RG32F
case .alphaHalf:
return GlSizedFormat.R16F
case .rgbaHalf:
return GlSizedFormat.RGBA16F
case .unknown:
return 0
}
}
func toColorType() -> ColorType {
switch (self) {
case .unknown:
return ColorType.unknown
case .alpha8:
return ColorType.alpha8
case .gray8:
return ColorType.gray8
case .rgb565:
return ColorType.rgb565
case .rgba4444:
return ColorType.argb4444
case .rgba8888:
return ColorType.rgba8888
case .rgb888:
return ColorType.rgb888x
case .bgra8888:
return ColorType.bgra8888
case .srgba8888:
return ColorType.rgba8888
case .sbgra8888:
return ColorType.bgra8888
case .rgba1010102:
return ColorType.rgba1010102
case .rgbaFloat:
return ColorType.unknown
case .rgFloat:
return ColorType.unknown
case .alphaHalf:
return ColorType.unknown
case .rgbaHalf:
return ColorType.rgbaF16
}
}
}
class GlSizedFormat {
// Unsized formats
static let STENCIL_INDEX = 0x1901
static let DEPTH_COMPONENT = 0x1902
static let DEPTH_STENCIL = 0x84F9
static let RED = 0x1903
static let RED_INTEGER = 0x8D94
static let GREEN = 0x1904
static let BLUE = 0x1905
static let ALPHA = 0x1906
static let LUMINANCE = 0x1909
static let LUMINANCE_ALPHA = 0x190A
static let RG_INTEGER = 0x8228
static let RGB = 0x1907
static let RGB_INTEGER = 0x8D98
static let SRGB = 0x8C40
static let RGBA = 0x1908
static let RG = 0x8227
static let SRGB_ALPHA = 0x8C42
static let RGBA_INTEGER = 0x8D99
static let BGRA = 0x80E1
// Stencil index sized formats
static let STENCIL_INDEX4 = 0x8D47
static let STENCIL_INDEX8 = 0x8D48
static let STENCIL_INDEX16 = 0x8D49
// Depth component sized formats
static let DEPTH_COMPONENT16 = 0x81A5
// Depth stencil sized formats
static let DEPTH24_STENCIL8 = 0x88F0
// Red sized formats
static let R8 = 0x8229
static let R16 = 0x822A
static let R16F = 0x822D
static let R32F = 0x822E
// Red integer sized formats
static let R8I = 0x8231
static let R8UI = 0x8232
static let R16I = 0x8233
static let R16UI = 0x8234
static let R32I = 0x8235
static let R32UI = 0x8236
// Luminance sized formats
static let LUMINANCE8 = 0x8040
// Alpha sized formats
static let ALPHA8 = 0x803C
static let ALPHA16 = 0x803E
static let ALPHA16F = 0x881C
static let ALPHA32F = 0x8816
// Alpha integer sized formats
static let ALPHA8I = 0x8D90
static let ALPHA8UI = 0x8D7E
static let ALPHA16I = 0x8D8A
static let ALPHA16UI = 0x8D78
static let ALPHA32I = 0x8D84
static let ALPHA32UI = 0x8D72
// RG sized formats
static let RG8 = 0x822B
static let RG16 = 0x822C
//static let R16F = 0x822D
//static let R32F = 0x822E
// RG sized integer formats
static let RG8I = 0x8237
static let RG8UI = 0x8238
static let RG16I = 0x8239
static let RG16UI = 0x823A
static let RG32I = 0x823B
static let RG32UI = 0x823C
// RGB sized formats
static let RGB5 = 0x8050
static let RGB565 = 0x8D62
static let RGB8 = 0x8051
static let SRGB8 = 0x8C41
// RGB integer sized formats
static let RGB8I = 0x8D8F
static let RGB8UI = 0x8D7D
static let RGB16I = 0x8D89
static let RGB16UI = 0x8D77
static let RGB32I = 0x8D83
static let RGB32UI = 0x8D71
// RGBA sized formats
static let RGBA4 = 0x8056
static let RGB5_A1 = 0x8057
static let RGBA8 = 0x8058
static let RGB10_A2 = 0x8059
static let SRGB8_ALPHA8 = 0x8C43
static let RGBA16F = 0x881A
static let RGBA32F = 0x8814
static let RG32F = 0x8230
// RGBA integer sized formats
static let RGBA8I = 0x8D8E
static let RGBA8UI = 0x8D7C
static let RGBA16I = 0x8D88
static let RGBA16UI = 0x8D76
static let RGBA32I = 0x8D82
static let RGBA32UI = 0x8D70
// BGRA sized formats
static let BGRA8 = 0x93A1
}
| [
-1
] |
1d17eaf2b42f8115dab8d4bcbc99dfc9a42cfe38 | b14ede083a2a61b6a7d24ffdf3c161d74ab9afd8 | /Example/AveragedView/AppDelegate.swift | aaf81877dd84a512886333bc3e0104c27d40dedf | [
"MIT"
] | permissive | chronicqazxc/AveragedView | b99ddad8b64c247c6ebb264dddf27f287fe30cae | 763524b88dd063786f52f3c4541895074c11ce56 | refs/heads/master | 2021-01-19T04:26:04.723522 | 2016-06-30T14:06:53 | 2016-06-30T14:06:53 | 61,944,779 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,163 | swift | //
// AppDelegate.swift
// AveragedView
//
// Created by Wayne Hsiao on 06/25/2016.
// Copyright (c) 2016 Wayne Hsiao. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
| [
229380,
229383,
229385,
278539,
229388,
294924,
278542,
229391,
327695,
278545,
229394,
278548,
229397,
229399,
229402,
278556,
229405,
352284,
278559,
229408,
278564,
294950,
229415,
229417,
327722,
237613,
229422,
360496,
229426,
237618,
229428,
286774,
229432,
286776,
286778,
319544,
204856,
286791,
237640,
278605,
286797,
311375,
163920,
237646,
196692,
319573,
311383,
278623,
278626,
319590,
311400,
278635,
303212,
278639,
278648,
131192,
237693,
327814,
131209,
417930,
303241,
311436,
303244,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
131264,
286916,
286922,
286924,
286926,
319694,
286928,
131281,
278743,
278747,
295133,
155872,
319716,
278760,
237807,
303345,
286962,
131314,
229622,
327930,
278781,
278783,
278785,
237826,
319751,
278792,
286987,
319757,
311569,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
287032,
155966,
278849,
319809,
319810,
319814,
311623,
319818,
311628,
229709,
287054,
319822,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
319879,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
278980,
98756,
278983,
319945,
278986,
319947,
278990,
278994,
311767,
279003,
279006,
188895,
172512,
279010,
287202,
279015,
172520,
319978,
279020,
172526,
279023,
311791,
172529,
279027,
319989,
164343,
180727,
279035,
311804,
287230,
279040,
303617,
287234,
279045,
287238,
172550,
172552,
303623,
320007,
279051,
172558,
279055,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
279082,
311850,
279084,
172591,
172598,
279095,
172607,
172609,
172612,
377413,
172614,
172618,
303690,
33357,
287309,
279124,
172634,
262752,
172644,
311911,
189034,
295533,
189039,
189040,
172655,
172656,
295538,
189044,
172660,
287349,
352880,
287355,
287360,
295553,
287365,
311942,
303751,
295557,
352905,
279178,
287371,
311946,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
164509,
287390,
295583,
303773,
172702,
287394,
172705,
303780,
172707,
287398,
287400,
279208,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
279231,
287423,
328384,
287427,
312006,
107208,
107212,
172748,
287436,
172751,
287440,
295633,
172755,
303827,
279255,
172760,
279258,
303835,
213724,
189149,
303838,
287450,
279267,
312035,
295654,
279272,
312048,
230128,
312050,
230131,
205564,
303871,
230146,
328453,
295685,
230154,
33548,
312077,
295695,
295701,
369433,
230169,
295707,
328476,
295710,
230175,
303914,
279340,
205613,
279353,
230202,
312124,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
279390,
230241,
279394,
303976,
336744,
303985,
328563,
303987,
279413,
303991,
303997,
295806,
295808,
304005,
295813,
320391,
213895,
304007,
304009,
304011,
230284,
304013,
213902,
279438,
295822,
189329,
295825,
304019,
189331,
279445,
58262,
304023,
279452,
410526,
279461,
279462,
304042,
213931,
230327,
304055,
287675,
304063,
238528,
304065,
189378,
213954,
156612,
295873,
213963,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
312321,
295945,
197645,
295949,
230413,
320528,
140312,
295961,
238620,
197663,
304164,
189479,
304170,
238641,
312374,
238652,
238655,
230465,
238658,
296004,
336964,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
205931,
296044,
164973,
205934,
279661,
312432,
279669,
337018,
189562,
279679,
279683,
222340,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
165038,
238766,
230576,
238770,
304311,
350308,
230592,
279750,
312518,
230600,
230607,
148690,
320727,
279769,
304348,
279777,
304354,
296163,
320740,
279781,
304360,
279788,
320748,
279790,
304370,
296189,
320771,
312585,
296202,
296205,
230674,
320786,
230677,
296213,
296215,
214294,
320792,
230681,
230679,
304416,
230689,
173350,
312622,
296243,
312630,
222522,
222525,
296253,
312639,
296255,
230718,
296259,
378181,
230727,
238919,
320840,
296264,
296267,
296271,
222545,
230739,
312663,
337244,
222556,
230752,
312676,
230760,
173418,
410987,
230763,
230768,
296305,
312692,
230773,
279929,
181626,
304506,
304505,
181631,
312711,
312712,
296331,
288140,
230800,
288144,
304533,
337306,
288154,
288160,
173472,
288162,
288164,
279975,
304555,
370092,
279983,
288176,
279985,
173488,
312755,
296373,
279991,
312759,
288185,
337335,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
288210,
370130,
288212,
280021,
288214,
222676,
239064,
288217,
288218,
280027,
288220,
329177,
239070,
288224,
288226,
370146,
280036,
288229,
280038,
288230,
288232,
280034,
288234,
320998,
288236,
288238,
288240,
291754,
288242,
296435,
288244,
288250,
402942,
148990,
296446,
206336,
296450,
321022,
230916,
230919,
214535,
370187,
304651,
304653,
230940,
222752,
108066,
296486,
296488,
157229,
230961,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
280152,
288344,
239194,
280158,
403039,
370272,
181854,
239202,
312938,
280183,
280185,
280188,
280191,
280194,
116354,
280208,
280211,
288408,
280218,
280222,
190118,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
313027,
280260,
280264,
206536,
206539,
206541,
206543,
280276,
313044,
321239,
280283,
313052,
288478,
313055,
321252,
313066,
280302,
288494,
280304,
313073,
419570,
321266,
288499,
288502,
280314,
288510,
124671,
67330,
280324,
198405,
288519,
280331,
198416,
280337,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
296767,
288576,
345921,
280388,
304968,
280393,
280402,
313176,
42842,
280419,
321381,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280464,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
280487,
313258,
321458,
296883,
124853,
214966,
10170,
296890,
288700,
296894,
280515,
190403,
296900,
337862,
165831,
280521,
231379,
296921,
239586,
313320,
231404,
124913,
165876,
321528,
239612,
313340,
288764,
239617,
313347,
288773,
313358,
321560,
305176,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
378941,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
280671,
223327,
149599,
321634,
149601,
149603,
329830,
280681,
313451,
223341,
280687,
313458,
280691,
215154,
313464,
329850,
321659,
280702,
288895,
321670,
215175,
141446,
141455,
141459,
280725,
313498,
288936,
100520,
280747,
288940,
280755,
288947,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
313548,
321740,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
157930,
280811,
280817,
280819,
157940,
125171,
182517,
280823,
280825,
280827,
280830,
280831,
280833,
280835,
125187,
125191,
125207,
125209,
321817,
125218,
230045,
321842,
223539,
125239,
280888,
280891,
289087,
280897,
280900,
239944,
305480,
280906,
239947,
305485,
305489,
379218,
280919,
354653,
313700,
280937,
313705,
280940,
190832,
280946,
223606,
313720,
280956,
239997,
280959,
313731,
199051,
240011,
289166,
240017,
297363,
190868,
297365,
240021,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
305594,
289210,
281024,
289218,
289221,
289227,
281045,
281047,
215526,
166378,
305647,
281075,
174580,
281084,
240124,
305662,
305664,
240129,
305666,
305668,
240132,
223749,
281095,
338440,
150025,
223752,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
281135,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
281179,
199262,
338528,
338532,
281190,
199273,
281196,
158317,
19053,
313973,
281210,
297594,
158347,
133776,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
199364,
297671,
158409,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322314,
322318,
281361,
281372,
322341,
215850,
281388,
207661,
289593,
281401,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
281442,
174955,
224110,
207733,
207737,
183172,
158596,
240519,
322440,
314249,
338823,
183184,
289687,
240535,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
281567,
289762,
322534,
297961,
281581,
183277,
322550,
134142,
322563,
175134,
322599,
322610,
314421,
281654,
314427,
207937,
314433,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
289912,
248995,
306341,
306344,
306347,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
126190,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
257334,
216376,
298306,
380226,
224584,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
308418,
216436,
306549,
298358,
314743,
306552,
290171,
314747,
306555,
290174,
298365,
224641,
281987,
298372,
314756,
281990,
224647,
265604,
298377,
314763,
142733,
298381,
224657,
306581,
314779,
314785,
282025,
314793,
282027,
241068,
241070,
241072,
282034,
241077,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
290291,
282101,
241142,
191992,
290298,
151036,
290302,
282111,
290305,
175621,
192008,
323084,
257550,
282127,
290321,
282130,
323090,
282133,
290325,
241175,
290328,
282137,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
282186,
224849,
282195,
282199,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
282261,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
306856,
282295,
282300,
323260,
323266,
282310,
323273,
282319,
306897,
241362,
282328,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
282410,
241450,
306988,
306991,
315184,
323376,
315190,
241464,
282425,
159545,
298811,
307009,
413506,
241475,
307012,
148946,
315211,
282446,
307027,
315221,
282454,
315223,
241496,
323414,
241498,
307035,
307040,
282465,
110433,
241509,
110438,
298860,
110445,
282478,
282481,
110450,
315251,
315249,
315253,
315255,
339838,
282499,
315267,
315269,
241544,
282505,
241546,
241548,
298896,
282514,
298898,
44948,
298901,
241556,
282520,
241560,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
36779,
241581,
282542,
241583,
323504,
241586,
282547,
241588,
290739,
241590,
241592,
241598,
290751,
241600,
241605,
151495,
241610,
298975,
241632,
298984,
241640,
241643,
298988,
241646,
241649,
241652,
323574,
290807,
241661,
299006,
282623,
315396,
241669,
315397,
282632,
282639,
290835,
282645,
241693,
282654,
241701,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
307278,
192596,
176213,
307287,
315482,
217179,
315483,
192605,
233567,
200801,
299105,
217188,
299109,
307303,
315495,
356457,
45163,
307307,
315502,
192624,
307314,
323700,
299126,
233591,
299136,
307329,
307338,
233613,
241813,
307352,
299164,
184479,
299167,
184481,
315557,
184486,
307370,
307372,
184492,
307374,
307376,
323763,
176311,
299191,
307385,
307386,
258235,
176316,
307388,
307390,
184503,
299200,
184512,
307394,
307396,
299204,
184518,
307399,
323784,
307409,
307411,
176343,
299225,
233701,
307432,
184572,
282881,
184579,
282893,
291089,
282906,
291104,
233766,
176435,
307508,
315701,
307510,
332086,
151864,
307512,
168245,
307515,
282942,
307518,
151874,
282947,
282957,
323917,
110926,
233808,
323921,
315733,
323926,
233815,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299388,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
283033,
291226,
242075,
315801,
291231,
61855,
283042,
291238,
291241,
127403,
127405,
291247,
127407,
299440,
299444,
127413,
283062,
291254,
127417,
291260,
283069,
127421,
127424,
299457,
127429,
127431,
176592,
315856,
315860,
176597,
283095,
127447,
299481,
176605,
242143,
291299,
127463,
242152,
291305,
127466,
176620,
127474,
291314,
291317,
135672,
233979,
291323,
127485,
291330,
283142,
127497,
233994,
135689,
291341,
233998,
234003,
234006,
152087,
127511,
283161,
242202,
234010,
135707,
242206,
135710,
242208,
291361,
242220,
291378,
234038,
152118,
234041,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
291456,
135808,
373383,
299655,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
225948,
135839,
299680,
225954,
299684,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
225998,
299726,
226002,
226005,
119509,
226008,
242396,
299740,
201444,
299750,
283368,
234219,
283372,
226037,
283382,
316151,
234231,
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,
283421,
234269,
234272,
234274,
152355,
234278,
299814,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
283452,
160572,
234302,
234307,
242499,
234309,
292433,
234313,
316233,
316235,
234316,
283468,
242511,
234319,
234321,
234324,
185173,
201557,
234329,
234333,
308063,
234336,
234338,
242530,
349027,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
226171,
291711,
234368,
234370,
201603,
291714,
234373,
226182,
234375,
291716,
226185,
308105,
234379,
234384,
234388,
234390,
226200,
324504,
234393,
209818,
308123,
324508,
234398,
234396,
291742,
234401,
291747,
291748,
234405,
291750,
234407,
324518,
324520,
234410,
324522,
226220,
291756,
234414,
324527,
291760,
234417,
201650,
324531,
226230,
234422,
275384,
324536,
234428,
291773,
234431,
242623,
324544,
324546,
226239,
324548,
226245,
234437,
234439,
234434,
234443,
291788,
193486,
275406,
193488,
234446,
234449,
316370,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234475,
234478,
316400,
234481,
316403,
234484,
234485,
324599,
234487,
234490,
234493,
234496,
316416,
234501,
275462,
308231,
234504,
234507,
234510,
234515,
300054,
234519,
316439,
234520,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
144430,
234543,
234546,
275508,
234549,
300085,
300088,
234553,
234556,
234558,
316479,
234561,
316483,
234563,
308291,
234568,
234570,
316491,
300108,
234572,
234574,
300115,
234580,
234581,
300628,
275545,
242777,
234585,
234590,
234593,
234595,
300133,
234597,
234601,
300139,
234605,
234607,
160879,
275569,
234610,
300148,
234614,
398455,
144506,
275579,
234618,
234620,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
226453,
275606,
234647,
275608,
308373,
234650,
324757,
234648,
283805,
234653,
324766,
119967,
234657,
308379,
300189,
324768,
283813,
234661,
177318,
234664,
300197,
275626,
234667,
242852,
316596,
308414,
234687,
316610,
300226,
226500,
234692,
300229,
308420,
283844,
308422,
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,
283963,
243003,
226628,
283973,
300357,
177482,
283983,
316758,
357722,
316766,
292192,
316768,
218464,
292197,
316774,
243046,
218473,
284010,
136562,
324978,
275834,
333178,
275836,
275840,
316803,
316806,
226696,
316811,
226699,
316814,
226703,
300433,
234899,
226709,
357783,
316824,
316826,
144796,
300448,
144807,
144810,
284076,
144812,
144814,
144820,
284084,
284087,
292279,
144826,
144828,
144830,
144832,
284099,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
226787,
218597,
292329,
300523,
259565,
259567,
300527,
308720,
226802,
316917,
308727,
292343,
300537,
316947,
308757,
308762,
284191,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
284213,
194101,
284215,
194103,
284218,
226877,
284223,
284226,
243268,
292421,
226886,
284231,
128584,
284228,
284234,
366155,
276043,
317004,
284238,
226895,
284241,
194130,
284243,
276052,
276053,
284245,
284247,
317015,
284249,
243290,
284251,
235097,
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,
276098,
284290,
325250,
284292,
292479,
292485,
284297,
317066,
284299,
317068,
276109,
284301,
284303,
276114,
284306,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
276137,
284329,
284331,
317098,
284333,
284335,
276144,
284337,
284339,
300726,
284343,
284346,
284350,
276160,
358080,
284354,
358083,
276166,
284358,
358089,
276170,
284362,
276175,
284368,
276177,
284370,
317138,
284372,
358098,
284377,
276187,
284379,
284381,
284384,
284386,
358114,
358116,
276197,
317158,
358119,
284392,
325353,
284394,
358122,
284397,
276206,
284399,
358126,
358128,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
284418,
358146,
317187,
317189,
317191,
284428,
300816,
300819,
317207,
284440,
186139,
300828,
300830,
276255,
325408,
284449,
300834,
300832,
227109,
317221,
358183,
186151,
276268,
300845,
194351,
243504,
300850,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
300872,
153417,
284499,
276308,
284502,
317271,
178006,
276315,
292700,
284511,
227175,
292715,
300912,
284529,
292721,
300915,
284533,
292729,
317306,
284540,
292734,
325512,
169868,
276365,
284564,
358292,
284566,
350106,
284572,
276386,
284579,
276388,
358312,
284585,
317353,
276395,
292776,
292784,
276402,
358326,
161718,
276410,
276411,
358330,
276418,
276425,
301009,
301011,
301013,
292823,
301015,
301017,
358360,
292828,
276446,
153568,
276448,
276452,
276455,
292839,
292843,
276460,
276464,
178161,
276466,
227314,
276472,
325624,
317435,
276476,
276479,
276482,
276485,
317446,
276490,
292876,
276496,
317456,
317458,
243733,
317468,
243740,
317472,
325666,
243751,
292904,
276528,
243762,
309298,
325685,
325689,
276539,
235579,
235581,
325692,
178238,
276544,
284739,
292934,
276553,
243785,
350293,
350295,
194649,
227418,
309337,
194654,
227423,
350302,
194657,
227426,
276579,
178273,
194660,
227430,
276583,
309346,
309348,
276586,
309350,
309352,
309354,
276590,
350313,
227440,
350316,
284786,
350321,
276595,
350325,
301167,
350328,
292985,
301178,
292989,
292993,
301185,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
276638,
350366,
284837,
153765,
350375,
350379,
350381,
350383,
129200,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
309450,
301258,
276685,
309455,
276689,
309462,
301272,
276699,
309468,
194780,
309471,
301283,
317672,
276713,
317674,
325867,
243948,
194801,
227571,
309491,
309494,
243960,
227583,
276735,
227587,
276739,
211204,
276742,
227593,
227596,
325910,
309530,
342298,
276766,
211232,
317729,
276775,
211241,
325937,
325943,
211260,
260421,
276809,
285002,
276811,
235853,
276816,
235858,
276829,
276833,
391523,
276836,
276843,
293227,
276848,
293232,
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,
317951,
309764,
301575,
121352,
236043,
317963,
342541,
55822,
113167,
277011,
317971,
309781,
309779,
55837,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
285236,
23094,
277054,
244288,
129603,
318020,
301636,
301639,
301643,
277071,
285265,
399955,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
277106,
121458,
170618,
170619,
309885,
309888,
277122,
227975,
285320,
277128,
301706,
318092,
326285,
318094,
334476,
277136,
277139,
227992,
285340,
318108,
227998,
318110,
137889,
383658,
285357,
318128,
277170,
342707,
154292,
277173,
293555,
318132,
285368,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
137946,
113378,
203491,
228069,
277223,
342760,
285417,
56041,
56043,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
228113,
285459,
277273,
293659,
326430,
228128,
293666,
285474,
228135,
318248,
277291,
293677,
318253,
285489,
301876,
293685,
285494,
301880,
285499,
301884,
310080,
293696,
277317,
277322,
277329,
162643,
310100,
301911,
301913,
277337,
301921,
400236,
236397,
162671,
326514,
310134,
277368,
15224,
236408,
416639,
416640,
113538,
310147,
416648,
39817,
187274,
277385,
301972,
424853,
277405,
277411,
310179,
293798,
293802,
236460,
277426,
293811,
293817,
293820,
203715,
326603,
293849,
293861,
228327,
228328,
228330,
318442,
228332,
277486,
326638,
318450,
293876,
293877,
285686,
302073,
285690,
244731,
121850,
302075,
293882,
293887,
277504,
277507,
277511,
277519,
293908,
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,
310376,
228460,
318573,
203886,
187509,
285815,
285817,
367737,
285821,
302205,
285824,
392326,
285831,
253064,
302218,
285835,
294026,
384148,
162964,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
285862,
277671,
302248,
64682,
277678,
228526,
294063,
294065,
302258,
277687,
294072,
318651,
294076,
277695,
318657,
244930,
302275,
130244,
302277,
228550,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
302296,
384222,
310498,
285927,
318698,
302315,
195822,
228592,
294132,
138485,
228601,
204026,
228606,
204031,
64768,
310531,
285958,
228617,
138505,
318742,
204067,
277798,
130345,
277801,
113964,
285997,
277804,
285999,
277807,
113969,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
417086,
277822,
286016,
294211,
302403,
384328,
277832,
277836,
294221,
326991,
294223,
277839,
277842,
277847,
277850,
179547,
277853,
146784,
277857,
302436,
277860,
294246,
327015,
310632,
327017,
351594,
277864,
277869,
277872,
351607,
310648,
277880,
310651,
277884,
277888,
310657,
351619,
294276,
310659,
327046,
277892,
253320,
310665,
318858,
277894,
277898,
277903,
310672,
351633,
277905,
277908,
277917,
310689,
277921,
130468,
228776,
277928,
277932,
310703,
277937,
310710,
130486,
310712,
277944,
310715,
277947,
302526,
228799,
277950,
277953,
64966,
245191,
163272,
302534,
310727,
277959,
292968,
302541,
277963,
302543,
277966,
310737,
277971,
286169,
228825,
163290,
277978,
310749,
277981,
277984,
310755,
277989,
277991,
187880,
277995,
286188,
310764,
278000,
228851,
310772,
278003,
278006,
40440,
212472,
278009,
40443,
286203,
228864,
40448,
286214,
228871,
302603,
65038,
302614,
286233,
302617,
302621,
286240,
146977,
187939,
294435,
40484,
286246,
40486,
286248,
278057,
294439,
294440,
294443,
294445,
40488,
310831,
40491,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
40521,
286283,
40525,
40527,
228944,
212560,
400976,
40533,
147032,
40537,
40539,
278109,
40541,
40544,
40548,
40550,
286312,
286313,
40554,
40552,
310892,
40557,
40560,
188022,
122488,
294521,
343679,
310925,
286354,
278163,
302740,
122517,
278168,
327333,
229030,
212648,
278188,
302764,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
294601,
302793,
343757,
212690,
278227,
229076,
286420,
319187,
286425,
319194,
278235,
301163,
229086,
278238,
286432,
294625,
294634,
302838,
319226,
286460,
171774,
278274,
302852,
278277,
302854,
294664,
311048,
352008,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
278320,
319280,
319290,
229192,
302925,
188247,
237409,
294776,
360317,
294785,
327554,
40840,
40851,
294803,
188312,
294811,
319390,
294817,
319394,
40865,
294821,
311209,
180142,
294831,
188340,
40886,
319419,
294844,
294847,
393177,
294876,
294879,
294883,
294890,
311279,
278513,
237555,
278516,
311283,
278519,
237562
] |
062a8e9ca5ad4649858025fe3b3b365f6d2931d5 | 5ec167e93b9b8c61af2dcb8017e90a40ea521255 | /mapdemoTests/mapdemoTests.swift | ab9f557db97a76455bf9c418a4440fe4b26c78c0 | [] | no_license | javedmultani16/CurrentLocationInMap | 67733a7496ea751daa21ef1cf182af4874dd2454 | 19a0c59e61b8cdcd290f615ff775b9df319f00fc | refs/heads/master | 2020-03-20T00:57:11.517599 | 2018-06-18T12:53:49 | 2018-06-18T12:53:49 | 137,062,001 | 1 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 875 | swift | //
// mapdemoTests.swift
// mapdemoTests
//
//
import XCTest
@testable import mapdemo
class mapdemoTests: 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.
}
}
}
| [
98333,
278558,
16419,
229413,
204840,
278570,
360491,
344107,
155694,
253999,
229424,
237620,
229430,
319542,
352315,
286788,
352326,
311372,
196691,
278615,
237663,
319591,
131178,
278634,
278638,
319598,
352368,
131189,
131191,
237689,
131198,
278655,
311435,
311438,
278677,
278685,
311458,
278691,
49316,
196773,
32941,
278704,
278708,
131256,
278714,
254170,
229597,
311519,
286958,
327929,
278797,
180493,
254226,
278810,
278816,
237857,
311597,
98610,
262450,
278842,
287041,
287043,
311621,
139589,
319813,
319821,
254286,
344401,
278869,
155990,
106847,
246127,
139640,
246136,
106874,
246137,
311681,
377264,
278961,
278965,
278970,
33211,
319930,
336317,
278978,
188871,
278989,
278993,
278999,
328152,
369116,
188894,
287198,
279008,
279013,
279018,
279022,
279029,
254456,
279032,
279039,
287241,
279050,
303631,
279057,
303636,
279062,
254488,
279065,
180771,
377386,
279094,
352829,
287318,
295519,
66150,
344680,
279146,
295536,
287346,
287352,
344696,
279164,
189057,
303746,
311941,
279177,
369289,
344715,
311949,
287374,
352917,
230040,
271000,
303771,
221852,
205471,
279206,
295590,
279210,
287404,
205487,
303793,
336564,
164533,
287417,
303803,
287422,
66242,
287433,
287439,
164560,
279252,
287452,
295652,
230125,
312047,
279280,
230134,
221948,
279294,
205568,
295682,
295697,
336671,
344865,
279336,
262954,
295724,
353069,
312108,
164656,
303920,
262962,
328499,
353078,
230199,
353079,
336702,
295744,
279362,
353094,
353095,
353109,
230234,
295776,
279392,
303972,
279397,
230248,
246641,
246648,
279417,
361337,
254850,
287622,
213894,
295824,
279456,
189348,
279464,
353195,
140204,
353197,
304051,
287677,
189374,
353216,
213960,
279498,
304087,
50143,
123881,
320493,
320494,
304110,
287731,
295927,
304122,
320507,
328700,
328706,
320516,
230410,
320527,
418837,
140310,
230423,
197657,
271388,
238623,
336929,
345132,
238639,
312373,
238651,
230463,
238664,
296019,
353367,
156764,
156765,
304222,
230499,
279660,
156785,
312434,
353397,
279672,
279685,
222343,
296086,
238743,
296092,
238765,
279728,
238769,
230588,
279747,
353479,
353481,
353482,
279760,
189652,
279765,
296153,
279774,
304351,
304356,
279785,
279792,
353523,
320770,
279814,
312587,
328971,
173334,
320796,
304421,
345396,
116026,
222524,
279875,
230729,
222541,
296270,
238927,
296273,
222559,
230756,
230765,
279920,
312689,
296307,
116084,
181625,
378244,
296329,
230799,
296335,
9619,
279974,
173491,
304564,
279989,
296375,
296387,
296391,
296392,
361927,
280010,
370123,
148940,
280013,
312782,
222675,
353750,
239068,
280032,
280041,
296425,
361963,
321009,
280055,
288249,
296448,
230921,
296461,
149007,
304656,
329232,
230959,
288309,
288318,
280130,
124485,
288326,
288327,
280147,
239198,
157281,
222832,
247416,
288378,
337535,
239237,
288392,
239250,
345752,
255649,
198324,
296628,
321207,
296632,
280251,
280257,
321219,
280267,
9936,
9937,
280278,
280280,
18138,
67292,
321247,
313065,
288491,
280300,
239341,
419569,
313081,
124669,
288512,
288516,
280327,
280329,
321302,
116505,
321310,
313120,
247590,
280366,
280372,
321337,
280380,
345919,
280390,
280392,
345929,
304977,
255829,
18262,
280410,
370522,
345951,
362337,
345955,
296806,
288619,
288620,
280430,
362352,
313203,
124798,
182144,
305026,
67463,
329622,
124824,
214937,
214938,
239514,
247712,
354212,
124852,
288697,
214977,
280514,
280519,
214984,
247757,
231375,
346067,
280541,
337895,
247785,
296941,
124911,
329712,
362480,
313339,
313357,
182296,
305179,
313375,
239650,
223268,
354343,
354345,
223274,
124975,
346162,
124984,
288833,
288834,
280649,
354385,
223316,
280661,
223318,
329814,
338007,
288857,
354393,
280675,
280677,
313447,
288879,
223350,
280694,
215164,
313469,
215166,
280712,
215178,
141450,
346271,
239793,
125109,
182456,
280762,
223419,
379071,
280768,
338119,
280778,
321745,
280795,
280802,
338150,
125169,
338164,
157944,
125183,
125188,
313608,
125193,
125198,
125199,
125203,
125208,
305440,
125217,
125235,
280887,
125240,
280902,
182598,
289110,
305495,
379225,
272729,
321894,
280939,
313713,
354676,
199029,
280961,
362881,
248194,
395659,
395661,
240016,
190871,
289189,
281040,
281072,
223767,
289304,
223769,
182817,
322120,
281166,
281171,
354911,
436832,
191082,
313966,
281199,
330379,
133774,
330387,
330388,
314009,
338613,
166582,
314040,
158394,
199366,
363211,
289502,
363230,
338662,
330474,
346858,
289518,
125684,
199414,
35583,
363263,
322313,
322316,
322319,
166676,
207640,
281377,
289576,
289598,
281408,
420677,
355146,
355152,
355154,
281427,
281433,
355165,
355178,
330609,
174963,
207732,
158593,
240518,
289703,
330689,
363458,
52172,
183248,
338899,
330708,
248797,
207838,
314342,
289774,
183279,
314355,
240630,
314362,
322570,
281625,
281626,
175132,
248872,
322612,
207938,
314448,
281697,
314467,
281700,
322663,
281706,
207979,
363644,
150657,
248961,
339102,
330913,
306338,
249002,
339130,
208058,
290000,
298208,
363744,
298212,
298213,
290022,
330984,
298221,
298228,
216315,
208124,
388349,
363771,
322824,
126237,
339234,
199971,
109861,
298291,
224586,
372043,
331090,
314709,
224606,
314720,
142689,
281957,
314728,
281962,
306542,
314739,
314741,
290173,
306559,
224640,
298374,
314758,
281992,
142729,
314760,
388487,
314766,
306579,
224661,
282007,
290207,
314783,
314789,
282022,
282024,
241066,
380357,
339398,
306631,
306639,
191981,
306673,
306677,
290300,
290301,
282114,
306692,
306693,
323080,
192010,
323087,
282129,
282136,
282141,
282146,
306723,
290358,
282183,
290390,
306776,
282213,
323178,
314998,
175741,
192131,
282245,
282246,
224901,
290443,
323217,
282259,
298654,
282271,
282273,
282276,
298661,
323236,
290471,
282280,
298667,
282303,
282312,
306890,
282318,
241361,
282327,
298712,
216795,
282339,
12010,
282348,
282355,
282358,
282369,
175873,
339715,
323331,
323332,
216839,
282378,
282391,
249626,
282400,
241441,
339745,
315171,
257830,
282409,
159533,
282417,
200498,
282427,
282434,
315202,
307011,
282438,
307025,
413521,
216918,
307031,
241495,
282474,
282480,
241528,
282504,
110480,
184208,
282518,
282519,
44952,
118685,
298909,
298920,
323507,
290746,
151497,
298980,
282612,
290811,
282633,
241692,
307231,
102437,
233517,
102445,
282672,
159807,
315476,
307289,
200794,
315487,
45153,
307301,
315498,
299121,
233589,
233590,
241808,
323729,
233636,
184484,
233642,
299187,
184505,
299198,
299203,
282831,
356576,
176362,
233715,
184570,
168188,
184575,
299293,
282909,
233762,
217380,
151847,
282919,
332085,
332089,
315706,
282939,
307517,
241986,
332101,
348492,
323916,
250192,
323920,
348500,
332123,
323935,
242029,
160110,
242033,
291192,
225670,
332167,
291224,
283038,
61857,
315810,
61859,
315811,
340398,
299441,
61873,
61880,
283064,
291267,
127427,
127428,
283075,
324039,
176601,
242139,
160225,
242148,
291311,
233978,
291333,
340490,
283153,
291358,
283182,
283184,
234036,
234040,
315960,
70209,
348742,
348749,
340558,
242277,
111208,
291454,
184962,
348806,
152203,
184973,
316053,
299699,
299700,
225995,
225997,
242386,
226004,
226007,
299746,
226019,
234217,
299770,
234234,
299776,
242433,
234241,
209670,
291592,
226058,
234250,
234253,
291604,
234263,
283419,
234268,
234277,
283430,
234283,
152365,
234286,
234289,
242485,
234294,
234301,
160575,
234311,
234312,
299849,
283467,
234317,
201551,
234323,
234326,
234331,
242529,
349026,
234340,
275303,
234343,
177001,
234346,
308076,
242541,
234355,
209783,
234360,
209785,
234361,
177019,
308092,
234366,
234367,
291712,
234372,
226181,
226184,
308107,
308112,
234386,
234387,
234392,
209817,
324506,
324507,
234400,
234404,
324517,
283558,
234409,
275371,
316333,
234419,
316343,
234425,
234427,
234430,
349121,
234436,
234438,
316364,
234444,
234445,
234451,
234454,
234457,
340955,
234463,
340961,
234466,
234472,
234473,
324586,
234477,
340974,
234482,
316405,
201720,
234498,
234500,
234506,
324625,
234514,
308243,
316437,
201755,
234531,
300068,
234534,
357414,
234542,
300084,
234548,
324666,
234555,
308287,
234560,
21569,
234565,
234569,
300111,
234577,
341073,
234583,
234584,
234587,
250981,
300135,
300136,
316520,
275565,
316526,
357486,
144496,
234609,
300146,
275571,
300151,
291959,
234616,
398457,
160891,
341115,
300158,
234622,
234625,
349316,
349318,
275591,
234632,
234638,
169104,
177296,
234642,
308372,
185493,
283802,
300187,
119962,
119963,
300188,
234656,
234659,
234663,
275625,
300201,
300202,
226481,
283840,
259268,
283847,
62665,
283852,
283853,
357595,
234733,
292085,
234742,
292091,
316669,
242954,
292107,
251153,
349462,
226608,
300343,
226624,
193859,
300359,
226632,
234827,
177484,
251213,
234831,
120148,
283991,
357719,
218462,
292195,
333160,
284014,
243056,
111993,
357762,
112017,
112018,
234898,
357786,
251298,
333220,
316842,
210358,
284089,
292283,
415171,
300487,
300489,
284107,
284116,
366037,
210390,
210391,
210392,
210393,
226781,
144867,
316902,
54765,
251378,
308723,
300535,
300536,
300542,
210433,
366083,
316946,
308756,
398869,
308764,
349726,
349741,
169518,
194110,
235070,
349763,
218696,
276040,
366154,
292425,
243274,
276045,
128587,
333388,
333393,
349781,
300630,
235095,
243292,
333408,
374372,
300644,
317032,
54893,
276085,
366203,
325245,
235135,
276120,
276126,
333470,
300714,
300728,
218819,
276173,
333517,
333520,
333521,
333523,
276195,
153319,
284401,
276210,
300794,
325371,
276219,
194303,
194304,
300811,
284429,
276238,
284431,
366360,
284442,
325404,
276253,
325410,
341796,
284459,
317232,
276282,
276283,
276287,
325439,
276294,
276298,
341836,
325457,
284507,
284512,
284514,
276327,
292712,
325484,
292720,
325492,
300918,
276344,
194429,
325503,
333701,
243591,
350093,
243597,
325518,
300963,
292771,
333735,
284587,
292782,
317360,
243637,
276408,
276421,
284619,
276430,
301008,
153554,
194515,
276444,
219101,
292836,
292837,
276454,
317415,
276459,
325619,
333817,
292858,
292902,
227370,
309295,
243759,
276534,
358456,
227417,
194656,
309345,
227428,
276582,
194666,
276589,
227439,
284788,
333940,
292988,
292992,
194691,
227460,
333955,
235662,
325776,
276627,
317587,
276632,
284825,
284826,
333991,
333992,
284842,
129203,
227513,
301251,
309444,
227524,
276682,
227548,
301279,
211193,
243962,
309503,
375051,
325905,
325912,
309529,
227616,
211235,
211238,
260418,
227654,
227658,
276813,
6481,
6482,
366929,
366930,
6489,
391520,
276835,
416104,
276847,
285040,
227725,
178578,
178582,
293274,
39324,
285084,
317852,
285090,
375207,
334260,
293303,
276920,
276925,
293310,
317901,
326100,
285150,
227809,
358882,
342498,
227813,
195045,
309744,
301571,
276998,
342536,
186893,
342553,
375333,
293419,
244269,
236081,
23092,
277048,
309830,
301638,
293448,
55881,
309846,
244310,
277094,
277101,
277111,
301689,
277133,
227990,
342682,
285353,
285361,
342706,
293556,
342713,
285371,
285373,
154316,
203477,
96984,
318173,
285415,
342762,
277227,
293612,
154359,
162561,
285444,
310036,
326429,
293664,
326433,
318250,
318252,
285487,
301871,
285497,
162621,
293693,
162626,
277316,
318278,
277325,
293711,
301918,
293730,
351077,
342887,
400239,
310131,
211829,
277366,
228215,
277370,
269178,
211836,
359298,
260996,
277381,
113542,
416646,
228233,
228234,
56208,
293781,
400283,
318364,
310176,
310178,
310182,
293800,
236461,
293806,
252847,
343005,
130016,
64485,
277479,
203757,
277492,
277509,
277510,
146448,
277523,
326685,
310317,
252980,
359478,
277563,
302139,
359495,
277597,
113760,
302177,
253029,
285798,
228458,
15471,
351344,
187506,
285814,
187521,
285828,
302213,
285830,
253063,
302216,
228491,
228493,
285838,
162961,
326804,
285851,
302240,
343203,
253099,
294068,
367799,
277690,
64700,
228540,
228542,
302274,
343234,
367810,
244940,
228563,
310497,
195811,
228588,
253167,
302325,
204022,
228600,
228609,
245019,
277792,
130338,
130343,
277800,
113966,
351537,
286013,
286018,
15686,
294218,
318805,
294243,
163175,
327025,
327031,
368011,
318875,
310692,
286129,
286132,
228795,
302529,
302531,
163268,
163269,
310732,
302540,
64975,
310736,
327121,
228827,
286172,
310757,
187878,
343542,
343543,
286202,
286205,
302590,
294400,
228867,
253452,
65041,
146964,
204313,
302623,
286244,
245287,
278060,
245292,
286254,
425535,
196164,
56902,
228943,
286288,
196187,
147036,
343647,
286306,
138863,
188031,
294529,
286343,
229001,
310923,
188048,
229020,
302754,
245412,
229029,
40613,
40614,
40615,
278191,
286388,
286391,
319162,
286399,
302797,
212685,
212688,
245457,
302802,
286423,
278233,
278234,
294622,
278240,
212716,
212717,
229113,
286459,
278272,
319233,
311042,
278291,
278293,
294678,
278299,
286494,
294700,
360252,
188251,
237408,
253829,
40853,
294807,
294809,
294814,
319392,
294823,
294843,
98239,
237504,
294850,
163781,
344013,
212946,
294886,
253929,
327661,
278512,
311281,
311282
] |
70ffb28c61b72c5d7f040ab98b318a33c06c78df | 04e1b38e042a16ac434f2768ef0959a8c799e061 | /YoutubeApp1/Controller/ViewController.swift | 8de24bea6b7bbb7062c25253b9068065a220226a | [] | no_license | haru125/YoutubeApp | a18e77dc5882db16d875bdc68f12726ce64be5cd | e0f723deb0ae0d8c9eada2408b926a9030ee763f | refs/heads/master | 2023-03-15T20:45:57.237393 | 2021-03-09T07:34:09 | 2021-03-09T07:34:09 | 345,920,741 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 976 | swift | //
// ViewController.swift
// YoutubeApp1
//
// Created by 太田都寿 on 2021/01/21.
//
import UIKit
import FirebaseAuth
class ViewController: UIViewController {
@IBOutlet weak var textfield: UITextField!
@IBOutlet weak var button: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
button.layer.cornerRadius = 10
}
@IBAction func createNewUser(_ sender: Any) {
createUser()
}
func createUser(){
Auth.auth().signInAnonymously { (result, error) in
let user = result?.user
print(user.debugDescription)
UserDefaults.standard.set(self.textfield.text, forKey: "userName")
let profileVC = self.storyboard?.instantiateViewController(identifier: "profileVC") as! ProfileViewController
profileVC.userName = self.textfield.text!
self.navigationController?.pushViewController(profileVC, animated: true)
}
}
}
| [
-1
] |
de0937c2ae8f067acbab606864ccd522ce94fb86 | 16896d1de438a0a598e0999d9072be0cf3285bd1 | /PsychoTestsAR/Model/AppDelegate.swift | c1c7ace2bd7ae22b0203854247c18ca4068c822e | [] | no_license | tomaszwilk1985/PsychoTestsAR | 08c2679f49604b360ab0d1035c30bee6820a74cb | 5f6d012213862caa17bfb3e0066726648195ddc2 | refs/heads/master | 2020-05-03T05:49:41.289065 | 2019-04-26T20:57:56 | 2019-04-26T20:57:56 | 178,458,810 | 1 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 4,599 | swift | //
// AppDelegate.swift
// PsychoTestsAR
//
// Created by AT Wolfar on 18/03/2019.
// Copyright © 2019 PUMTeam. All rights reserved.
//
import UIKit
import CoreData
@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:.
// Saves changes in the application's managed object context before the application terminates.
self.saveContext()
}
// MARK: - Core Data stack
lazy var persistentContainer: NSPersistentContainer = {
/*
The persistent container for the application. This implementation
creates and returns a container, having loaded the store for the
application to it. This property is optional since there are legitimate
error conditions that could cause the creation of the store to fail.
*/
let container = NSPersistentContainer(name: "PsychoTestsAR")
container.loadPersistentStores(completionHandler: { (storeDescription, error) in
if let error = error as NSError? {
// Replace this implementation with code to handle the error appropriately.
// fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
/*
Typical reasons for an error here include:
* The parent directory does not exist, cannot be created, or disallows writing.
* The persistent store is not accessible, due to permissions or data protection when the device is locked.
* The device is out of space.
* The store could not be migrated to the current model version.
Check the error message to determine what the actual problem was.
*/
fatalError("Unresolved error \(error), \(error.userInfo)")
}
})
return container
}()
// MARK: - Core Data Saving support
func saveContext () {
let context = persistentContainer.viewContext
if context.hasChanges {
do {
try context.save()
} catch {
// Replace this implementation with code to handle the error appropriately.
// fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
let nserror = error as NSError
fatalError("Unresolved error \(nserror), \(nserror.userInfo)")
}
}
}
}
| [
294405,
243717,
163848,
313353,
320008,
320014,
313360,
288275,
322580,
289300,
290326,
329747,
139803,
322080,
306721,
229408,
296483,
322083,
229411,
306726,
309287,
308266,
292907,
217132,
322092,
40495,
316465,
288306,
322102,
324663,
164408,
308281,
322109,
286783,
315457,
313409,
313413,
349765,
320582,
309832,
288329,
215117,
196177,
241746,
344661,
231000,
212571,
300124,
287323,
309342,
325220,
306790,
290409,
310378,
296043,
311914,
322666,
334446,
239726,
307310,
292466,
314995,
307315,
314487,
291450,
314491,
222846,
318599,
312970,
239252,
311444,
294038,
311449,
323739,
300194,
298662,
233644,
313005,
286896,
295600,
300208,
286389,
294070,
125111,
234677,
309439,
235200,
284352,
296641,
242371,
302787,
284360,
321228,
319181,
298709,
284374,
182486,
189654,
320730,
241371,
311516,
357083,
179420,
322272,
317665,
298210,
165091,
311525,
288489,
290025,
229098,
307436,
304365,
323310,
125167,
313073,
286455,
306424,
322299,
319228,
302332,
319231,
184576,
309505,
241410,
311043,
366339,
309509,
318728,
125194,
234763,
321806,
125201,
296218,
313116,
237858,
326434,
295716,
313125,
300836,
289577,
125226,
133421,
317233,
241971,
316726,
318264,
201530,
313660,
159549,
287038,
292159,
218943,
182079,
288578,
301893,
234828,
292172,
300882,
321364,
243032,
201051,
230748,
258397,
294238,
298844,
199020,
293741,
266606,
319342,
292212,
313205,
244598,
316788,
124796,
196988,
305022,
317821,
243072,
314241,
303999,
242050,
313215,
325509,
293767,
316300,
306576,
322448,
308114,
319900,
298910,
313250,
308132,
316327,
306605,
316334,
324015,
324017,
200625,
300979,
316339,
322998,
296888,
316345,
67000,
300987,
319932,
310718,
292288,
317888,
323520,
312772,
214980,
298950,
306632,
310733,
289744,
310740,
235994,
286174,
315359,
240098,
323555,
236008,
319465,
248299,
311789,
326640,
188913,
203761,
320498,
314357,
288246,
309243,
300540,
310782
] |
c7165f683f83135cb55d610b2d84ce7df877b130 | f5cfbd766e3e0ddafe91055a2f777d7eb8d93794 | /LoadImageURL/DataServices.swift | d9d055883eacab89159f3b0d091fd66b9e1c7624 | [] | no_license | TrungCatun/CacheImageCloseure | 6dc20f6b39a264c4cdeb96776fc855f91bc9ffe6 | 17869b9f1285ec8791e714eee7522bcbad231b54 | refs/heads/master | 2020-04-02T01:59:37.185990 | 2018-10-20T08:33:21 | 2018-10-20T08:33:21 | 153,885,598 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,529 | swift | //
// DataServices.swift
// LoadImageURL
//
// Created by Trung on 10/15/18.
// Copyright © 2018 TrungCatun. All rights reserved.
//
import Foundation
//extension Notification.Name {
// static let didGetData = Notification.Name("didGetData")
// static let didGetError = Notification.Name("didGetError")
//
//}
class DataServices {
static var shared = DataServices()
var cache = NSCache<NSString, NSData>()
func getImage(urlString: String, completeHandler: @escaping (Data) -> Void , errorHandler: @escaping () -> Void) {
if let imageData = cache.object(forKey: urlString as NSString) as Data? {
completeHandler(imageData)
} else {
getImageData(from: urlString, completeHandler: completeHandler, errorHandler: errorHandler)
}
}
private func getImageData(from urlString: String, completeHandler: @escaping (Data) -> Void, errorHandler: @escaping () -> Void) {
let imageUrl: URL = URL(string: urlString)!
URLSession.shared.dataTask(with: imageUrl) { (data, response, error) in
guard error == nil, data != nil else {
print(error!.localizedDescription)
errorHandler()
return
}
DispatchQueue.main.async {
self.cache.setObject(data! as NSData, forKey: urlString as NSString)
completeHandler(data!)
}
}.resume()
}
}
| [
-1
] |
390c3d15e47ddf0e25534ad5f57873d570449677 | 12d757780f1b92755d90243b6ec62e96ee6eb319 | /testfilms/VideoVC.swift | 3c8e55843fb6863ca903559f93dee413a25131a8 | [] | no_license | virusnik/test_films | 0436f6481132ff28e29873937935e54b01d85a45 | e585e839e125115b46e5d59c2c89b30d7801deec | refs/heads/master | 2020-03-30T15:48:56.656598 | 2018-10-03T09:15:34 | 2018-10-03T09:15:34 | 151,380,218 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,409 | swift | //
// VideoVC.swift
// testfilms
//
// Created by Sergio Veliz on 10/1/18.
// Copyright © 2018 Sergio Veliz. All rights reserved.
//
import UIKit
class VideoVC: UIViewController {
private let categories = ["Megogo", "Amediateka", "ivi"]
private var tableView: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
self.view.backgroundColor = UIColor.black
self.title = "Video"
let barHeight: CGFloat = UIApplication.shared.statusBarFrame.size.height
let displayWidth: CGFloat = self.view.frame.width
let displayHeight: CGFloat = self.view.frame.height
tableView = UITableView(frame: CGRect(x: 0, y: barHeight,
width: displayWidth,
height: displayHeight - barHeight))
tableView.register(CategoryRow.self, forCellReuseIdentifier: "CategoryRow")
tableView.dataSource = self
tableView.delegate = self
self.view.addSubview(tableView)
}
/*
// 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.
}
*/
}
extension VideoVC: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
return categories[section]
}
func numberOfSections(in tableView: UITableView) -> Int {
return categories.count
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "CategoryRow", for: indexPath) as! CategoryRow
cell.backgroundColor = UIColor.black
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 180
}
}
| [
-1
] |
abd6fe2662724c2d68fb6a75901a9941df357bdb | 253c58ee9fa7ac2db7499790c9985f039d2f7919 | /LimoService/MapLocationSelectViewController.swift | df3052f75ff5291bec5544f2d4533ab30bf5b530 | [
"MIT"
] | permissive | sameertotey/LimoService | 3f301c020b147bdde0612021c6848b72fdde24eb | 9f026779a5929de252b4731e55df65303baf57cf | refs/heads/master | 2021-01-24T06:21:58.939551 | 2015-05-21T13:14:16 | 2015-05-21T13:14:16 | 32,677,161 | 2 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 36,242 | swift | //
// MapLocationSelectViewController.swift
// LimoService
//
// Created by Sameer Totey on 4/19/15.
// Copyright (c) 2015 Sameer Totey. All rights reserved.
//
import UIKit
import MapKit
import AddressBookUI
class MapLocationSelectViewController: UIViewController, MKMapViewDelegate, CLLocationManagerDelegate, RequestInfoDelegate, UITextFieldDelegate {
weak var currentUser: PFUser!
var userRole = ""
@IBOutlet weak var mapView: MKMapView!
var locationManager: CLLocationManager?
var locationPin: LocationPin? {
didSet {
println(locationPin)
}
}
var locationMapPinView: LocationMapPinView?
var fromPin: LocationPin!
var toPin: LocationPin!
var locationMapPinViewRect: CGRect?
var locatingUser = false
var mapRendered = false
var requestInfo: RequestInfoViewController!
static var geoCoder: CLGeocoder = {
return CLGeocoder()
}()
var locationTitle = ""
var locationSubtitle = ""
var address = ""
// bar button items
var saveBarButton: UIBarButtonItem!
var editBarButton: UIBarButtonItem!
var doneBarButton: UIBarButtonItem!
var menuBarButtonItem: UIBarButtonItem!
lazy var modalTransitioningDelegate = ModalPresentationTransitionVendor()
@IBOutlet weak var navToUserLocationButton: UIButton!
@IBOutlet weak var requestInfoViewHeightConstraint: NSLayoutConstraint!
var requestInfoDate: NSDate?
var requestInfoDateString: String!
var numPassengers = 1
var numBags = 0
var preferredVehicle = "Limo"
var specialComments = ""
var fromLocation: LimoUserLocation? {
didSet {
if let mapView = mapView {
if let fromLocation = fromLocation {
if fromLocation.isDataAvailable() {
self.updateFromPin()
self.adjustMap()
} else {
fromLocation.fetchInBackgroundWithBlock({ (object, error) in
self.updateFromPin()
self.adjustMap()
})
}
} else {
if fromPin.coordinateSet {
mapView.removeAnnotation(fromPin)
fromPin.coordinateReset()
}
}
}
}
}
var toLocation: LimoUserLocation? {
didSet {
if let mapView = mapView {
if let toLocation = toLocation {
if toLocation.isDataAvailable() {
self.makeDestinationPin()
self.adjustMap()
} else {
toLocation.fetchInBackgroundWithBlock({ (object, error) in
self.makeDestinationPin()
self.adjustMap()
})
}
} else {
if toPin.coordinateSet {
mapView.removeAnnotation(toPin)
toPin.coordinateReset()
}
}
}
}
}
var locationFieldActive: ActiveField?
var limoRequest: LimoRequest? {
didSet {
fromLocation = nil
toLocation = nil
resetUI()
updateUI()
}
}
@IBOutlet var pinchGestureRecognizer: UIPinchGestureRecognizer!
@IBOutlet var panGestureRecognizer: UIPanGestureRecognizer!
@IBOutlet var tapGestureRecognizer: UITapGestureRecognizer!
@IBOutlet var rotationGestureRecognizer: UIRotationGestureRecognizer!
func updateUI() {
if let mapView = mapView {
switch CLLocationManager.authorizationStatus() {
case .AuthorizedAlways, .AuthorizedWhenInUse:
showUserLocationOnMapView()
default:
break // do nothing
}
requestInfo?.limoRequest = limoRequest
if limoRequest == nil {
navigationItem.rightBarButtonItem = nil
if mapView.userLocation.location != nil && fromLocation == nil {
mapView.setCenterCoordinate(mapView.userLocation.location.coordinate, animated: true)
createLocationPin(mapView.userLocation.location.coordinate)
}
adjustMap()
createRequestButton.setTitle("Create Request", forState: .Normal)
} else {
navigationItem.rightBarButtonItem = nil
toLocation = limoRequest?.to
fromLocation = limoRequest?.from
createRequestButton.setTitle("Start New Request", forState: .Normal)
}
}
}
// MARK: View Life Cycle
override func viewDidLoad() {
super.viewDidLoad()
/* Are location services available on this device? */
if CLLocationManager.locationServicesEnabled(){
/* Do we have authorization to access location services? */
switch CLLocationManager.authorizationStatus(){
case .Denied:
/* No */
displayAlertWithTitle("Not Authorized",
message: "Location services are not allowed for this app")
case .NotDetermined:
/* We don't know yet, we have to ask */
println("Location Services status unknown")
locationManager = CLLocationManager()
if let manager = locationManager {
manager.delegate = self
manager.desiredAccuracy = kCLLocationAccuracyKilometer
// Set a movement threshold for new events.
manager.distanceFilter = 500; // meters
manager.requestWhenInUseAuthorization()
}
case .Restricted:
/* Restrictions have been applied, we have no access
to location services */
displayAlertWithTitle("Restricted",
message: "Location services are not allowed for this app")
default:
println("We have authorization to display location")
// if locationManager == nil {
// locationManager = CLLocationManager()
// }
// if let manager = locationManager {
// manager.delegate = self
// manager.desiredAccuracy = kCLLocationAccuracyKilometer
// // Set a movement threshold for new events.
// manager.distanceFilter = 500; // meters
// manager.startUpdatingLocation()
// }
showUserLocationOnMapView()
}
} else {
/* Location services are not enabled.
Take appropriate action: for instance, prompt the
user to enable the location services */
println("Location services are not enabled")
displayAlertWithTitle("Location Services Needed", message: "Please enable location Services for the device")
}
mapView.scrollEnabled = false
mapView.zoomEnabled = false
mapView.rotateEnabled = false
// Search is now just presenting a view controller. As such, normal view controller
// presentation semantics apply. Namely that presentation will walk up the view controller
// hierarchy until it finds the root view controller or one that defines a presentation context.
definesPresentationContext = false
// Do any additional setup after loading the view.
let menuImage = UIImage(named: "Menu")
let menuButton = UIButton.buttonWithType(.System) as! UIButton
menuButton.setImage(menuImage, forState: .Normal)
menuButton.frame = CGRectMake(0, 0, 24, 24)
menuButton.addTarget(self, action: "mainMenu", forControlEvents: .TouchUpInside)
menuBarButtonItem = UIBarButtonItem(customView: menuButton)
let pencilImage = UIImage(named: "Pencil")
let pencilButton = UIButton.buttonWithType(.System) as! UIButton
pencilButton.setImage(pencilImage, forState: .Normal)
pencilButton.frame = CGRectMake(0, 0, 24, 24)
pencilButton.addTarget(self, action: "editButton", forControlEvents: .TouchUpInside)
editBarButton = UIBarButtonItem(customView: menuButton)
saveBarButton = UIBarButtonItem(barButtonSystemItem: .Save, target: self, action: "saveButton")
doneBarButton = UIBarButtonItem(barButtonSystemItem: .Done, target: self, action: "doneButton")
// navigationItem.rightBarButtonItem = menuBarButtonItem
navigationItem.leftBarButtonItem = menuBarButtonItem
makeToFromPins()
}
func mainMenu() {
println("main menu")
if userRole == "provider" {
performSegueWithIdentifier(UIStoryboardConstants.showProviderMenu, sender: nil)
} else {
performSegueWithIdentifier(UIStoryboardConstants.showConsumerMenu, sender: nil)
}
}
func saveButton() {
println("save button")
requestInfo.datePickerHidden = true
}
func doneButton() {
println("done button")
limoRequest = nil
}
func editButton() {
println("edit button")
}
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
updateUI()
}
override func viewDidDisappear(animated: Bool) {
super.viewDidDisappear(animated)
mapView.showsUserLocation = false
}
override func prefersStatusBarHidden() -> Bool {
return false
}
//destroy the location manager
deinit {
locationManager?.delegate = nil
locationManager = nil
}
override func shouldAutorotate() -> Bool {
return false
}
override func supportedInterfaceOrientations() -> Int {
return Int(UIInterfaceOrientationMask.Portrait.rawValue)
}
// MARK: - RequestInfoDelegate
func dateUpdated(newDate: NSDate, newDateString: String) -> Void {
requestInfoDate = newDate
requestInfoDateString = newDateString
}
func neededHeight(height: CGFloat) -> Void {
requestInfoViewHeightConstraint.constant = height
if requestInfo.datePickerHidden {
navigationItem.rightBarButtonItem = nil
} else {
navigationItem.rightBarButtonItem = saveBarButton
}
}
func textFieldActivated(field: ActiveField) {
locationFieldActive = field
performSegueWithIdentifier(UIStoryboardConstants.showLocationSearch, sender: nil)
}
func displayViewTapped() {
performSegueWithIdentifier(UIStoryboardConstants.showRequestDetail, sender: nil)
}
// MARK: - MKMapViewDelegate
func mapView(mapView: MKMapView!, viewForAnnotation annotation: MKAnnotation!) -> MKAnnotationView! {
if annotation is MKUserLocation {
// just skip the user location annotation and use the defaults
return nil
}
var view = mapView.dequeueReusableAnnotationViewWithIdentifier(Constants.AnnotationViewReuseIdentifier)
if view == nil {
view = LocationMapPinView(annotation: annotation, reuseIdentifier: Constants.AnnotationViewReuseIdentifier)
} else {
view.annotation = annotation
}
view.canShowCallout = true
view.draggable = false
view.leftCalloutAccessoryView = nil
view.rightCalloutAccessoryView = nil
if annotation is LocationPin {
if let kind = (annotation as? LocationPin)?.kind {
switch kind {
case .Selector:
if view is LocationMapPinView {
locationMapPinView = view as? LocationMapPinView
locationMapPinView!.pinColor = .Purple
}
// var fromButton = UIButton.buttonWithType(.Custom) as! UIButton
// fromButton.setImage(UIImage(named: "FromPin"), forState: .Normal)
// fromButton.setTitle("Set Pickup", forState: .Normal)
// fromButton.setTitleColor(UIColor.blueColor(), forState: .Normal)
// fromButton.sizeToFit()
// view.leftCalloutAccessoryView = fromButton
// var toButton = UIButton.buttonWithType(.Custom) as! UIButton
// toButton.setImage(UIImage(named: "ToPin"), forState: .Normal)
// toButton.setTitle("Destination", forState: .Normal)
// toButton.setTitleColor(UIColor.blueColor(), forState: .Normal)
// toButton.sizeToFit()
// view.rightCalloutAccessoryView = toButton
case .From:
(view as? LocationMapPinView)?.pinColor = .Green
case .To:
(view as? LocationMapPinView)?.pinColor = .Red
}
}
}
return view
}
func mapView(mapView: MKMapView!, didSelectAnnotationView view: MKAnnotationView!) {
println("didSelectAnnotationView")
}
func mapView(mapView: MKMapView!, annotationView view: MKAnnotationView!, calloutAccessoryControlTapped control: UIControl!) {
println("control tapped \(control.dynamicType) \(control is UIButton)")
}
func mapViewWillStartLocatingUser(mapView: MKMapView!) {
println("will start locating the user")
locatingUser = true
}
func mapView(mapView: MKMapView!, didUpdateUserLocation userLocation: MKUserLocation!) {
println("received user location update")
// we only create a locationPin if it is nil
createLocationPin(userLocation.location.coordinate)
}
func mapViewDidFinishRenderingMap(mapView: MKMapView!, fullyRendered: Bool) {
updateUI()
mapView.scrollEnabled = true
// mapView.zoomEnabled = true
mapView.rotateEnabled = true
mapRendered = true
}
func mapView(mapView: MKMapView!, regionWillChangeAnimated animated: Bool) {
println("region will change")
if fromLocation == nil {
mapView.removeAnnotation(locationPin)
if let locationMapPinView = locationMapPinView {
locationMapPinViewRect = mapView.convertRect(locationMapPinView.frame, toView: mapView)
locationMapPinView.frame = locationMapPinViewRect!
mapView.addSubview(locationMapPinView)
println("did add subview")
}
}
}
func mapView(mapView: MKMapView!, regionDidChangeAnimated animated: Bool) {
println("region did change")
if fromLocation == nil {
locationPin?.coordinate = mapView.centerCoordinate
if locationMapPinView?.annotation === locationPin {
// only remove the view if it is still attached to this annotation (it can be reused for another annotation)
locationMapPinView?.removeFromSuperview()
}
mapView.addAnnotation(locationPin)
if mapRendered {
reverseGeoCode(mapView.centerCoordinate)
}
}
}
func reverseGeoCode(locationCoordinate: CLLocationCoordinate2D) {
// cancel previous in flight geocoding
if MapLocationSelectViewController.geoCoder.geocoding {
MapLocationSelectViewController.geoCoder.cancelGeocode()
}
let location = CLLocation(latitude: locationCoordinate.latitude, longitude: locationCoordinate.longitude)
// add minimal delay to search to avoid searching for something outdated
cancelDelayed("geocode")
delayed(0.1, name: "geocode") {
self.performReverseGeoCode(location)
}
}
typealias Closure = ()->()
var closures = [String: Closure]()
func delayed(delay: Double, name: String, closure: Closure) {
// store the closure to execute in the closures dictionary
closures[name] = closure
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(delay * Double(NSEC_PER_SEC))),
dispatch_get_main_queue()) {
if let closure = self.closures[name] {
closure()
self.closures[name] = nil
}
}
}
func cancelDelayed(name: String) {
closures[name] = nil
}
func performReverseGeoCode(location: CLLocation) {
UIApplication.sharedApplication().networkActivityIndicatorVisible = true
MapLocationSelectViewController.geoCoder.reverseGeocodeLocation(location)
{ placemarks, error in
if error == nil {
if let firstPlacemark = placemarks.first as? CLPlacemark {
self.locationTitle = firstPlacemark.name
let addressString = ABCreateStringWithAddressDictionary(firstPlacemark.addressDictionary, false)
let addressComponents = addressString.componentsSeparatedByString("\n")
if addressComponents.count >= 2 {
self.locationSubtitle = addressComponents[1]
}
// self.locationSubtitle = (ABCreateStringWithAddressDictionary(firstPlacemark.addressDictionary, false) as String).componentsSeparatedByString("\n")[1]
// self.address = String(map((ABCreateStringWithAddressDictionary(firstPlacemark.addressDictionary, false) as String).generate()) {
// $0 == "\n" ? "," : $0
// })
self.address = ABCreateStringWithAddressDictionary(firstPlacemark.addressDictionary, false)
}
if let locationPin = self.locationPin {
locationPin.title = self.locationTitle
locationPin.subtitle = self.locationSubtitle
locationPin.address = self.address
// only select the locationPin if it is already added to the mapView
for annotation in self.mapView.annotations {
if annotation === locationPin {
self.mapView.selectAnnotation(locationPin, animated: true)
}
}
}
} else {
println("Error in geocoding: \(error)")
}
UIApplication.sharedApplication().networkActivityIndicatorVisible = false
}
}
//MARK: - Gesture Recognizer Actions
@IBAction func pinchGesture(sender: UIPinchGestureRecognizer) {
// mapView.transform = CGAffineTransformScale(mapView.transform, sender.scale, sender.scale)
var originalRegion: MKCoordinateRegion
originalRegion = mapView.region
var latdelta = originalRegion.span.latitudeDelta / Double(sender.scale)
var londelta = originalRegion.span.longitudeDelta / Double(sender.scale)
latdelta = max(min(latdelta, 80), 0.002)
londelta = max(min(londelta, 80), 0.002)
let span = MKCoordinateSpanMake(latdelta, londelta)
mapView.region = MKCoordinateRegionMake(originalRegion.center, span)
sender.scale = 1
}
@IBAction func panGesture(sender: UIPanGestureRecognizer) {
// let translation = sender.translationInView(view)
// println("translation is \(translation)")
// if let mapview = sender.view {
// let oldCenter = mapView.convertCoordinate(mapView.centerCoordinate, toPointToView: mapView)
// let newCenter = CGPoint(x:oldCenter.x - translation.x,
// y:oldCenter.y - translation.y)
// mapView.centerCoordinate = mapView.convertPoint(newCenter, toCoordinateFromView: mapView)
// }
// sender.setTranslation(CGPointZero, inView: view)
}
@IBAction func tapGesture(sender: UITapGestureRecognizer) {
var originalRegion: MKCoordinateRegion
originalRegion = mapView.region
var latdelta = originalRegion.span.latitudeDelta / 1.2
var londelta = originalRegion.span.longitudeDelta / 1.2
// // TODO: set these constants to appropriate values to set max/min zoomscale
latdelta = max(min(latdelta, 80), 0.005)
londelta = max(min(londelta, 80), 0.005)
let span = MKCoordinateSpanMake(latdelta, londelta)
mapView.region = MKCoordinateRegionMake(originalRegion.center, span)
}
@IBAction func rotationGesture(sender: UIRotationGestureRecognizer) {
// let the mapview handle the rotations
}
// MARK: - LocationManager Delegate
/* The authorization status of the user has changed, we need to react
to that so that if she has authorized our app to to view her location,
we will accordingly attempt to do so */
func locationManager(manager: CLLocationManager!, didChangeAuthorizationStatus status: CLAuthorizationStatus){
print("The authorization status of location services is changed to: ")
switch CLLocationManager.authorizationStatus(){
case .Denied:
println("Denied")
case .NotDetermined:
println("Not determined")
case .Restricted:
println("Restricted")
default:
showUserLocationOnMapView()
println("Now you have the authorization for location services.")
// manager.startUpdatingLocation()
}
}
func locationManager(manager: CLLocationManager!, didUpdateLocations locations: [AnyObject]!) {
println("Location manager did update locations")
// if let newLocation = locations.last as? CLLocation {
// if locationPin == nil {
// createLocationPin(newLocation.coordinate)
// } else {
// locationPin?.coordinate = newLocation.coordinate
// if locatingUser {
// manager.stopUpdatingLocation() // There is no reason to continue doing this now
// }
// }
// }
}
func locationManager(manager: CLLocationManager!, didFailWithError error: NSError!){
println("Location manager failed with error = \(error)")
}
@IBAction func navToUserLocation() {
mapView.setCenterCoordinate(mapView.userLocation.coordinate, animated: true)
locationPin?.coordinate = mapView.userLocation.coordinate
}
// MARK: - Constants
private struct Constants {
static let AnnotationViewReuseIdentifier = "location"
static let ShowImageSegue = "Show Image"
}
func getFromLocation() -> LimoUserLocation {
var from: LimoUserLocation!
if fromLocation == nil {
// if fromLocation == nil || fromLocation!.name != locationPin?.title || fromLocation!.address != locationPin?.address {
from = LimoUserLocation(className: LimoUserLocation.parseClassName())
let geoPoint = PFGeoPoint(location: locationPin?.location)
from["location"] = geoPoint
from["owner"] = currentUser
from["name"] = locationPin?.title
from["address"] = locationPin?.address
} else {
from = fromLocation!
}
return from
}
@IBOutlet weak var createRequestButton: ActionButton!
@IBAction func createRequestButtonTouched(sender: ActionButton) {
if let title = sender.titleForState(.Normal) {
switch title {
case "Create Request":
createTheRequest()
case "Start New Request":
doneButton()
default:
break
}
}
}
func createTheRequest() {
println("create the request")
let from = getFromLocation()
let limoRequest = LimoRequest(className: LimoRequest.parseClassName())
limoRequest["from"] = from
limoRequest["fromAddress"] = from["address"]
limoRequest["fromName"] = from["name"]
if let to = toLocation {
limoRequest["to"] = to
limoRequest["toAddress"] = to["address"]
limoRequest["toName"] = to["name"]
}
limoRequest["owner"] = currentUser
limoRequest["status"] = "New"
limoRequest["when"] = requestInfoDate
limoRequest["whenString"] = requestInfoDateString
limoRequest["numPassengers"] = numPassengers
limoRequest["numBags"] = numBags
limoRequest["preferredVehicle"] = preferredVehicle
limoRequest["comment"] = specialComments
limoRequest.saveInBackgroundWithBlock {[unowned self](succeeded, error) in
if succeeded {
println("Succeed in creating a limo request: \(limoRequest)")
let controller = UIAlertController(title: "Request Created", message: "Your limo request has been saved", preferredStyle: .Alert)
controller.addAction(UIAlertAction(title: "OK", style: .Default) {[unowned self] _ in
println("request created")
self.limoRequest = limoRequest
// self.scheduleLocalNotification()
// self.performSegueWithIdentifier("Show Created Request", sender: limoRequest)
// self.resetFields()
})
self.navigationController?.presentViewController(controller, animated: true, completion: nil)
} else {
println("Received error while creating the request: \(error)")
}
}
}
/*
// MARK: - Create the Request
func createTheRequest() {
if let from = fromLocation {
} else {
displayAlertWithTitle("Incomplete Request", message: "Need 'From' Location")
}
}
func scheduleLocalNotification() {
var localNotification = UILocalNotification()
localNotification.fireDate = NSCalendar.currentCalendar().dateByAddingUnit(NSCalendarUnit.CalendarUnitMinute, value: -2, toDate: whenCell.date!, options: nil)!
localNotification.timeZone = NSTimeZone.localTimeZone()
localNotification.alertBody = "Limo service due soon"
UIApplication.sharedApplication().scheduleLocalNotification(localNotification)
}
*/
// MARK: - Helpers
/* Just a little method to help us display alert dialogs to the user */
func displayAlertWithTitle(title: String, message: String){
let controller = UIAlertController(title: title, message: message, preferredStyle: .Alert)
controller.addAction(UIAlertAction(title: "OK", style: .Default, handler: nil))
controller.addAction(UIAlertAction(title: "Settings", style: .Default) { _ in
UIApplication.sharedApplication().openURL(NSURL(string: UIApplicationOpenSettingsURLString)!)
})
presentViewController(controller, animated: true, completion: nil)
}
func adjustMap() {
var annotations = [MKAnnotation]()
if mapView.userLocation.location != nil {
annotations.append(mapView.userLocation)
println("mapview location is \(mapView.userLocation.location.coordinate.latitude) : \(mapView.userLocation.location.coordinate.longitude)")
}
if limoRequest == nil {
if let locationPinSet = locationPin?.coordinateSet where locationPinSet {
annotations.append(locationPin!)
}
}
if fromPin.coordinateSet {
annotations.append(fromPin)
}
if toPin.coordinateSet {
annotations.append(toPin)
}
println("annotations count: \(annotations.count)")
println("annotations are: \(annotations)")
var zoomRect = MKMapRectNull
for annotation in annotations {
if annotation is LocationPin {
println((annotation as! LocationPin).kind)
}
print(annotation.coordinate.latitude)
println(annotation.coordinate.longitude)
let annotationPoint = MKMapPointForCoordinate(annotation.coordinate)
let pointRect = MKMapRectMake(annotationPoint.x, annotationPoint.y, 0.1, 0.1)
zoomRect = MKMapRectUnion(zoomRect, pointRect)
}
let newRegion = MKCoordinateRegionForMapRect(zoomRect)
var latdelta = newRegion.span.latitudeDelta * 2.2 // zoom out the region
var londelta = newRegion.span.longitudeDelta * 2.2
let span = MKCoordinateSpanMake(max(latdelta, 0.02), max(londelta, 0.02))
println(" 1 lat = \(span.latitudeDelta) : long = \(span.longitudeDelta)")
mapView.region = MKCoordinateRegionMake(mapView.centerCoordinate, span)
}
func resetUI() {
mapView?.removeAnnotations(mapView.annotations)
locationPin = nil
locationMapPinView?.removeFromSuperview()
locationMapPinView = nil
makeToFromPins()
requestInfoDate = NSDate()
requestInfoDateString = ""
numPassengers = 1
numBags = 0
specialComments = ""
}
/* We will call this method when we are sure that the user has given
us access to her location */
func showUserLocationOnMapView(){
mapView.showsUserLocation = true
if fromLocation == nil {
mapView.userTrackingMode = .Follow
}
}
func createLocationPin(coordinate: CLLocationCoordinate2D) {
if locationPin == nil && limoRequest == nil && mapRendered && fromLocation == nil {
println("created the locationPin")
locationPin = LocationPin()
locationPin?.kind = .Selector
locationPin?.coordinate = coordinate
mapView.addAnnotation(locationPin)
}
}
func removeLocationPin() {
if locationMapPinView?.annotation === locationPin {
// only remove the view if it is still attached to this annotation (it can be reused for another annotation)
locationMapPinView?.removeFromSuperview()
}
mapView.removeAnnotation(locationPin)
locationPin = nil
mapView.userTrackingMode = .None
}
func makeDestinationPin() {
if let toLocation = toLocation {
if toPin.coordinateSet {
mapView.removeAnnotation(toPin)
}
if let location = toLocation["location"] as? PFGeoPoint {
println("\(NSDate()) \(__FILE__) \(__FUNCTION__) \(__LINE__)")
toPin.coordinate = CLLocationCoordinate2D(latitude: location.latitude, longitude: location.longitude)
if let toName = toLocation["name"] as? String, toAddress = toLocation["address"] as? String {
toPin.title = toName
toPin.subtitle = toAddress.fullAddressString(toName)
}
mapView.addAnnotation(toPin)
mapView.centerCoordinate = toPin.coordinate
requestInfo.toTextField.text = toPin.title
if fromPin.coordinateSet {
removeLocationPin()
}
}
}
}
func updateFromPin() {
if let fromLocation = fromLocation {
if fromPin.coordinateSet {
mapView.removeAnnotation(fromPin)
}
if let location = fromLocation["location"] as? PFGeoPoint {
println("\(NSDate()) \(__FILE__) \(__FUNCTION__) \(__LINE__)")
fromPin.coordinate = CLLocationCoordinate2D(latitude: location.latitude, longitude: location.longitude)
if let fromName = fromLocation["name"] as? String, fromAddress = fromLocation["address"] as? String {
fromPin.title = fromName
fromPin.subtitle = fromAddress.fullAddressString(fromName)
}
mapView.addAnnotation(fromPin)
mapView.centerCoordinate = fromPin.coordinate
if toPin.coordinateSet {
removeLocationPin()
}
requestInfo.fromTextField.text = fromPin.title
}
}
}
func makeToFromPins() {
toPin = LocationPin()
toPin.kind = .To
fromPin = LocationPin()
fromPin.kind = .From
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
println("prepare for segue")
if let identifier = segue.identifier {
switch identifier {
case UIStoryboardConstants.showLocationSearch:
if segue.destinationViewController is LocationSelectionViewController {
let toVC = segue.destinationViewController as! LocationSelectionViewController
toVC.searchRegion = mapView.region
toVC.searchText = locationTitle
}
case UIStoryboardConstants.showConsumerMenu:
println("segue to consumer menu")
if segue.destinationViewController is CustomerMenuViewController {
let toVC = segue.destinationViewController as! CustomerMenuViewController
toVC.listner = self
toVC.modalPresentationStyle = .Custom
toVC.transitioningDelegate = self.modalTransitioningDelegate
}
case UIStoryboardConstants.showProviderMenu:
println("segue to provider menu")
if segue.destinationViewController is ProviderMenuViewController {
let toVC = segue.destinationViewController as! ProviderMenuViewController
toVC.listner = self
toVC.modalPresentationStyle = .Custom
toVC.transitioningDelegate = self.modalTransitioningDelegate
}
case UIStoryboardConstants.requestInfo:
if segue.destinationViewController is RequestInfoViewController {
requestInfo = segue.destinationViewController as! RequestInfoViewController
requestInfo.delegate = self
requestInfo.limoRequest = limoRequest
}
case UIStoryboardConstants.showRequestDetail:
if segue.destinationViewController is RequestDetailTableViewController {
let toVC = segue.destinationViewController as! RequestDetailTableViewController
toVC.limoRequest = limoRequest
}
default:
break
}
}
}
// unwind from a location selection
@IBAction func unwindToMapSelection(sender: UIStoryboardSegue)
{
// Pull any data from the view controller which initiated the unwind segue.
if let sVC = sender.sourceViewController as? LocationSelectionViewController {
switch locationFieldActive! {
case .From:
fromLocation = sVC.selectedLocation
case .To:
toLocation = sVC.selectedLocation
}
}
}
private struct UIStoryboardConstants {
static let showLocationSearch = "Show Location Search"
static let showConsumerMenu = "Show Consumer Menu"
static let showProviderMenu = "Show Provider Menu"
static let requestInfo = "Request Info"
static let showRequestDetail = "Show Request Detail"
}
}
| [
-1
] |
88534b40cbad8c7139d73fd4118b24838caa9d16 | 4cdf6ff6a02ae2000f5c0a283d4b9fc0fcad4b85 | /QSC_Swift/QSC_Swift/Home/QSCHomeNavigationViewController.swift | bde6f116bb46d2a12b943be0b30832a263ace5ee | [] | no_license | xiaoweiFive/my_swift_qsc | a71389bfaaab2d3564f0493d047c885734a40784 | 34fdcb58d2be89d316e9dea29bc03e39d1ada480 | refs/heads/master | 2021-01-19T23:24:51.177434 | 2018-08-02T06:09:38 | 2018-08-02T06:09:38 | 88,974,507 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 9,949 | swift | //
// QSCHomeNavigationViewController.swift
// QSC_Swift
//
// Created by zhangzhenwei on 17/4/20.
// Copyright © 2017年 QSC. All rights reserved.
//
import UIKit
import SwiftyJSON
import MJRefresh
class QSCHomeNavigationViewController: UIViewController{
let homeCategoryCellID = "QSCHomeCategoryTableViewCell"
var middelButton:UIButton?
var circleView: CirCleView!
var bannerModel = Array<QSCHomeListDesc>()
var bannerCell:ZZWHomeBannerTableViewCell?
//imageArray
var idleImages:NSMutableArray = []
var objectArr = [String]()
var refreshingImages:NSMutableArray = []
override func viewDidLoad() {
super.viewDidLoad()
self.automaticallyAdjustsScrollViewInsets = false
// QSC_MJRefreshGifTool.MJRefreshGifCustomBlock(tableView:tableView) {
// sleep(2)
// self.requestData()
// print("010010101010010101010101001010")
// }
self.view.addSubview(tableView)
let header = QSCRefreshGifHeader.headerWithRefreshingBlock {
self.requestData()
print("909090909090909090909000900909090")
}
self.tableView.QSC_footer = QSCRefreshNormalFooter.footerWithRefreshingBlock {
self.requestData()
print("000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")
};
self.tableView.QSC_header = header;
self.circleView = CirCleView(frame: CGRect(x: 0, y: -0.5, width: self.view.frame.size.width, height: 160*RATE))
circleView.delegate = self
self.view.addSubview(circleView)
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.navigationController?.navigationBar.isHidden = true
self.requestData()
}
lazy var tableView:UITableView = {
let tableView = UITableView.init(frame: CGRect.init(x: 0, y: 0, width: SCREEN_WIDTH, height: SCREEN_HEIGHT-49), style: .plain)
tableView.backgroundColor = ZZWGrayColor
tableView.delegate = self
tableView.dataSource = self
tableView.separatorStyle = .none
tableView.scrollsToTop = true
tableView.contentInset = UIEdgeInsetsMake(160*RATE, 0, 0, 0 )
return tableView
}()
lazy var indexModelArray:NSMutableArray = {
let indexmodelArray:NSMutableArray = []
return indexmodelArray
}()
lazy var bannerImageArray:[String] = {
let indexmodelArray:[String] = []
return indexmodelArray
}()
func requestData() {
ZZWHttpTools.share.getWithPath(path: "http://index.qschou.com/v2.1.1/home", parameters: nil, success: { (json) in
print(json)
if(self.indexModelArray.count > 0){
self.indexModelArray.removeAllObjects()
}
for (_,subJosn):(String,JSON) in json["data"]{
let topic = QSCHomeModel.init(dict: subJosn)
self.indexModelArray.add(topic)
if topic.area == "banner" {
let header = topic.list
self.bannerImageArray.removeAll()
self.bannerModel = header
for desc in header{
self.bannerImageArray.append(desc.image!)
}
self.circleView.urlImageArray = self.bannerImageArray
}
}
self.tableView.QSC_header?.endRefresing()
self.tableView.QSC_footer?.endRefresing()
self.tableView.reloadData()
}) { (error) in
print(error)
// self.tableView.mj_header.endRefreshing()
}
}
}
extension QSCHomeNavigationViewController:CirCleViewDelegate{
func clickCurrentImage(_ currentIndxe: Int) {
let model = self.bannerModel[currentIndxe]
print(model.url ?? "无url");
}
}
extension QSCHomeNavigationViewController:UIScrollViewDelegate{
func scrollViewDidScroll(_ scrollView: UIScrollView) {
if !scrollView.isKind(of: UITableView.self) {
return
}
let offsetY = scrollView.contentOffset.y
// if offsetY < 0 {
// UIApplication.shared.statusBarStyle = .lightContent
// }else {
// UIApplication.shared.statusBarStyle = .default
// }
if offsetY > -TYPE_BANNER_HEIGHT {
self.circleView.y = -TYPE_BANNER_HEIGHT - offsetY
}else if offsetY < -TYPE_BANNER_HEIGHT {
self.circleView.y = 0
}
}
}
// MARK: - UITableViewDataSource, UITableViewDelegate
extension QSCHomeNavigationViewController:UITableViewDelegate,UITableViewDataSource{
func numberOfSections(in tableView: UITableView) -> Int {
return self.indexModelArray.count;
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 2
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
let homeNavModel = self.indexModelArray[indexPath.section] as! QSCHomeModel
let margin_height = String.StringToFloat(str: homeNavModel.margin_bottom!)
if (indexPath.row == 1 && homeNavModel.area != "recommend-love-project"){
return margin_height
}
if homeNavModel.area == "nav" {
return 100
}
if homeNavModel.area == "banner" {
return 0;
}
if homeNavModel.area == "insurance" {
return 135;
}
if homeNavModel.area == "recommend" || homeNavModel.area == "sale-recommend" || homeNavModel.area == "love-recommend" || homeNavModel.area == "dream-recommend" {
return 207;
}
else if homeNavModel.area == "sale-nav" || homeNavModel.area == "dream-nav" {
return 90
}
return 44
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 0.01
}
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return 0.01
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
return nil
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
return nil
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let homeNavModel = self.indexModelArray[indexPath.section] as! QSCHomeModel
if indexPath.row == 0 && homeNavModel.area != "recommend-project" && indexPath.section>0 {
if homeNavModel.area == "nav" {
let cell = QSCHomeCategoryTableViewCell.cellWithTableView(tableView: tableView)
cell.homeNavModel = homeNavModel
return cell
}else if homeNavModel.area == "sale-nav" || homeNavModel.area == "dream-nav" {
let cell = QSCHomeNavTableViewCell.cellWithTableView(tableView: tableView)
cell.homeNavModel = homeNavModel
return cell
}else if homeNavModel.area == "insurance" {
let cell = QSCHomeInsuranceTableViewCell.cellWithTableView(tableView: tableView)
cell.homeNavModel = homeNavModel
return cell
}else if homeNavModel.area == "recommend" || homeNavModel.area == "dream-recommend" || homeNavModel.area == "sale-recommend" || homeNavModel.area == "love-recommend" {
let cell = QSCHomeRecommendTableViewCell.cellWithTableView(tableView: tableView)
cell.homeNavModel = homeNavModel
return cell
}
else if homeNavModel.area == "banner" {
return UITableViewCell()
}
}else if (indexPath.row == 1 && homeNavModel.area != "recommend-love-project"){
let heigh = String.StringToFloat(str: homeNavModel.margin_bottom!)
let footerView = QSCHomeFooterTableViewCell.cellWithTableView(tableView: tableView)
if heigh == 1 {
footerView.contentView.backgroundColor = UIColor.white
footerView.backView.backgroundColor = zzwColor(red: 229, green: 229, blue: 229, alpha: 1)
}else{
footerView.backView.backgroundColor = ZZWGrayColor
footerView.contentView.backgroundColor = ZZWGrayColor
}
return footerView
}
let identifier="identtifier";
var cell=tableView.dequeueReusableCell(withIdentifier: identifier)
if(cell == nil){
cell=UITableViewCell(style: UITableViewCellStyle.value1, reuseIdentifier: identifier);
}
cell?.selectionStyle = .none
cell?.textLabel?.text = "3243242342\(indexPath)";
cell?.detailTextLabel?.text = "待添加内容";
cell?.detailTextLabel?.font = UIFont .systemFont(ofSize: CGFloat(13))
cell?.accessoryType=UITableViewCellAccessoryType.disclosureIndicator
return cell!
}
}
| [
-1
] |
f8ca913429ae97ba38db61ace8426e3b4f786c31 | 74252b875756e90e35f74ce011e85d0a060f3df1 | /ButtonsUnderCells/AppDelegate.swift | 057dded0dfaa5b89a26d8db0e50cea181d2589c7 | [] | no_license | richrad/ButtonsUnderCells | 2aeec7bf31b30285206ad4e55c486c106665d859 | b1489c246644c227b38c3822cb546d69760d262f | refs/heads/master | 2019-01-19T06:29:45.538038 | 2015-07-22T22:43:56 | 2015-07-22T22:43:56 | 39,533,848 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,150 | swift | //
// AppDelegate.swift
// ButtonsUnderCells
//
// Created by Richard Allen on 7/22/15.
// Copyright (c) 2015 Lapdog. 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,
229426,
237618,
229428,
286774,
229432,
286776,
286778,
319544,
204856,
286791,
237640,
278605,
286797,
311375,
237646,
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,
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,
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,
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,
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,
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,
280671,
223327,
149599,
321634,
149601,
149603,
329830,
280681,
313451,
223341,
280687,
313458,
280691,
215154,
313464,
329850,
321659,
280702,
288895,
321670,
215175,
141446,
141455,
141459,
280725,
313498,
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,
306555,
290174,
298365,
224641,
281987,
298372,
314756,
281990,
224647,
265604,
298377,
314763,
142733,
298381,
224657,
306581,
314779,
314785,
282025,
314793,
282027,
241068,
241070,
241072,
282034,
241077,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
290291,
282101,
241142,
191992,
290298,
151036,
290302,
282111,
290305,
175621,
192008,
323084,
257550,
282127,
290321,
282130,
323090,
282133,
290325,
241175,
290328,
282137,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
282186,
224849,
282195,
282199,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
324757,
282261,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
306856,
282295,
282300,
323260,
323266,
282310,
323273,
282319,
306897,
241362,
282328,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
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,
226005,
119509,
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,
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,
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,
291754,
324527,
291760,
234417,
201650,
324531,
234414,
234422,
226230,
275384,
324536,
234428,
291773,
234431,
242623,
324544,
324546,
226239,
324548,
226245,
234437,
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,
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,
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,
259567,
308720,
226802,
316917,
308727,
292343,
300537,
316947,
308757,
308762,
284191,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
284213,
194101,
284215,
194103,
284218,
226877,
284223,
284226,
243268,
292421,
226886,
284231,
128584,
284228,
284234,
276043,
317004,
366155,
284238,
226895,
284241,
194130,
284243,
276052,
284245,
276053,
284247,
317015,
284249,
243290,
284251,
300628,
284253,
235097,
284255,
300638,
243293,
284258,
292452,
292454,
284263,
177766,
284265,
292458,
284267,
292461,
284272,
284274,
276086,
284278,
292470,
292473,
284283,
276093,
284286,
276095,
284288,
292481,
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,
300828,
300830,
276255,
325408,
284449,
300834,
300832,
317221,
227109,
358183,
186151,
276268,
300845,
194351,
243504,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
300872,
153417,
284499,
276308,
284502,
317271,
178006,
276315,
292700,
284511,
227175,
292715,
300912,
284529,
292721,
300915,
284533,
292729,
317306,
284540,
292734,
325512,
169868,
276365,
284564,
358292,
284566,
350106,
284572,
276386,
284579,
276388,
358312,
284585,
317353,
276395,
292776,
292784,
276402,
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,
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,
227463,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
276638,
350366,
284837,
153765,
350375,
350379,
350381,
350383,
129200,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
309450,
301258,
276685,
276689,
309462,
301272,
276699,
309468,
194780,
309471,
301283,
317672,
276713,
317674,
325867,
243948,
194801,
227571,
309491,
276725,
309494,
243960,
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,
285474,
293666,
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,
294063,
228526,
294065,
302258,
277687,
294072,
318651,
294076,
277695,
318657,
244930,
302275,
130244,
302277,
228550,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
302296,
384222,
310498,
285927,
318698,
302315,
195822,
228592,
294132,
138485,
204023,
228601,
204026,
228606,
204031,
64768,
310531,
285958,
228617,
138505,
318742,
204067,
277798,
130345,
277801,
113964,
285997,
277804,
285999,
277807,
113969,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
417086,
277822,
286016,
294211,
302403,
277832,
384328,
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,
212472,
278009,
40440,
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,
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,
278274,
302852,
278277,
302854,
294664,
311048,
352008,
319243,
311053,
302862,
294682,
278306,
188199,
294701,
278320,
319280,
319290,
229192,
302925,
188247,
237409,
294776,
360317,
294785,
327554,
40840,
40851,
294803,
188312,
294811,
319390,
294817,
319394,
40865,
294821,
311209,
180142,
294831,
188340,
40886,
319419,
294844,
294847,
393177,
294876,
294879,
294883,
294890,
311279,
278513,
237555,
278516,
311283,
278519,
237562
] |
2d6f1002b20cf453849a7a989e1185a51a66ee23 | 05e982f02b82b132126bb548e1fd9aeaf18b9e6e | /LG CATS/All Code/Teachers/Event Manager/CIEventSubmitRosterVC.swift | d60ac8c9f73c9bbb9cafe6824023c0336c680bf7 | [] | no_license | shomilj/LGHS-iOS | 2c2caf89aa1ce73c6f7f9670e7c5415fc77b00ad | db048272a728a240197b0d3b223e20906f784a0d | refs/heads/master | 2021-09-25T10:03:45.414962 | 2018-10-20T17:29:22 | 2018-10-20T17:29:22 | 143,811,634 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,568 | swift | //
// CIEventSubmitRosterVC.swift
// Falcon
//
// Created by Shomil Jain on 7/24/18.
// Copyright © 2018 Avina Labs. All rights reserved.
//
import UIKit
import Firebase
class CIEventSubmitRosterVC: UIViewController {
@IBOutlet weak var submitButton: UIButton!
@IBOutlet weak var linkField: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
hideKeyboardWhenTappedAround()
self.view.tintColor = UIColor.primary
self.submitButton.layer.cornerRadius = 8
self.submitButton.backgroundColor = UIColor.primary
}
@IBAction func submitTapped(_ sender: Any) {
dismissKeyboard()
LoadingOverlay.shared.showOverlay(self.view)
guard let link = linkField.text else {
endWithError(message: "Please enter a link!")
return;
}
DispatchQueue.global(qos: .background).async {
self.process(link: link)
}
}
func process(link: String) {
guard let googleLink = Links.parseGoogleLink(rawLink: link) else {
endWithError(message: "Please enter a valid link!")
return;
}
Downloader.downloadTextFile(fromLink: googleLink) { (contentsUW) in
guard let contents = contentsUW else {
self.endWithError(message: "No data was found at this link. Please try again.")
return;
}
guard let tsv = Downloader.parseTSV(fromString: contents) else {
self.endWithError(message: "Please ensure that your link is valid and try again.")
return;
}
self.writeToDatabase(studentData: tsv)
}
}
struct TableStructure {
static var id = 0
static var firstName = 1
static var lastName = 2
static var COL_COUNT = 3
}
func writeToDatabase(studentData: [[String]]) {
var dict = [String: [String: Any]]()
for (index, row) in studentData.enumerated() {
if row.count != TableStructure.COL_COUNT {
endWithError(message: "Please check row \(index). We expected \(TableStructure.COL_COUNT) columns but received \(row.count) instead.")
return;
}
let id = row[TableStructure.id]
let first = row[TableStructure.firstName]
let last = row[TableStructure.lastName]
dict[id] = [Keys.Database.Event.name: first + " " + last,
Keys.Database.Event.checkedIn: false]
}
Database.database().reference()
.child(Keys.Database.version)
.child(Keys.Database.appData)
.child(Keys.Database.events)
.child(CIEvent.shared.getId())
.child(Keys.Database.Event.roster).setValue(dict)
endWithSuccess(message: "The student roster has successfully been imported! There are \(dict.count) students registered for this event. You may now begin to check students in.")
}
func endWithError(message: String) {
DispatchQueue.main.async {
LoadingOverlay.shared.hideOverlayView()
self.showError(message: message, title: "Error") {}
}
}
func endWithSuccess(message: String) {
DispatchQueue.main.async {
LoadingOverlay.shared.hideOverlayView()
self.showAlert(message: message, title: "Success!") {
_ = self.navigationController?.popViewController(animated: true)
}
}
}
}
| [
-1
] |
89d7a843fb205e62bb99081c147f8f8859812f25 | 99e26e543be6b43e39664a8a08a794f7839f938d | /ApiSample2/Controller/pages/Page5ViewController.swift | bd72fb0a09195f8979dfa48a5e409728d143de9f | [] | no_license | JunyaMotohashi/ApiSample2-main | 705dfa1267ae2b9d2415476db47c57c6b3b1c325 | 805e67b560e18766662a4ed867b9b0ce98dddb94 | refs/heads/main | 2023-03-22T10:37:42.003874 | 2021-03-01T08:19:56 | 2021-03-01T08:19:56 | 343,339,771 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,695 | swift | //
// Page1ViewController.swift
// ApiSample2
//
// Created by 本橋淳哉 on 2021/01/09.
//
import UIKit
import SegementSlide
class Page5ViewController: UITableViewController, SegementSlideContentScrollViewDelegate, XMLParserDelegate {
@objc var scrollView: UIScrollView {
return tableView
}
// XMLParsarのインスタンスを作成
var parsar = XMLParser()
// RSSのパース中の現在の要素名
var currentElementName : String?
var newsItemsArray = [NewsItems]()
override func viewDidLoad() {
super.viewDidLoad()
tableView.backgroundColor = .clear
// imageViewをtableViewの背景にする
let image = UIImage(named: "4")
let imageView = UIImageView(frame: CGRect(x: 0, y: 0, width: self.tableView.frame.size.width, height: self.tableView.frame.size.width))
imageView.image = image
self.tableView.backgroundView = imageView
// XMLパース
let urlString = "https://news.yahoo.co.jp/pickup/res.xml"
guard let url : URL = URL(string: urlString) else { return }
parsar = XMLParser(contentsOf: url)!
parsar.delegate = self
parsar.parse()
}
// MARK: - Table view data source
override func numberOfSections(in tableView: UITableView) -> Int {
// #warning Incomplete implementation, return the number of sections
return 1
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// #warning Incomplete implementation, return the number of rows
return newsItemsArray.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = UITableViewCell(style: .subtitle, reuseIdentifier: "Cell")
cell.backgroundColor = .clear
let newsItems = self.newsItemsArray[indexPath.row]
cell.textLabel?.text = newsItems.title
cell.textLabel?.font = UIFont.boldSystemFont(ofSize: 15.0)
cell.textLabel?.textColor = .white
cell.textLabel?.numberOfLines = 3
cell.detailTextLabel?.text = newsItems.url
cell.detailTextLabel?.textColor = .white
return cell
}
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return view.frame.size.height/5
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let webViewController = WebViewController()
webViewController.modalTransitionStyle = .crossDissolve
let newsItem = newsItemsArray[indexPath.row]
UserDefaults.standard.set(newsItem.url, forKey: "url")
present(webViewController, animated: true, completion: nil)
}
func parser(_ parser: XMLParser, didStartElement elementName: String, namespaceURI: String?, qualifiedName qName: String?, attributes attributeDict: [String : String] = [:]) {
currentElementName = nil
if elementName == "item" {
self.newsItemsArray.append(NewsItems())
} else {
currentElementName = elementName
}
}
func parser(_ parser: XMLParser, foundCharacters string: String) {
if self.newsItemsArray.count > 0 {
let lastItem = self.newsItemsArray[self.newsItemsArray.count - 1]
switch self.currentElementName {
case "title" :
lastItem.title = string
case "link" :
lastItem.url = string
case "pubDate" :
lastItem.pubDate = string
default:
break
}
}
}
func parser(_ parser: XMLParser, didEndElement elementName: String, namespaceURI: String?, qualifiedName qName: String?) {
self.currentElementName = nil
}
func parserDidEndDocument(_ parser: XMLParser) {
self.tableView.reloadData()
}
/*
// Override to support conditional editing of the table view.
override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
// Return false if you do not want the specified item to be editable.
return true
}
*/
/*
// Override to support editing the table view.
override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
if editingStyle == .delete {
// Delete the row from the data source
tableView.deleteRows(at: [indexPath], with: .fade)
} else if editingStyle == .insert {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
}
}
*/
/*
// Override to support rearranging the table view.
override func tableView(_ tableView: UITableView, moveRowAt fromIndexPath: IndexPath, to: IndexPath) {
}
*/
/*
// Override to support conditional rearranging of the table view.
override func tableView(_ tableView: UITableView, canMoveRowAt indexPath: IndexPath) -> Bool {
// Return false if you do not want the item to be re-orderable.
return true
}
*/
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/
}
| [
-1
] |
e13c332265541d6c1987b391dbd020ffdc2a7b90 | bff0f7db5b1e6b6297a69a30263709233069913c | /Sapo-Product-Module/Sapo-Product-Module/Controller/SetImageForVariantViewController.swift | 2cabef8f8f1d79ef4f16a2622941fc768d3f31d4 | [] | no_license | meomam99/Sapo-Product-Module | 51968a7f3d58b0f829f87a0b332e63ef61ca3907 | 30146bb1ecd12dc75fb9ea06dfdcd00010665981 | refs/heads/master | 2022-12-10T15:54:15.987058 | 2020-09-04T10:38:04 | 2020-09-04T10:38:04 | 285,214,902 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,970 | swift | //
// SetImageForVariantViewController.swift
// Sapo-Product-Module
//
// Created by mac on 8/24/20.
// Copyright © 2020 mac. All rights reserved.
//
import UIKit
class SetImageForVariantViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate {
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
images.count
}
func numberOfSections(in collectionView: UICollectionView) -> Int {
1
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "product", for: indexPath) as! ProductImageCell
cell.setData(img_path: images[indexPath.row].full_path)
return cell
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
delegate?.setImage(image: images[indexPath.row])
navigationController?.popViewController(animated: true)
}
@IBOutlet weak var collectionImage: UICollectionView!
var product_id: Int = 0
var images = [Image]()
var delegate: SetImageForVariantDelegate?
override func viewDidLoad() {
super.viewDidLoad()
setupView()
collectionImage.delegate = self
loadImages()
}
func setupView() {
self.title = "Chọn ảnh"
view.backgroundColor = .systemGray6
}
func updateView() {
collectionImage.dataSource = self
}
func loadImages() {
NetworkService.shared.getProductById(product_id: product_id, onSucess: { (rs) in
self.images = rs.product.images
self.updateView()
}) { (err) in
debugPrint(err)
}
}
}
protocol SetImageForVariantDelegate {
func setImage(image: Image)
}
| [
-1
] |
e51dccb8a561124b4037ca3067a27a2c373f91b5 | e4f88bed92f13e599144b7e5c11cea583b576392 | /Source/iOS/Extensions/UIView+Frame.swift | 58fa41a10bae764156c8c6b4346c33d5a9b99508 | [
"MIT"
] | permissive | mherod/Sugar | 718859f8d5a18aa21bdcb1d5abc5eba136255001 | eae7682e272b3e35010dcfd98a27aefc4d4bb2f9 | refs/heads/master | 2020-12-25T21:23:50.605727 | 2016-10-20T15:03:22 | 2016-10-20T15:03:22 | 67,030,303 | 0 | 0 | NOASSERTION | 2018-10-10T22:17:05 | 2016-08-31T11:10:13 | Swift | UTF-8 | Swift | false | false | 535 | swift | import UIKit
public extension UIView {
public var height: CGFloat {
get {
return frame.height
}
set {
frame.size.height = newValue
}
}
public var width: CGFloat {
get {
return frame.width
}
set {
frame.size.width = newValue
}
}
public var x: CGFloat {
get {
return frame.minX
}
set {
frame.origin.x = newValue
}
}
public var y: CGFloat {
get {
return frame.minY
}
set {
frame.origin.y = newValue
}
}
}
| [
-1
] |
c4a184914439bd23dcd96b79214a55d0899a4554 | 3356850a388e6cca6f58ad893a01dc85017078eb | /Feedmin/manyViewControllers.swift | 1ee8b18c29391db113911b4d586fa9c8df82c394 | [] | no_license | togamin/Feedmin | a8e965d8ef143236c3ceeebde6475b76d891c610 | 8a8697b4e470c69d4cb89503577fdfe9e37f5663 | refs/heads/master | 2020-03-19T02:05:41.976543 | 2018-06-20T14:23:30 | 2018-06-20T14:23:30 | 135,598,599 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,586 | swift | //
// manyViewControllers.swift
// Feedmin
//
// Created by 戸上 祐希 on 2018/06/05.
// Copyright © 2018年 Togami Yuki. All rights reserved.
//
import UIKit
class manyViewControllers:UIViewController{
override func viewDidLoad() {
super.viewDidLoad()
//テスト---------------------------------------------------
//CoreData初期化
//deleteAllSiteInfo()
//もしCoreDataに記事が入っている場合、過去記事URLと同じURLが出るまで行う.その処理を書いたら、記事の初期化消す。
//deleteAllArticleInfo()
//--------------------------------------------------------
//ステータスバーの背景色変更.UIViewを作成し追加することで実装
let statusBar = UIView(frame:CGRect(x: 0.0, y: 0.0, width: UIScreen.main.bounds.size.width, height: 20.0))
statusBar.backgroundColor = UIColor(red: 0, green: 0.02, blue: 0.06, alpha: 0.85)
view.addSubview(statusBar)
//CoreDataからサイトタイトルとサイトURLを取り出し、配列に格納。もし何も入っていなかったらデフォルトで「とがみんブログを表示する」
//deleteAllSiteInfo()//CoreData全削除
siteInfoList = readSiteInfo()
if siteInfoList.count == 0{
writeSiteInfo(siteID:0,siteTitle: "とがみんブログ",siteURL: "https://togamin.com/feed/")
siteInfoList = readSiteInfo()
}
initPageMenu()
}
func initPageMenu() {
//複数のViewControllerを用意
viewControllers = getViewControllers()
//メニューバーのレイアウト
let option = getPageMenuOption()
//PageMenuViewインスタンス作成
let pageMenu = PageMenuView(
viewControllers: viewControllers!,
option: option)
//デリゲート
pageMenu.delegate = self
//まだよくわからない
pageMenu.autoresizingMask = [.flexibleWidth, .flexibleHeight]
//viewにpageMenuを追加する.
view.addSubview(pageMenu)
}
}
//どのページからどのページに遷移したかをメモする。
extension manyViewControllers: PageMenuViewDelegate {
func willMoveToPage(_ pageMenu: PageMenuView, from viewController: UIViewController, index currentViewControllerIndex: Int){
//print(currentViewControllerIndex)
}
func didMoveToPage(_ pageMenu: PageMenuView, to viewController: UIViewController, index currentViewControllerIndex: Int) {
NowViewNum = currentViewControllerIndex
}
}
extension manyViewControllers {
//listの要素数の数だけViewControllerを作成
func getViewControllers() -> [ViewController] {
//ストーリーボード取得
let storyboard = UIStoryboard(name: "Main", bundle: nil)
var viewControllers = [ViewController]()
for info in siteInfoList{
//print(siteInfo)
//ストーリボード上のwithIdentifierクラスを取得
let viewController = storyboard.instantiateViewController(withIdentifier: "ViewController")
//ViewControllerのtitleを代入
viewController.title = info?.siteTitle!
viewControllers.append(viewController as! ViewController)
}
//print(viewControllers)
return viewControllers
}
//ページメニューのオプション
func getPageMenuOption() -> PageMenuOption {
//ページメニューのサイズとポジション
var option = PageMenuOption(frame:
CGRect(x: 0, y: 20,
width: view.frame.size.width,
height: view.frame.size.height - 20))
//メニューの高さ
option.menuItemHeight = 44
//メニューのサイズ
option.menuTitleFont = .boldSystemFont(ofSize: 16)
//メニュータイトルの色(未選択時)
option.menuTitleColorNormal = .lightGray
//メニュータイトルの色(選択時)
option.menuTitleColorSelected = .white
//メニューの背景色(未選択時)
option.menuItemBackgroundColorNormal = UIColor(red: 0, green: 0.02, blue: 0.06, alpha: 0.61)
//メニューの背景色
option.menuItemBackgroundColorSelected = UIColor(red: 0, green: 0.02, blue: 0.06, alpha: 0.61)
//アンダーラインの色
option.menuIndicatorColor = UIColor(red: 0.5, green: 0.8, blue: 1.0, alpha: 0.8)
return option
}
//サイトを追加した時に呼ばれる関数.追加した際ページメニューに反映。
func addPage(siteTitle:String) {
// 追加したいViewControllerをviewControllersにセットする
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let viewController = storyboard.instantiateViewController(withIdentifier: "ViewController")
//ViewControllerのtitleを代入
viewController.title = siteTitle
viewControllers?.append(viewController)
// 再度pageMenuを設定
//メニューバーのレイアウト
let option = getPageMenuOption()
let pageMenu = PageMenuView(
viewControllers: viewControllers!,
option: option)
view.addSubview(pageMenu)
}
}
| [
-1
] |
62f918b1c139dcdbee91304f7ec6db33824a8aea | bf06d8428962bf1cc34b31badc202499cb73b859 | /WeatherApp/SwiftWeather/Forecast.swift | f3ee1680ac628b97eec4cae300b5706530d37907 | [] | no_license | txv428/IOS-App-developer-task | 9bfc7dd22d2a5832fec5ecf095a6f1df0c5b3afc | d3104251e84271a77c39fac7e3d82b687189af32 | refs/heads/master | 2021-07-25T16:27:24.056339 | 2020-04-01T00:56:41 | 2020-04-01T00:56:41 | 130,852,234 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,088 | swift | //
// Weather.swift
// JSON
//
// Created by Tejasree Vangapalli on 18.04.18.
// Copyright © 2018 Tejasree Vangapalli. All rights reserved.
//
import Foundation
import CoreLocation
struct Forecast {
//declaration of variables
let day:String
let icon:String
let temperatureMax:Double
let temperatureMin:Double
//any one of possible errors
enum SerializationError:Error {
case missing(String)
case invalid(String, Any)
}
//initialization of variables
init(json:[String:Any]) throws {
if let unixtime = json["time"] as? Double {
let date = Date(timeIntervalSince1970: unixtime)
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "EEEE"
let day: String = dateFormatter.string(from: date)
self.day = day
} else {
throw SerializationError.missing("day is missing")
}
if let icon = json["icon"] as? String {
self.icon = icon
} else {
throw SerializationError.missing("icon is missing")
}
if let temperatureMax = json["temperatureMax"] as? Double {
self.temperatureMax = temperatureMax
} else {throw SerializationError.missing("temp is missing")}
if let temperatureMin = json["temperatureMin"] as? Double {
self.temperatureMin = temperatureMin
}else {throw SerializationError.missing("temp is missing")}
}
//base url of the weather forecast
static let basePath = "https://api.darksky.net/forecast/caa9e10aef57f4c3e4bbfb6692484293/"
//retriving the contents of daily data which is in json format
static func forecast (withLocation location:CLLocationCoordinate2D, completion: @escaping ([Forecast]?) -> ()) {
let url = basePath + "\(location.latitude),\(location.longitude)"
let request = URLRequest(url: URL(string: url)!)
print(url)
let task = URLSession.shared.dataTask(with: request) { (data:Data?, response:URLResponse?, error:Error?) in
var forecastArray:[Forecast] = []
if let data = data {
do {
if let json = try JSONSerialization.jsonObject(with: data, options: []) as? [String:Any] {
if let dailyForecasts = json["daily"] as? [String:Any] {
if let dailyData = dailyForecasts["data"] as? [[String:Any]] {
for dataPoint in dailyData {
if let weatherObject = try? Forecast(json: dataPoint) {
forecastArray.append(weatherObject)
}
}
}
}
}
}catch {
print(error.localizedDescription)
}
completion(forecastArray)
}
}
task.resume()
}
}
| [
-1
] |
27af99eaa236673f125072c24d8f201e59b67864 | 08bdbf700b9e42aaac57f338401c4b8ab99acdd9 | /Demo/ToDoList/ToDoListAdd.swift | 50cff48d9bce5f3619a13c91c99cbd954914b8be | [] | no_license | c78420/Demo | dd1459fc23639d00a2f59278f423de72d38fc7c7 | a755836876d15d7fb0148975cc70a1c979180721 | refs/heads/master | 2020-12-29T11:21:50.530296 | 2020-08-17T02:26:46 | 2020-08-17T02:26:46 | 238,590,622 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,623 | swift | //
// ToDoListAdd.swift
// Demo
//
// Created by 黃崇漢 on 2018/7/19.
// Copyright © 2018年 Tony Huang (黃崇漢). All rights reserved.
//
import UIKit
class ToDoListAdd: UIViewController {
@IBOutlet weak var myTextInput: UITextField!
@IBOutlet weak var myButton: UIButton!
var infoFromViewOne: Int?
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
self.myTextInput.becomeFirstResponder()
self.myTextInput.delegate = self
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
if let info = self.infoFromViewOne {
if var toDos = UserDefaults.standard.stringArray(forKey: "toDos") {
self.myTextInput.text = toDos[info]
self.myButton.setTitle("OK", for: .normal)
}
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func buttonPresses(_ sender: UIButton) {
if let text = self.myTextInput.text, !text.isEmpty {
if var toDos = UserDefaults.standard.stringArray(forKey: "toDos") {
if let info = self.infoFromViewOne {
toDos[info] = text
}
else {
toDos.append(text)
}
UserDefaults.standard.set(toDos, forKey: "toDos")
}
else {
UserDefaults.standard.set([text], forKey: "toDos")
}
}
else {
if let info = self.infoFromViewOne {
if var toDos = UserDefaults.standard.stringArray(forKey: "toDos") {
toDos.remove(at: info)
UserDefaults.standard.set(toDos, forKey: "toDos")
}
}
}
self.tabBarController?.selectedIndex = 0
self.myTextInput.text = ""
self.myButton.setTitle("Back", for: .normal)
self.infoFromViewOne = nil
}
@IBAction func textFieldDidChanged(_ sender: UITextField) {
if sender.text != "" {
self.myButton.setTitle("OK", for: .normal)
}
else {
self.myButton.setTitle("Back", for: .normal)
}
}
}
extension ToDoListAdd: UITextFieldDelegate {
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
self.buttonPresses(self.myButton)
return true
}
}
| [
-1
] |
3595186706bf550b62dcd713e4e434c280e249df | 0bf04112cff313e0cc5403fd6d8e41c00707e502 | /Wakey/Cells/goToSleepCell.swift | 5f20a6805955083a3d877f54c77b7b5fd33ffbd0 | [] | no_license | RowMoc/Wakey | 929c0a59e6586892ccc165e55124cf947d2a64dc | a87e48d3320fa386dd28ea45037fa8afa9043cfd | refs/heads/master | 2023-02-13T10:26:14.874122 | 2021-01-09T17:20:41 | 2021-01-09T17:20:41 | 272,267,809 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,135 | swift | //
// goToSleepCell.swift
// Wakey
//
// Created by Rowan Mockler on 2020/05/10.
// Copyright © 2020 Wakey. All rights reserved.
//
import UIKit
protocol goToSleepCellDelegate: class {
func setAlarm(timeSet: Date, cell: goToSleepCell)
func exitSleepMode()
func lockScreenPressed()
}
class goToSleepCell: UICollectionViewCell {
@IBOutlet weak var currentTimeLabel: UILabel!
@IBOutlet weak var currentDateLabel: UILabel!
@IBOutlet weak var lockScreenButton: lockScreenButton!
@IBOutlet weak var exitSleepModeButton: exitSleepModeButton!
@IBOutlet weak var alarmImage: UIImageView!
@IBOutlet weak var setAlarmButton: UIButton!
@IBOutlet weak var timePicker: UIDatePicker!
@IBOutlet weak var cancelButton: UIButton!
@IBOutlet weak var saveButton: UIButton!
weak var delegate: goToSleepCellDelegate?
var timer = Timer()
override func awakeFromNib() {
super.awakeFromNib()
timePicker.setValue(UIColor.white, forKeyPath: "textColor")
timePicker.datePickerMode = .time
timePicker.isHidden = true
cancelButton.isHidden = true
saveButton.isHidden = true
lockScreenButton.isHidden = true
timer = Timer.scheduledTimer(timeInterval: 1.0, target: self, selector:#selector(self.tick) , userInfo: nil, repeats: true)
}
@IBAction func lockScreenPressed(_ sender: Any) {
performPressAnimation()
delegate?.lockScreenPressed()
}
@objc func tick() {
currentDateLabel.text = DateFormatter.localizedString(from: Date(), dateStyle: .long, timeStyle: .none)
}
@IBAction func setAlarmPressed(_ sender: Any) {
alarmImage.isHidden = true
setAlarmButton.isHidden = true
//timePicker.frame = CGRect(x: 0, y: UIScreen.main.bounds.height*0.8, width: UIScreen.main.bounds.width , height: UIScreen.main.bounds.height*0.2)
timePicker.isHidden = false
//cancelButton.frame = CGRect(x: 20, y: timePicker.frame.minY - 25, width: 50, height: 20)
cancelButton.isHidden = false
//saveButton.frame = CGRect(x: UIScreen.main.bounds.width - 70, y: timePicker.frame.minY - 25, width: 50, height: 20)
saveButton.isHidden = false
}
@IBAction func timeOnPickerChanged(_ sender: Any) {
}
@IBAction func cancelPressed(_ sender: Any) {
cancelButton.isHidden = true
saveButton.isHidden = true
timePicker.isHidden = true
alarmImage.isHidden = false
setAlarmButton.isHidden = false
}
@IBAction func savePressed(_ sender: Any) {
let components = Calendar.current.dateComponents([.year, .month, .day, .hour, .minute], from: timePicker.date)
let selectedTimeComponents = DateComponents(year: components.year, month: components.month, day: components.day, hour: components.hour, minute: components.minute, second: 0)
let selectedTime = Calendar.current.date(from: selectedTimeComponents)!
let alarmText = DateFormatter.localizedString(from: selectedTime, dateStyle: .none, timeStyle: .short)
setAlarmButton.setTitle(alarmText, for: .normal)
delegate?.setAlarm(timeSet: selectedTime, cell: self)
cancelButton.isHidden = true
saveButton.isHidden = true
timePicker.isHidden = true
alarmImage.isHidden = false
setAlarmButton.isHidden = false
}
@IBAction func exitSleepModePressed(_ sender: Any) {
//print("button is hit")
delegate?.exitSleepMode()
}
func performPressAnimation() {
UIButton.animate(withDuration: 0.05,
animations: {
self.lockScreenButton.transform = CGAffineTransform(scaleX: 0.95, y: 0.95)
},
completion: { finish in
UIButton.animate(withDuration: 0.05, animations: {
self.lockScreenButton.transform = CGAffineTransform.identity
})
})
}
}
| [
-1
] |
1ee4c2f718264e4e2d9ec507d79fc2520824bdd4 | a143746bcf0eb2db849e907ea95a22be150033b0 | /iOS/TCBeautyKit/Source/TCBeautyViewModel.swift | 9fac36c8207287f14ca66a81a25f972cb75a86af | [] | no_license | jiangben/TUIMeeting | 740ff83347f2a7e7ed7e3fcabfadb945f10be034 | adbd83e6a85355bfbb084cc612c2d24fc0b5b89d | refs/heads/main | 2023-06-16T14:33:44.229463 | 2021-07-15T03:10:02 | 2021-07-15T03:10:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 10,168 | swift | //
// TCBeautyViewModel.swift
// TXLiteAVDemo
//
// Created by gg on 2021/5/7.
// Copyright © 2021 Tencent. All rights reserved.
//
import Foundation
@objcMembers
public class TCBeautyViewModel: NSObject {
public let viewModel : NSObject
public let actionPerformer : TCBeautyPanelActionProxy
@objc public init(viewModel: NSObject) {
self.viewModel = viewModel
self.actionPerformer = TCBeautyPanelActionProxy(sdkObject: viewModel)
super.init()
}
deinit {
reset()
}
public var beautyStyle: Int = 2
public var beautyLevel: Float = 6
public var whiteLevel: Float = 0
public var ruddyLevel: Float = 0
public var currentShowIndexPath: IndexPath = IndexPath(item: -1, section: 0)
public weak var currentSelectItem: TCBeautyBaseItem?
public func applyDefaultSetting() {
reset()
}
public lazy var dataSource: [TCBeautyBasePackage] = {
var res : [TCBeautyBasePackage] = []
let beautyPkg = getBeautyPackage()
res.append(beautyPkg)
let filterPkg = getFilterPackage()
res.append(filterPkg)
let motionPkgs = getMotionPackages()
res.append(contentsOf: motionPkgs)
let greenPkg = getGreenPackage()
res.append(greenPkg)
currentShowIndexPath = IndexPath(item: 2, section: 0)
if let pkg = res.first {
currentSelectItem = pkg.items.count > 3 ? pkg.items[2] : pkg.items.first
}
return res
}()
public func reset() {
for pkg in dataSource {
for item in pkg.items {
item.currentValue = item.defaultValue
switch item.type {
case .beauty:
let item = item as! TCBeautyBeautyItem
if item.index <= 4 {
beautyStyle = item.index < 3 ? item.index : 2
item.sendAction([item.currentValue, beautyStyle, beautyLevel, whiteLevel, ruddyLevel])
}
case .filter:
if !item.isClear {
let item = item as! TCBeautyFilterItem
if item.identifier == "baixi" {
item.setFilter()
item.setSlider(value: item.currentValue)
}
}
case .motion, .koubei, .cosmetic, .gesture:
if item.isClear {
item.sendAction([])
}
else {
let item = item as! TCBeautyMotionItem
item.stopTask()
}
case .green:
if item.isClear {
item.sendAction([])
}
default:
break
}
}
}
}
// MARK: Green
func getGreenPackage() -> TCBeautyBasePackage {
let greenPkg = TCBeautyGreenPackage(enableClearBtn: true, enableSlider: false, title: TCBeautyLocalize("TC.BeautyPanel.Menu.GreenScreen"), type: .green)
if let path = TCBeautyBundle().path(forResource: "goodluck", ofType: "mp4") {
let item = TCBeautyGreenItem(url: path, title: TCBeautyLocalize("TC.BeautySettingPanel.GoodLuck"), normalIcon: "beautyPanelGoodLuckIcon", package: greenPkg, target: actionPerformer)
greenPkg.items.append(item)
}
if let clearItem = greenPkg.clearItem {
clearItem.add(target: actionPerformer, action: #selector(TCBeautyPanelActionProxy.setGreenScreenFile(_:)))
greenPkg.items.insert(clearItem, at: 0)
}
return greenPkg
}
// MARK: Motion
func getMotionPackages() -> [TCBeautyBasePackage] {
var pkgs: [TCBeautyBasePackage] = []
let root = readMotionJson()
if root.keys.contains("motion"), let arr = root["motion"] as? [Dictionary<String, Any>] {
let motionPkg = TCBeautyMotionPackage(enableClearBtn: true, enableSlider: false, title: TCBeautyLocalize("TC.BeautyPanel.Menu.VideoEffect"), type: .motion)
motionPkg.decodeItems(arr: arr, target: actionPerformer)
if let clearItem = motionPkg.clearItem {
clearItem.add(target: actionPerformer, action: #selector(TCBeautyPanelActionProxy.setMotionTmpl(_:inDir:)))
motionPkg.items.insert(clearItem, at: 0)
}
pkgs.append(motionPkg)
}
if root.keys.contains("cosmetic"), let arr = root["cosmetic"] as? [Dictionary<String, Any>] {
let motionPkg = TCBeautyMotionPackage(enableClearBtn: true, enableSlider: false, title: TCBeautyLocalize("TC.BeautyPanel.Menu.Cosmetic"), type: .koubei)
motionPkg.decodeItems(arr: arr, target: actionPerformer)
if let clearItem = motionPkg.clearItem {
clearItem.add(target: actionPerformer, action: #selector(TCBeautyPanelActionProxy.setMotionTmpl(_:inDir:)))
motionPkg.items.insert(clearItem, at: 0)
}
pkgs.append(motionPkg)
}
if root.keys.contains("gesture"), let arr = root["gesture"] as? [Dictionary<String, Any>] {
let motionPkg = TCBeautyMotionPackage(enableClearBtn: true, enableSlider: false, title: TCBeautyLocalize("TC.BeautyPanel.Menu.Gesture"), type: .cosmetic)
motionPkg.decodeItems(arr: arr, target: actionPerformer)
if let clearItem = motionPkg.clearItem {
clearItem.add(target: actionPerformer, action: #selector(TCBeautyPanelActionProxy.setMotionTmpl(_:inDir:)))
motionPkg.items.insert(clearItem, at: 0)
}
pkgs.append(motionPkg)
}
if root.keys.contains("bgremove"), let arr = root["bgremove"] as? [Dictionary<String, Any>] {
let motionPkg = TCBeautyMotionPackage(enableClearBtn: true, enableSlider: false, title: TCBeautyLocalize("TC.BeautyPanel.Menu.BlendPic"), type: .gesture)
motionPkg.decodeItems(arr: arr, target: actionPerformer)
if let clearItem = motionPkg.clearItem {
clearItem.add(target: actionPerformer, action: #selector(TCBeautyPanelActionProxy.setMotionTmpl(_:inDir:)))
motionPkg.items.insert(clearItem, at: 0)
}
pkgs.append(motionPkg)
}
return pkgs
}
func readMotionJson() -> Dictionary<String, Any> {
guard let path = TCBeautyBundle().path(forResource: "TCPituMotion", ofType: "json") else { return [:] }
guard let data = try? Data(contentsOf: URL(fileURLWithPath: path)) else { return [:] }
guard let res = try? JSONSerialization.jsonObject(with: data, options: .mutableContainers) else { return [:] }
guard let root = res as? Dictionary<String, Any> else { return [:] }
guard root.keys.contains("bundle"), root.keys.contains("package") else { return [:] }
guard let bundle = root["bundle"] as? String, bundle == "pitu" else { return [:] }
guard let packages = root["package"] as? Dictionary<String, Any> else { return [:] }
return packages
}
// MARK: Filter
func getFilterPackage() -> TCBeautyBasePackage {
let filterPkg = TCBeautyFilterPackage(enableClearBtn: true, enableSlider: true, title: TCBeautyLocalize("TC.BeautyPanel.Menu.Filter"), type: .filter)
let defaultValue = TCBeautyFilterPackage.defaultFilterValue
for (i, filter) in TCFilterManager.default().allFilters.enumerated() {
let identifier = "TC.Common.Filter_\(filter.identifier.rawValue)"
var imgName = filter.identifier.rawValue
if imgName == "white" {
imgName = "fwhite"
}
let item = TCBeautyFilterItem(title: TCBeautyLocalize(identifier), normalIcon: UIImage.init(named: imgName, in: TCBeautyBundle(), compatibleWith: nil), package: filterPkg, lookupImagePath: filter.lookupImagePath, target: actionPerformer, currentValue: defaultValue[i], identifier: filter.identifier.rawValue)
item.index = i
filterPkg.items.append(item)
}
if let clearItem = filterPkg.clearItem {
clearItem.add(target: actionPerformer, action: #selector(TCBeautyPanelActionProxy.setFilter(_:)))
filterPkg.items.insert(clearItem, at: 0)
}
return filterPkg
}
// MARK: Beauty
private let DefaultBeautyLevel = 6
private let DefaultWhitnessLevel = 1
func getBeautyPackage() -> TCBeautyBasePackage {
let beautyPkg = TCBeautyBeautyPackage(title: TCBeautyLocalize("TC.BeautyPanel.Menu.Beauty"), type: .beauty)
guard let path = TCBeautyBundle().path(forResource: "TCBeauty", ofType: "json") else { return beautyPkg }
guard let data = try? Data(contentsOf: URL(fileURLWithPath: path)) else { return beautyPkg }
guard let res = try? JSONSerialization.jsonObject(with: data, options: .mutableContainers) else { return beautyPkg }
guard let root = res as? Dictionary<String, Any> else { return beautyPkg }
guard root.keys.contains("package") else { return beautyPkg }
guard let arr = root["item"] as? Array<Dictionary<String, Any>> else { return beautyPkg }
beautyPkg.decodeItems(arr: arr, target: actionPerformer)
if beautyPkg.items.count > 3 {
beautyPkg.items[2].isSelected = true
}
if let clearItem = beautyPkg.clearItem {
beautyPkg.items.insert(clearItem, at: 0)
}
return beautyPkg
}
}
| [
-1
] |
45d75149835ffff58493691f41c949858ae1569a | a7d02517a9f3f248c74886c8ebe370036ee19f86 | /HelloWorldTutorial/CounterGame.swift | 45f89e681a85b21399fb905bd706460d0e97dec7 | [] | no_license | tilljernst/HelloWorldTutorial | 243db0fc8750add0e4c0a9093a2d357996eab611 | e2d3f20dc64c9bafb315c07e9bcd6b5ec605ef97 | refs/heads/master | 2021-01-20T07:46:12.068355 | 2017-05-22T20:02:18 | 2017-05-22T20:02:18 | 90,039,773 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,056 | swift | //
// CounterGame.swift
// HelloWorldTutorial
//
// Created by Till J. Ernst on 03.05.17.
// Copyright © 2017 Till J. Ernst. All rights reserved.
//
import UIKit
class CounterGame: UIViewController {
var counter: Int = 0
var tapCounter: Int = 0
var timer = Timer()
@IBOutlet weak var punkteStandLabel: UILabel!
@IBOutlet weak var timerLabel: UILabel!
@IBOutlet weak var startButtonOutlet: UIButton!
@IBOutlet weak var tappButtonOutlet: UIButton!
@IBAction func startButton(_ sender: Any) {
timer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(CounterGame.timerAction), userInfo: nil, repeats: true)
startButtonOutlet.isEnabled = false
tappButtonOutlet.isHidden = false
tapCounter = 0
}
@IBAction func tappButton(_ sender: Any) {
tapCounter += 1
timerLabel.text = "\(tapCounter) Punkte"
}
override func viewDidLoad() {
super.viewDidLoad()
timerLabel.text = "\(tapCounter) Punkte"
tappButtonOutlet.isHidden = true
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func timerAction() {
if counter < 10 {
counter += 1
punkteStandLabel.text = "\(counter) Sekunden"
} else {
punkteStandLabel.text = "\(counter) Sekunden"
timer.invalidate()
tappButtonOutlet.isHidden = true
startButtonOutlet.isEnabled = true
counter = 0
}
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
| [
-1
] |
0a747f810e6e5e612c1003ee9e5db2dbf0085458 | 15b7dba958492dbfced5eea44e2c4338c3afe4ad | /GroupPhoto/GroupConfirmTableViewController.swift | 56be5e3907050a03a8651a73329163b8d5304462 | [] | no_license | drewburns/GroupPhotoApp | 0f229b7cf0ee7da296e8e218c0a22726a94ec784 | 680293f15825b30012645ba2dbc5d85ac0b9d733 | refs/heads/master | 2022-11-22T12:02:20.076590 | 2018-02-14T17:20:45 | 2018-02-14T17:20:45 | 169,312,544 | 0 | 1 | null | 2022-11-16T21:34:57 | 2019-02-05T21:04:53 | Swift | UTF-8 | Swift | false | false | 5,207 | swift | //
// ChatConfirmViewController.swift
// Wingman
//
// Created by Andrew Burns on 9/3/17.
// Copyright © 2017 Andrew Burns. All rights reserved.
//
import UIKit
import Firebase
import NotificationBannerSwift
class GroupConfirmViewController: UIViewController , UITextViewDelegate{
var users:[AppUser] = []
var user: AppUser?
var nav: UINavigationController?
let base = Database.database().reference()
@IBOutlet weak var mainView: UIView!
@IBOutlet weak var textInput: UITextView!
@IBOutlet weak var sendMessageButton: UIButton!
let reachability = Reachability()!
var internet = ""
func internetChanged(note: Notification) {
}
@IBAction func createGroup(_ sender: Any) {
if textInput.text! != "" {
makeGroupRecord()
goBack()
} else {
// error need a name
}
}
func makeGroupRecord() {
let ref = Database.database().reference().child("groups").childByAutoId()
let timestamp:Int = Int(NSDate().timeIntervalSince1970)
ref.updateChildValues(["name" : textInput.text!, "timestamp": timestamp, "creation_date": timestamp], withCompletionBlock: {(err, reference) in
if err == nil {
for user in self.users {
let newref = Database.database().reference().child("group-users").child(ref.key)
newref.updateChildValues([user.id! : 0])
self.createUserGroup(path: reference.key, user: user)
}
} else {
// there is an error
}
})
}
func createUserGroup(path: String, user: AppUser) {
let newref = Database.database().reference().child("user-groups").child(user.id!)
newref.updateChildValues([path : 0])
}
override func viewDidLoad() {
super.viewDidLoad()
self.users.append(self.user!)
print("LOADED")
print(self.user!)
textInput.delegate = self
mainView.layer.cornerRadius = 5;
mainView.layer.masksToBounds = true;
self.hideKeyboardWhenTappedAround()
var downSwipe = UISwipeGestureRecognizer(target: self, action: #selector(swipeAction(swipe:)))
downSwipe.direction = UISwipeGestureRecognizerDirection.down
self.mainView.addGestureRecognizer(downSwipe)
reachability.whenReachable = { _ in
if self.internet == "unreachable" {
DispatchQueue.main.async(execute: {
self.dismiss(animated: false, completion: nil)
// dismiss unreachable view
})
self.internet = ""
}
}
reachability.whenUnreachable = {_ in
self.internet = "unreachable"
DispatchQueue.main.async(execute: {
let alert = UIAlertController(title: nil, message: "Connect to Internet", preferredStyle: .alert)
let loadingIndicator = UIActivityIndicatorView(frame: CGRect(x: 10, y: 5, width: 50, height: 50))
loadingIndicator.hidesWhenStopped = true
loadingIndicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyle.gray
loadingIndicator.startAnimating();
alert.view.addSubview(loadingIndicator)
self.present(alert, animated: true, completion: nil)
})
}
NotificationCenter.default.addObserver(self, selector: #selector(internetChanged), name: ReachabilityChangedNotification, object: reachability)
do {
try reachability.startNotifier()
} catch {
// something went wrong
}
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func goBack() {
self.dismiss(animated: true, completion: {
self.dismiss(animated: true, completion: nil)
// let presenting = self.presentedViewController
// let nav = presenting?.navigationController
self.nav?.popToRootViewController(animated: true)
})
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
extension UIImageView {
public func maskCircle() {
self.contentMode = UIViewContentMode.scaleAspectFill
self.layer.cornerRadius = self.frame.height / 2
self.layer.masksToBounds = false
self.clipsToBounds = true
// make square(* must to make circle),
// resize(reduce the kilobyte) and
// fix rotation.
// self.image = anyImage
}
}
| [
-1
] |
a2de2c84a2fbbcbecb297434df999e81803ac31b | ce31cbf1b9125d4dfd8bf572971e96ccf1fdf83f | /vkapp/vkapp/Flows/FriendDetail/Model/Photo.swift | b75673707e49f2e4877b71f844b52420bfa65058 | [] | no_license | mclaud2007/VKApp | 3399d696abfdc0b59d38870e468ec2f51f95602f | a6f6b3cb947ba83886b00ece7acde86c2c0c8290 | refs/heads/master | 2022-12-13T23:02:36.258206 | 2020-08-30T04:31:15 | 2020-08-30T04:31:15 | 215,854,373 | 0 | 0 | null | 2020-08-30T04:31:17 | 2019-10-17T17:58:57 | Swift | UTF-8 | Swift | false | false | 3,136 | swift | //
// Photo.swift
// vkapp
//
// Created by Григорий Мартюшин on 04.06.2020.
// Copyright © 2020 Григорий Мартюшин. All rights reserved.
//
import Foundation
// MARK: - Item
struct Photo {
let likesStruct: PhotosLikes
let id: Int
let date: Int
let sizes: [PhotosSizes]?
let friendId: Int
private(set) var reposts: Int? = 0
var likes: Int? {
return likesStruct.count
}
var isLiked: Bool? {
return likesStruct.userLikes == 1 ? true : false
}
// Самое большое фото
var biggestPhoto: PhotosSizes? {
// Находим самую широкую из доступных фото
return sizes?.sorted { (first, second) -> Bool in
return first.width > second.width
}.first
}
// Адрес самой большой фотографии среди размеров
var photoUrlString: String? {
return biggestPhoto?.url
}
var photoUrl: URL? {
guard let urlString = self.photoUrlString else { return nil }
return URL(string: urlString)
}
// Инициализация из словаря от парсинга JSON
init (from photo: [String: Any]) {
if let pLikes = photo["likes"] as? [String: Any],
let count = pLikes["count"] as? Int,
let user_likes = pLikes["user_likes"] as? Int
{
likesStruct = PhotosLikes(count: count, userLikes: user_likes)
} else {
likesStruct = PhotosLikes(count: 0, userLikes: 0)
}
if let pShare = photo["reposts"] as? [String: Any],
let count = pShare["count"] as? Int
{
reposts = count
}
id = photo["id"] as? Int ?? 0
date = photo["date"] as? Int ?? 0
if let pSizes = photo["sizes"] as? [[String: Any]] {
// Заполняем массив размеров
self.sizes = pSizes.map {
let size = $0
if let height = size["height"] as? Int,
let width = size["width"] as? Int,
let type = size["type"] as? String,
let pType = PhotosSizesTypes(rawValue: type),
let url = size["url"] as? String
{
return PhotosSizes(type: pType, url: url, width: width, height: height)
} else {
return PhotosSizes(type: .s, url: "", width: 0, height: 0)
}
}
} else {
self.sizes = nil
}
self.friendId = photo["owner_id"] as? Int ?? 0
}
}
// MARK: - Likes
struct PhotosLikes {
let count, userLikes: Int
}
// MARK: - Size
struct PhotosSizes {
let type: PhotosSizesTypes
let url: String
let width, height: Int
}
enum PhotosSizesTypes: String {
case m = "m"
case o = "o"
case p = "p"
case q = "q"
case r = "r"
case s = "s"
case w = "w"
case x = "x"
case y = "y"
case z = "z"
}
| [
-1
] |
3b896abc57520794e88085ef6c52fc718bdf6703 | c86547141873dddd7b591c35f011b6a4eb5e99cb | /SynchronousUITests/SynchronousUITests.swift | 27bb11986c661ccc8ae4e05c0e0a524ca319ebdd | [
"MIT"
] | permissive | Clean-Swift/Synchronous | 645b181688842684b25554bfc22e2c09fea54c8a | 71b101d803168f2f8d85b73512db912236285489 | refs/heads/master | 2020-03-07T21:10:12.483299 | 2018-05-07T22:19:16 | 2018-05-07T22:19:16 | 127,719,625 | 6 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,260 | swift | //
// SynchronousUITests.swift
// SynchronousUITests
//
// Created by Raymond Law on 2/22/18.
// Copyright © 2018 Clean Swift LLC. All rights reserved.
//
import XCTest
class SynchronousUITests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
// In UI tests it is usually best to stop immediately when a failure occurs.
continueAfterFailure = false
// UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
XCUIApplication().launch()
// In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
}
| [
155665,
237599,
229414,
278571,
229425,
180279,
229431,
319543,
213051,
286787,
237638,
311373,
278607,
196687,
311377,
368732,
180317,
278637,
319599,
278642,
131190,
131199,
278669,
278676,
311447,
327834,
278684,
278690,
311459,
278698,
278703,
278707,
278713,
180409,
295099,
139459,
131270,
229591,
147679,
147680,
311520,
319719,
295147,
286957,
319764,
278805,
311582,
278817,
311596,
336177,
98611,
278843,
287040,
319812,
311622,
319816,
229716,
278895,
287089,
139641,
311679,
311692,
106893,
156069,
311723,
377265,
311739,
319931,
278974,
336319,
311744,
336323,
278979,
278988,
278992,
279000,
279009,
369121,
188899,
279014,
319976,
279017,
311787,
319986,
279030,
311800,
279033,
279042,
287237,
279053,
303634,
303635,
279060,
279061,
279066,
188954,
279092,
377419,
303693,
115287,
189016,
295518,
287327,
279143,
279150,
287345,
189054,
303743,
287359,
279176,
311944,
344714,
311948,
311950,
311953,
287379,
336531,
295575,
303772,
205469,
221853,
279207,
295591,
295598,
279215,
279218,
287412,
164532,
287418,
303802,
66243,
287434,
287438,
279249,
303826,
369365,
369366,
279253,
230105,
295653,
230120,
279278,
312046,
230133,
279293,
205566,
295688,
312076,
295698,
221980,
336678,
262952,
279337,
262953,
262957,
164655,
328495,
303921,
230198,
295745,
222017,
279379,
295769,
230238,
279393,
303973,
279398,
295797,
295799,
279418,
336765,
287623,
279434,
320394,
189327,
189349,
279465,
304050,
189373,
213956,
345030,
213961,
279499,
304086,
304104,
123880,
320492,
320495,
287730,
320504,
214009,
312313,
312317,
418819,
320520,
230411,
320526,
238611,
140311,
238617,
197658,
336930,
132140,
189487,
312372,
238646,
238650,
320571,
336962,
238663,
296023,
205911,
156763,
230500,
279659,
230514,
238706,
312435,
279666,
279686,
222344,
337037,
296091,
238764,
279729,
148674,
312519,
279752,
148687,
189651,
279766,
189656,
279775,
304352,
304353,
279780,
279789,
279803,
312588,
320795,
320802,
304422,
312628,
345398,
222523,
181568,
279872,
279874,
304457,
230730,
345418,
337228,
296269,
222542,
238928,
296274,
230757,
296304,
312688,
230772,
337280,
296328,
296330,
304523,
9618,
279955,
148899,
279979,
279980,
173492,
279988,
280003,
370122,
280011,
337359,
329168,
312785,
222674,
329170,
280020,
280025,
239069,
320997,
280042,
280043,
329198,
337391,
296434,
288252,
312830,
230922,
304655,
329231,
230933,
222754,
312879,
230960,
288305,
239159,
157246,
288319,
288322,
280131,
124486,
288328,
239192,
345697,
312937,
312941,
206447,
288377,
337533,
280193,
239238,
288391,
239251,
280217,
198304,
280252,
296636,
280253,
321217,
280259,
239305,
296649,
280266,
9935,
313042,
280279,
18139,
280285,
321250,
337638,
181992,
288492,
34547,
67316,
313082,
288508,
288515,
280326,
116491,
280333,
124691,
116502,
321308,
321309,
280367,
280373,
280377,
321338,
280381,
345918,
280386,
280391,
280396,
18263,
370526,
296807,
296815,
313200,
313204,
124795,
280451,
67464,
305032,
124816,
214936,
337816,
124826,
239515,
214943,
313257,
288698,
214978,
280517,
280518,
214983,
231382,
190437,
313322,
174058,
296942,
124912,
313338,
239610,
182277,
313356,
305173,
223269,
354342,
354346,
313388,
124974,
215095,
288829,
288835,
313415,
239689,
354386,
223317,
354394,
321632,
280676,
313446,
215144,
288878,
288890,
215165,
329884,
215204,
125108,
280761,
223418,
280767,
338118,
280779,
280792,
280803,
182503,
338151,
125166,
125170,
395511,
313595,
125180,
125184,
125192,
125197,
125200,
125204,
338196,
125215,
125225,
338217,
321839,
125236,
280903,
289109,
379224,
239973,
313703,
280938,
321901,
354671,
199030,
223611,
248188,
313726,
240003,
158087,
313736,
240020,
190870,
190872,
289185,
305572,
289195,
338359,
289229,
281038,
281039,
281071,
322057,
182802,
322077,
289328,
338491,
322119,
281165,
281170,
281200,
313970,
297600,
289435,
314020,
248494,
166581,
314043,
363212,
158424,
322269,
338658,
289511,
330473,
330476,
289517,
215790,
125683,
199415,
322302,
289534,
35584,
322312,
346889,
166677,
207639,
281378,
289580,
289599,
281407,
281426,
281434,
322396,
281444,
207735,
314240,
158594,
330627,
240517,
289691,
240543,
289704,
289720,
289723,
281541,
19398,
191445,
183254,
183258,
207839,
314343,
183276,
289773,
248815,
240631,
330759,
322571,
330766,
281647,
322609,
314437,
207954,
339031,
314458,
281698,
281699,
322664,
314493,
150656,
347286,
339106,
306339,
3243,
208044,
322733,
249003,
339131,
290001,
339167,
298209,
290030,
208123,
322826,
126229,
298290,
208179,
159033,
216387,
372039,
224591,
331091,
314708,
150868,
314711,
314721,
281958,
314727,
134504,
306541,
314740,
314742,
314745,
290170,
224637,
306558,
290176,
306561,
314752,
314759,
298378,
314765,
314771,
306580,
224662,
282008,
314776,
282013,
290206,
314788,
298406,
282023,
241067,
314797,
306630,
306634,
339403,
191980,
282097,
191991,
290304,
323079,
323083,
323088,
282132,
282135,
175640,
282147,
306730,
290359,
323132,
282182,
224848,
224852,
290391,
306777,
282214,
224874,
314997,
290425,
339579,
282244,
282248,
323208,
323226,
282272,
282279,
298664,
298666,
306875,
282302,
323262,
323265,
282309,
306891,
241360,
282321,
241366,
282330,
282336,
12009,
282347,
282349,
323315,
200444,
282366,
249606,
323335,
282375,
282379,
216844,
118549,
282390,
282399,
241440,
282401,
339746,
315172,
216868,
241447,
282418,
282424,
282428,
413500,
241471,
315209,
159563,
307024,
307030,
241494,
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,
307269,
233548,
315468,
315477,
323678,
315488,
315489,
45154,
307306,
233578,
241809,
323730,
299166,
233635,
299176,
184489,
323761,
184498,
258233,
299197,
299202,
176325,
299208,
233678,
282832,
356575,
307431,
184574,
217352,
282908,
299294,
282912,
233761,
282920,
315698,
282938,
307514,
127292,
168251,
323914,
201037,
282959,
250196,
168280,
323934,
381286,
242027,
242028,
250227,
315768,
291193,
291194,
291200,
242059,
315798,
291225,
242079,
283039,
299449,
291266,
283088,
283089,
176602,
242138,
160224,
291297,
242150,
283138,
233987,
324098,
340489,
283154,
291359,
283185,
234037,
340539,
332379,
111197,
242274,
291455,
316044,
184974,
316048,
340645,
176810,
299698,
291529,
225996,
135888,
242385,
299737,
234216,
234233,
242428,
291584,
299777,
291591,
291605,
283418,
234276,
283431,
242481,
234290,
201534,
283466,
234330,
201562,
275294,
349025,
357219,
177002,
308075,
242540,
201590,
177018,
308093,
291713,
340865,
299912,
316299,
234382,
308111,
308113,
209820,
283551,
177074,
127945,
340960,
234469,
340967,
324587,
234476,
201721,
234499,
234513,
316441,
300087,
21567,
308288,
160834,
349254,
300109,
234578,
250965,
250982,
234606,
300145,
300147,
234626,
234635,
177297,
308375,
324761,
119965,
234655,
300192,
234662,
300200,
324790,
300215,
283841,
283846,
283849,
316628,
316661,
283894,
234741,
292092,
234756,
242955,
177420,
292145,
300342,
193858,
300355,
300354,
234830,
283990,
357720,
300378,
300379,
316764,
292194,
284015,
234864,
316786,
243073,
292242,
112019,
234902,
284086,
259513,
284090,
54719,
415170,
292291,
300488,
300490,
234957,
144862,
300526,
308722,
300539,
210429,
292359,
218632,
316951,
374297,
235069,
349764,
194118,
292424,
292426,
333389,
349780,
128600,
235096,
300643,
300645,
243306,
325246,
333438,
235136,
317102,
300725,
300729,
333522,
325345,
153318,
333543,
284410,
284425,
300810,
300812,
284430,
161553,
284436,
325403,
341791,
325411,
186148,
186149,
333609,
284460,
300849,
325444,
153416,
325449,
325460,
317268,
341846,
284508,
300893,
284515,
276326,
292713,
292719,
325491,
317305,
317308,
325508,
333700,
243592,
325514,
350091,
350092,
350102,
333727,
333734,
219046,
284584,
292783,
300983,
153553,
292835,
292838,
317416,
325620,
333827,
243720,
292901,
325675,
243763,
325695,
227432,
194667,
284789,
292987,
227459,
194692,
235661,
333968,
153752,
284827,
333990,
284840,
284843,
227517,
309443,
227525,
301255,
227536,
301270,
301271,
325857,
317676,
309504,
194832,
227601,
334104,
211239,
334121,
317738,
325930,
227655,
383309,
391521,
285031,
416103,
211327,
227721,
227730,
285074,
317851,
285083,
293275,
227743,
285089,
293281,
375211,
334259,
293309,
317889,
129484,
326093,
285152,
195044,
334315,
236020,
293368,
317949,
334345,
309770,
342537,
342560,
227881,
293420,
236080,
23093,
244279,
244280,
301635,
309831,
55880,
301647,
326229,
309847,
244311,
244326,
301688,
301702,
334473,
326288,
227991,
285348,
318127,
285360,
293552,
285362,
342705,
154295,
342757,
285419,
170735,
342775,
375552,
228099,
285443,
285450,
326413,
285457,
285467,
318247,
203560,
293673,
318251,
301872,
285493,
285496,
301883,
342846,
293702,
318279,
244569,
301919,
293729,
351078,
310132,
228214,
269179,
228232,
416649,
252812,
293780,
310166,
277404,
310177,
293801,
326571,
326580,
326586,
359365,
211913,
56270,
203758,
277493,
293894,
293911,
326684,
113710,
318515,
203829,
277600,
285795,
228457,
318571,
187508,
302202,
285819,
285823,
285833,
285834,
318602,
228492,
162962,
187539,
285850,
302239,
302251,
294069,
294075,
64699,
228541,
343230,
310496,
228587,
302319,
228608,
318732,
318746,
130342,
130344,
130347,
286012,
294210,
286019,
294220,
318804,
294236,
327023,
327030,
310650,
179586,
294278,
318860,
368012,
318876,
343457,
245160,
286128,
286133,
310714,
302523,
228796,
302530,
228804,
310725,
302539,
310731,
310735,
310747,
286176,
187877,
310758,
40439,
286201,
359931,
286208,
245249,
228868,
302602,
294413,
359949,
302613,
302620,
310853,
286281,
196184,
212574,
204386,
204394,
138862,
310896,
294517,
286344,
179853,
286351,
188049,
229011,
179868,
229021,
302751,
245413,
286387,
286392,
302778,
286400,
212684,
302798,
286419,
294621,
294629,
286457,
286463,
319232,
278273,
278292,
278294,
286507,
294699,
319289,
237397,
188250,
237411,
327556,
188293,
311183,
294806,
294808,
319393,
294820,
294824,
343993,
98240,
294849,
24531,
294887,
278507,
311277,
327666,
278515
] |
19e4eadab609b65d12365b238d8ff5c115685520 | 247b91d73233684d33617321b363257e7b8a11a6 | /lect-4/Collections.playground/Contents.swift | 9eea9a55617a205d2765b701fbece385e4fa223b | [] | no_license | Awsy/Sigma_iOS | a42f94be0ffa790b8e30cbcf1b4de412b7f96ce3 | 496a2e9465721c9a3a48b82486d555dd49c78860 | refs/heads/master | 2023-06-13T01:23:45.661384 | 2021-07-01T13:45:29 | 2021-07-01T13:45:29 | 348,660,989 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 12,989 | swift | import Foundation
// First task - Arrays
/*
1- Опишіть масив fibArray з десяти перших чисел Фібонначі (можна згенерувати або ж використати hardcode).
*/
var fibArray: [Int] = [0, 1]
func fib(_ n: Int) -> [Int] {
if n <= 1 {
return fibArray
}
for _ in 0..<n - 2 {
let firstNum = fibArray[fibArray.count - 2]
let secondNum = fibArray.last!
fibArray.append(firstNum + secondNum)
}
return fibArray
}
print(fib(10))
//-------------------------------
/*
2- Створіть масив revArray, елементи якого знаходяться в
оберненому порядку відносно масиву fibArray. Зробіть реверсію
масива кількома способами
*/
// First variant
var revArray = fibArray
print(revArray)
revArray.reverse()
print(revArray)
// Second Variant
let reversedArray = revArray.sorted { $0 > $1 }
print(reversedArray)
// Third variant
var reversedArr2 : [Int] = []
for element in revArray.reversed(){
reversedArr2.append(element)
}
print(revArray)
//-------------------------------
/*
3- Створіть масив shuffledArray, елементи якого перемішані відносно
масиву fibArray. Використайте мінімально можливу операцію для
виконання цього пункту. (завдання на логіку)
*/
var shuffledArray = fibArray
shuffledArray.shuffle()
//-------------------------------
/*
4- Опишіть масив простих чисел snglArray, які не перевищують число
100.
*/
var snglArray: [Int] = []
snglArray.append(contentsOf: 0..<100)
print(snglArray)
//-------------------------------
/*
5- Виведіть на екран кількість елементів масиву snglArray.
*/
snglArray.count
//-------------------------------
/*
6- Виведіть на екран 10-й елемент масив snglArray.
*/
print(snglArray[10])
//-------------------------------
/*
7- Виведіть на екран підмасив елементів масиву snglArray,
починаючи з 15-го та закінчуючи 20-м елементами.
*/
print(snglArray[15...20])
//-------------------------------
/*
8- Створіть масив rptArray з 10 елементів, що рівні 10-му елементу
масиву snglArray.
*/
var rptArray = Array(repeating: 1, count: 10)
print(rptArray)
//-------------------------------
/*
9- Опишіть масив непарних чисел oddArray (не менших за число 0, та
не більших за число 10), використовуючи init(arrayLiteral:).
*/
var oddArray: Array<Int> = Array<Int>(arrayLiteral: 1, 3, 5, 7, 9)
//-------------------------------
/*
10- Додайте до масиву oddArray число 11.
*/
oddArray.append(11)
//-------------------------------
/*
11- Додайте до масиву oddArray числа 15, 17, 19 у якості підмасиву.
*/
oddArray.insert(contentsOf: [15, 17, 19], at: oddArray.count)
//-------------------------------
/*
12- Вставте у масив oddArray число 13 на позицію між числами 11 та
15.
*/
oddArray.insert(13, at: 6)
//-------------------------------
/*
13- Видаліть елементи масиву oddArray, пичинаючи з 5-го та
закінчуючи 8-им (невключно) елементами.
*/
oddArray.removeSubrange(5..<8)
//-------------------------------
/*
14- Видаліть останній елемент масиву oddArray та виведіть його на
екран.
*/
print(oddArray.removeLast())
//-------------------------------
/*
15- Замініть елементи масиву oddArray, починаючи з 2-го та
закінчуючи останнім, на масив з числовими елементами 2, 3, 4.
*/
oddArray.replaceSubrange(2...oddArray.count - 1, with: [2, 3, 4])
//-------------------------------
/*
16- Видаліть елемент масиву oddArray, який рівний числу 3.
*/
oddArray = oddArray.filter { $0 != 3 }
print(oddArray)
//-------------------------------
/*
17- Виведіть значення, яке визначає, чи міститься число 3 у масиві
oddArray.
*/
oddArray.contains(3)
//-------------------------------
/*
18- Виведіть на екран рядкове представлення масиву oddArray.
*/
var strArray = "\(oddArray)"
type(of: strArray)
//-------------------------------
// Second task - Sets
/*
1- Опишіть множину chSet із символів а, b, c та d.
*/
var chSet: Set<Character> = ["a", "b", "c", "d"]
//-------------------------------
/*
2- Створіть mutable множину mChSet на основі множини chSet.
*/
var mChSet: Set<Character>?
mChSet = chSet
//-------------------------------
/*
3- Виведіть на екран кількість елементів множини mChSet.
*/
mChSet?.count
//-------------------------------
/*
4- Вставте символ е в множину mChSet.
*/
mChSet?.insert("e")
//-------------------------------
/*
5- Створіть множину srtChSet, яка є відсортованою версією
множини mChSet.
*/
var srtChSet = mChSet?.sorted()
//-------------------------------
/*
6- Видаліть з множини mChSet символ f та виведіть видалений
символ на екран.
*/
mChSet?.remove("f")
//-------------------------------
/*
7- Видаліть символ d з множини mChSet за його індексом та
виведіть рядкове представлення множини mChSet.
*/
var delMCHSet = mChSet?.firstIndex(of: "d")
mChSet?.remove(at: delMCHSet!)
print(mChSet!)
/*
8- Виведіть відстань у множині mChSet між першим елементом та
символом а.
*/
var firstElement = mChSet?.startIndex
var lastElement = mChSet?.firstIndex(of: "a")
mChSet?.distance(from: firstElement!, to: lastElement!)
//-------------------------------
/*
9- Вставте символ а в множину mChSet.
*/
mChSet?.insert("a")
//-------------------------------
/*
10- Опишіть множини aSet (зі значеннями One, Two, Three, 1, 2) та
bSet (зі значеннями 1, 2, 3, One, Two).
*/
var One = 1
var Two = 2
var Three = 3
var aSet: Set<Int> = [One, Two, Three, 1, 2]
var bSet: Set<Int> = [1, 2, 3, One, Two]
//-------------------------------
/*
11- Створіть множину, яка містить всі спільні елементи для множин
aSet та bSet.
*/
var commonSet = aSet.intersection(bSet)
//-------------------------------
/*
12- Створіть множину, яка містить унікальні елементи у множині aSet
по відношенню до множини bSet. Створіть множину, яка містить
унікальні елементи у множині bSet по відношенню до множини
aSet.
*/
var uniqueAElements = aSet.subtracting(bSet)
var uniqueBElements = bSet.subtracting(aSet)
//-------------------------------
/*
13- Створіть множину, яка містить елементи, які не є спільними для
множин aSet та bSet.
*/
var uniqueElements = bSet.symmetricDifference(aSet)
//-------------------------------
/*
14- Створіть множину, яка об'єднує усі елементи множин aSet та
bSet.
*/
var unitedElements = aSet.union(bSet)
//-------------------------------
/*
15- Опишіть множини xSet (зі значеннями 2...4), ySet (зі значеннями
1...6), zSet (зі значеннями 3, 4, 2) та x1Set (зі значеннями 5, 6, 7).
*/
var xSet: Set<Int>
var ySet: Set<Int>
xSet = Set(2..<4)
ySet = Set(1..<7)
var zSet: Set<Int> = [3, 4, 2]
var x1Set: Set<Int> = [5, 6, 7]
//-------------------------------
/*
16- Виведіть значення, які визначають чи множина xSet входить у
множину ySet, а також чи множина ySet входить у множину xSet.
*/
xSet.isSubset(of: ySet)
ySet.isSubset(of: xSet)
//-------------------------------
/*
17- Виведіть значення, які визначають чи множина xSet містить
множину ySet, а також чи множина ySet містить множину xSet.
*/
xSet.isSuperset(of: ySet)
ySet.isSuperset(of: xSet)
//-------------------------------
/*
18- Виведіть значеня, яке визначає чи множини xSet та zSet є
рівними.
*/
xSet.elementsEqual(zSet)
//-------------------------------
/*
19- Виведіть значення, яке визначає чи множина xSet входить у
множину zSet, але не є рівною множині zSet.
*/
zSet.isStrictSuperset(of: xSet)
//-------------------------------
/*
20- Виведіть значення, яке визначає чи множина xSet містить
множину zSet, але не є рівною множині zSet.
*/
xSet.isStrictSuperset(of: zSet)
//-------------------------------
// Third task - Dictionaries
/*
1- Опишіть словник nDict, ключами якого є числові рядкові
предсталення чисел від 1 до 5, а відповідними значеннями є
рядкові представлення чисел від 1 до 5 на англійській мові
(наприклад, 1:”One”).
*/
var nDict = [1: "One", 2: "Two", 3: "Three", 4: "Four", 5: "five"]
//-------------------------------
/*
2- Виведіть на екран значення масиву nDict за ключем 3.
*/
nDict[3]
//-------------------------------
/*
3- Виведіть на екран значення масиву nDict за індексом ключа 4.
*/
nDict.index(forKey: 4)
//-------------------------------
/*
4- Створіть mutable словник mNDict на основі словника nDict.
*/
var mNDict: [Int:String]
mNDict = nDict
//-------------------------------
/*
5- Додайте елементи 6:”Seven” та 7:”Six” до словника mNDict.
*/
mNDict[6] = "Seven"
mNDict[7] = "Six"
//-------------------------------
/*
6- Оновіть значення елементів словника mNDict, не використовуючи
subscript [], до наступних: 6:”Six”, 7:”Seven”, 8:”Eight”.
*/
mNDict.updateValue("Six", forKey: 6)
mNDict.updateValue("Seven", forKey: 7)
mNDict.updateValue("Eight", forKey: 8)
//-------------------------------
/*
7- Видаліть елемент за ключем 5 зі словника mNDict.
*/
mNDict.removeValue(forKey: 5)
//-------------------------------
/*
8- Видаліть елемент за індексом ключа 4 зі словника mNDict.
*/
mNDict.remove(at: mNDict.index(forKey: 4)!)
//-------------------------------
/*
9- Визначіть та виведіть на екран відстань у словнику mNDict між
парами значень 1:”One” та 7:”Seven”.
*/
var elementOne = mNDict.index(forKey: 1)
var elementSeven = mNDict.index(forKey: 7)
if elementOne! < elementSeven! {
mNDict.distance(from: elementOne!, to: elementSeven!)
}
if elementSeven! < elementOne! {
mNDict.distance(from: elementSeven!, to: elementOne!)
}
//-------------------------------
/*
10- Створіть масив mNDictKeys, елементами якого є усі ключі
словника mNDict.
*/
var mNDictKeys: Array<Int>
mNDictKeys = Array(mNDict.keys)
//-------------------------------
/*
11- Створіть масив mNDictKeys, елементами якого є усі значення
словника mNDict.
*/
var mNDictValues: Array<String>
mNDictValues = Array(mNDict.values)
//-------------------------------
/*
12- Виведіть на екран кількість елементів словника mNDict, а також
кількість його всіх ключів та його всіх значень.
*/
mNDict.count
var mnDictKeys = mNDict.keys
mNDictKeys.count
var mNDictKeyValue = mNDict.values
mNDictKeyValue.count
//-------------------------------
/*
13- Виведіть на екран рядкове представлення словника mNDict.
*/
// Не до конца понял что тут конкретно требуется
print("\(mNDict)")
//-------------------------------
| [
-1
] |
498a16cd8ad547f5d256aceba680d32c9c34724a | 79003797e7e1e076680a7d44330d77fb60d2f155 | /Tests/Mock Projects/Before/BadStyle/Sources/BadStyle/Rules/Source Code Style/ClosureSignaturePosition.swift | a3e9bdf88320cab21bc57b852255abfd32863f88 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | SDGGiesbrecht/Workspace | cfca54d8aff2ffdaac8a7c7d877b4e02a91ca7f5 | b308eed4b64652fba70046f47c6ee524c3398e63 | refs/heads/master | 2023-08-17T11:04:15.710248 | 2023-07-25T02:57:28 | 2023-07-25T02:57:28 | 78,145,347 | 101 | 7 | NOASSERTION | 2023-07-25T02:55:52 | 2017-01-05T20:21:11 | Swift | UTF-8 | Swift | false | false | 247 | swift | private let good: (String) -> Void = { parameter in // Positioned correctly; should not trigger.
print("Hello, world.")
}
private let bad: (String) -> Void = {
parameter in // Wrong position; should trigger.
print("Hello, world!")
}
| [
-1
] |
53d59b5e34b313697662c1bd8b87f9b61d8aaa05 | 6c7a2131aec8991e10ad3d0a893c42d6009109a0 | /MarvelApp/BaseComponents/Models/Character.swift | 3e7f039061250660ea638cffeed9ba7b25732afa | [
"Apache-2.0"
] | permissive | alejandroruizponce/bq-ios-coding-test | 30a1eeb9744c72b101c02426406a745b0f77b050 | ed07e3d2e4cb2268122ce74e3c26b1b5fdc3ccf3 | refs/heads/master | 2022-11-19T00:37:45.659730 | 2020-07-16T09:41:35 | 2020-07-16T09:41:35 | 279,944,288 | 0 | 0 | Apache-2.0 | 2020-07-15T18:17:54 | 2020-07-15T18:17:53 | null | UTF-8 | Swift | false | false | 168 | swift | import Foundation
// MARK: - Character
struct Character: Codable {
let name: String
let description: String?
let image: String?
let comicsCount: Int
}
| [
-1
] |
1c36727b0ac8c96aa699776bc00010e67a15eb1e | 3545db04403f9f1c08095005423d68512917d7e9 | /Rack/Rack/ThirdParty/GLViewPagerViewController.swift | e86a182db09ad73bbf35d56ea933cee7caca5818 | [] | no_license | DanijelJefic/rackcode | 6037b7fea8528161ebc6e6876ddf56caee78b0e8 | cd97667b04da09ce70bd7df5896ae5e1aa19ed2d | refs/heads/master | 2021-08-23T08:34:44.145818 | 2017-12-04T09:57:29 | 2017-12-04T09:57:29 | 111,776,672 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 29,178 | swift | //
// GLViewPagerViewController.swift
// GLViewPagerViewControllerForSwift
//
// Created by Yanci on 2017/6/26.
// Copyright © 2017年 Yanci. All rights reserved.
//
import UIKit
public enum GLIndicatorType:Int {
case GLIndicatorType_Line = 0
case GLIndicatorType_Rect = 1
}
public enum GLTabAnimationType:Int {
/* no animation */
case GLTabAnimationType_None = 0
/* animation while scrolling */
case GLTabAnimationType_WhileScrolling = 1
/* animation when ending */
case GLTabAnimationType_End = 2
}
// MARK: - Protocols
@objc public protocol GLViewPagerViewControllerDataSource:NSObjectProtocol {
@objc optional func numberOfTabsForViewPager(_ viewPager:GLViewPagerViewController) -> Int
@objc optional func viewForTabIndex(_ viewPager:GLViewPagerViewController, index: Int) -> UIView
@objc optional func contentViewControllerForTabAtIndex(_ viewPager:GLViewPagerViewController, index: Int) -> UIViewController
@objc optional func contentViewForTabAtIndex(_ viewPager:GLViewPagerViewController, index: Int) -> UIView
}
@objc public protocol GLViewPagerViewControllerDelegate:NSObjectProtocol {
@objc optional func didChangeTabToIndex(_ viewPager: GLViewPagerViewController, index: Int, fromTabIndex: Int)
@objc optional func willChangeTabToIndex(_ viewPager: GLViewPagerViewController, index: Int, fromTabIndex: Int, progress: CGFloat)
@objc optional func widthForTabIndex(_ viewPager: GLViewPagerViewController, index: Int) -> CGFloat
}
open class GLViewPagerViewController: UIViewController, UIPageViewControllerDataSource,UIPageViewControllerDelegate,UIScrollViewDelegate {
// MARK: - public properties
open var dataSource: GLViewPagerViewControllerDataSource?
open var delegate: GLViewPagerViewControllerDelegate?
open var indicatorColor: UIColor = UIColor.blue
open var fixTabWidth: Bool = false
open var tabWidth:CGFloat = 128.0
open var tabHeight:CGFloat = 44.0
open var indicatorHeight:CGFloat = 2.0
open var indicatorWidth:CGFloat = 128.0
open var fixIndicatorWidth:Bool = false
open var padding:CGFloat = 0.0
open var leadingPadding:CGFloat = 0.0
open var trailingPadding:CGFloat = 0.0
open var defaultDisplayPageIndex = 0
open var animationTabDuration:CGFloat = 0.3
open var tabAnimationType:GLTabAnimationType = GLTabAnimationType.GLTabAnimationType_None
open var supportArabic:Bool = false
// MARK: - ui properties
internal var pageViewController: UIPageViewController = UIPageViewController(transitionStyle: .scroll, navigationOrientation: .horizontal, options: nil)
internal var tabContentView: UIScrollView = UIScrollView()
internal var indicatorView: UIView = UIView();
// MARK: - cache properties
internal var _needsReload: Bool = false
internal var leftTabOffsetWidth: CGFloat = 0
internal var rightTabOffsetWidth: CGFloat = 0
internal var leftMinusCurrentWidth: CGFloat = 0
internal var rightMinusCurrentWidth: CGFloat = 0
internal var _currentPageIndex: Int = 0
internal var _enableTabAnimationWhileScrolling:Bool = false
internal var contentViewControllers:[UIViewController] = []
internal var contentViews:[UIView] = []
internal var tabViews:[UIView] = []
//internal var datasouceHas = _datasourceHas(numberOfTabsForViewPager: false, viewForTabIndex: false, contentViewControllerForTabAtIndex: false, contentViewForTabAtIndex: false)
//internal var delegateHas = _delegateHas(didChangeTabToIndex: false, willChangeTabToIndex: false, widthForTabIndex: false)
// MARK: - const
let kTabTagBegin:Int = 0xA0
let kTabHeight:CGFloat = 44.0
struct _datasourceHas{
static var numberOfTabsForViewPager:Bool = false
static var viewForTabIndex:Bool = false
static var contentViewControllerForTabAtIndex:Bool = false
static var contentViewForTabAtIndex:Bool = false
}
struct _delegateHas{
static var didChangeTabToIndex:Bool = false
static var willChangeTabToIndex:Bool = false
static var widthForTabIndex:Bool = false
}
// MARK: - Life cycle
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
self.commonInit()
}
public required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.commonInit()
}
override open func awakeFromNib() {
super.awakeFromNib()
}
override open func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override open func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
override open func loadView() {
self.view = UIView(frame: UIScreen.main.bounds)
self.view.backgroundColor = UIColor.colorFromHex(hex: kColorDarkGray)
self.view .addSubview(UIView.init())
self.view .addSubview(self.tabContentView)
/*
//self.view .addSubview(self.pageViewController.view)
1. To get navigation controller
2. To get parent.parent
*/
addChildViewController(self.pageViewController)
self.view.addSubview(self.pageViewController.view)
self.pageViewController.didMove(toParentViewController: self)
}
override open func viewWillLayoutSubviews() {
self ._reloadDataIfNeed()
self ._layoutSubviews()
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
// MARK: - Data Source
open func pageViewController(_ pageViewController: UIPageViewController, viewControllerBefore viewController: UIViewController) -> UIViewController? {
if self.supportArabic {
let index:Int = self.contentViewControllers .index(of: viewController)!
if index == self.contentViewControllers.count - 1 {
return nil
}
return self.contentViewControllers[index + 1]
}
let index:Int = self.contentViewControllers .index(of: viewController)!
if index == 0 {
return nil
}
return self.contentViewControllers[index - 1]
}
open func pageViewController(_ pageViewController: UIPageViewController, viewControllerAfter viewController: UIViewController) -> UIViewController? {
if self.supportArabic {
let index:Int = self.contentViewControllers .index(of: viewController)!
if index == 0 {
return nil
}
return self.contentViewControllers[index - 1]
}
let index:Int = self.contentViewControllers .index(of: viewController)!
if index == self.contentViewControllers.count - 1 {
return nil
}
return self.contentViewControllers[index + 1]
}
// MARK: - Delegate
open func pageViewController(_ pageViewController: UIPageViewController, didFinishAnimating finished: Bool, previousViewControllers: [UIViewController], transitionCompleted completed: Bool) {
if completed {
let currentPageIndex:Int = self.contentViewControllers .index(of: self.pageViewController.viewControllers![0])!
let prevPageIndex:Int = self.contentViewControllers .index(of: previousViewControllers[0])!
self ._setActiveTabIndex(tabIndex: currentPageIndex)
self ._caculateTabOffsetWidth(pageIndex: currentPageIndex)
_currentPageIndex = currentPageIndex
if _delegateHas.didChangeTabToIndex {
delegate?.didChangeTabToIndex?(self, index: currentPageIndex, fromTabIndex: prevPageIndex)
}
if self.tabAnimationType == GLTabAnimationType.GLTabAnimationType_WhileScrolling {
_enableTabAnimationWhileScrolling = false
}
}
}
open func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
if self.tabAnimationType == GLTabAnimationType.GLTabAnimationType_WhileScrolling {
_enableTabAnimationWhileScrolling = true
}
}
open func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
if self.tabAnimationType == GLTabAnimationType.GLTabAnimationType_WhileScrolling {
_enableTabAnimationWhileScrolling = false
}
}
open func scrollViewDidScroll(_ scrollView: UIScrollView) {
if self.tabAnimationType == GLTabAnimationType.GLTabAnimationType_WhileScrolling && _enableTabAnimationWhileScrolling {
let scale:CGFloat = fabs(scrollView.contentOffset.x - scrollView.frame.size.width) / scrollView.frame.size.width
var offset:CGFloat = 0
var indicationAnimationWidth:CGFloat = 0
let currentPageIndex:Int = _currentPageIndex
var indicatorViewFrame:CGRect = self ._caculateTabViewFrame(tabIndex: currentPageIndex)
// left to right
if scrollView.contentOffset.x - scrollView.frame.size.width > 0 {
if self.supportArabic {
offset = -leftTabOffsetWidth * scale
indicationAnimationWidth = CGFloat(indicatorViewFrame.size.width + leftMinusCurrentWidth * scale)
}
else {
offset = rightTabOffsetWidth * scale
indicationAnimationWidth = CGFloat(indicatorViewFrame.size.width + rightMinusCurrentWidth * scale)
}
if _delegateHas.willChangeTabToIndex {
if self.supportArabic {
delegate?.willChangeTabToIndex?(self, index: currentPageIndex == 0 ? 0 : currentPageIndex - 1, fromTabIndex: currentPageIndex, progress: scale)
}
else {
delegate?.willChangeTabToIndex?(self, index: (currentPageIndex + 1 > self.tabViews.count - 1) ? currentPageIndex : currentPageIndex + 1, fromTabIndex: currentPageIndex, progress: scale)
}
}
}
// right to left
else {
if self.supportArabic {
offset = rightTabOffsetWidth * scale
indicationAnimationWidth = indicatorViewFrame.size.width + rightMinusCurrentWidth * scale
}
else {
offset = -leftTabOffsetWidth * scale
indicationAnimationWidth = indicatorViewFrame.size.width + leftMinusCurrentWidth * scale
}
if _delegateHas.willChangeTabToIndex {
if self.supportArabic {
delegate?.willChangeTabToIndex?(self, index: currentPageIndex == self.contentViewControllers.count - 1 ? self.contentViewControllers.count - 1 : currentPageIndex + 1, fromTabIndex: currentPageIndex, progress: scale)
}
else {
delegate?.willChangeTabToIndex?(self, index: currentPageIndex == 0 ? 0 : currentPageIndex - 1, fromTabIndex: currentPageIndex, progress: scale)
}
}
}
indicatorViewFrame.origin.x += offset
indicatorViewFrame.size.width = indicationAnimationWidth
self.indicatorView.frame = indicatorViewFrame
}
}
// MARK: - User Events
func tapInTabView(tapGR:UIGestureRecognizer) -> Void {
let tabIndex = (tapGR.view?.tag)! - kTabTagBegin
self ._selectTab(tabIndex: tabIndex, animate: false)
}
// MARK: - Functions
func commonInit () {
self.indicatorColor = UIColor.blue
self.fixTabWidth = true
self.tabWidth = 128.0
self.tabHeight = 44.0
self.indicatorHeight = 2.0
self.padding = 0.0
self.indicatorWidth = 128.0
self.fixIndicatorWidth = true
self.leadingPadding = 0.0
self.trailingPadding = 0.0
self.defaultDisplayPageIndex = 0
self.tabAnimationType = GLTabAnimationType.GLTabAnimationType_None
self.animationTabDuration = 0.3
self.pageViewController.dataSource = self
self.pageViewController.delegate = self
for view in self.pageViewController.view.subviews {
if let scrollView = view as? UIScrollView {
scrollView.delegate = self
}
}
self._setNeedsReload()
}
open func setDataSource(newDataSource:GLViewPagerViewControllerDataSource) -> Void {
self.dataSource = newDataSource
_datasourceHas.numberOfTabsForViewPager = newDataSource.responds(to: #selector(GLViewPagerViewControllerDataSource.numberOfTabsForViewPager(_:)))
_datasourceHas.contentViewForTabAtIndex = newDataSource.responds(to: #selector(GLViewPagerViewControllerDataSource.contentViewForTabAtIndex(_:index:)))
_datasourceHas.viewForTabIndex = newDataSource.responds(to: #selector(GLViewPagerViewControllerDataSource.viewForTabIndex(_:index:)))
_datasourceHas.contentViewControllerForTabAtIndex = newDataSource.responds(to: #selector(GLViewPagerViewControllerDataSource.contentViewControllerForTabAtIndex(_:index:)))
self ._setNeedsReload()
}
open func setDelegate(newDelegate:GLViewPagerViewControllerDelegate) -> Void {
self.delegate = newDelegate
_delegateHas.didChangeTabToIndex = newDelegate.responds(to: #selector(GLViewPagerViewControllerDelegate.didChangeTabToIndex(_:index:fromTabIndex:)))
_delegateHas.willChangeTabToIndex = newDelegate.responds(to: #selector(GLViewPagerViewControllerDelegate.willChangeTabToIndex(_:index:fromTabIndex:progress:)))
_delegateHas.widthForTabIndex = newDelegate.responds(to: #selector(GLViewPagerViewControllerDelegate.widthForTabIndex(_:index:)))
}
func reloadData() -> Void {
// Set ui control property
self.indicatorView.backgroundColor = self.indicatorColor
// Clear tab subviews
self.tabViews .removeAll()
for (_,element) in self.tabContentView.subviews.enumerated() {
element.removeFromSuperview()
}
// Fill tab
var numberOfTabs:Int! = 0
if _datasourceHas.numberOfTabsForViewPager {
numberOfTabs = dataSource?.numberOfTabsForViewPager!(self)
}
if _datasourceHas.viewForTabIndex {
// Add indicator view
if !self.tabContentView.subviews .contains(self.indicatorView) && numberOfTabs > 0{
self.tabContentView .addSubview(self.indicatorView)
}
var preTabView:UIView?
var tabContentWidth:CGFloat = 0.0
for index in 0 ... numberOfTabs - 1 {
var tabView:UIView! = UIView.init()
if self.supportArabic {
tabView = (self.dataSource?.viewForTabIndex!(self, index: numberOfTabs - index - 1))
assert(tabView .isKind(of: UIView.self), "This is not an UIView subclass")
self.tabContentView .addSubview(tabView)
self.tabViews .insert(tabView, at: 0)
tabView.tag = kTabTagBegin + (numberOfTabs - index - 1)
}
else {
tabView = dataSource?.viewForTabIndex!(self, index: index)
assert(tabView .isKind(of: UIView.self), "This is not an UIView subclass")
self.tabContentView .addSubview(tabView)
self.tabViews .append(tabView)
tabView.tag = kTabTagBegin + index
}
tabView.isUserInteractionEnabled = true
tabView .addGestureRecognizer(UITapGestureRecognizer.init(target: self, action: #selector(self.tapInTabView(tapGR:))))
if preTabView == nil {
var rect:CGRect = tabView.frame
rect.size.width = self.fixTabWidth ? self.tabWidth : self ._getTabWidthAtIndex(tabIndex: index)
rect.size.height = self.tabHeight
rect.origin.x = self.leadingPadding
rect.origin.y = 0
tabView.frame = rect
preTabView = tabView
tabContentWidth += self.fixTabWidth ? (self.tabWidth + self.leadingPadding) : (self._getTabWidthAtIndex(tabIndex: self.supportArabic ? 0 : index) + self.leadingPadding)
}
else {
var rect:CGRect = tabView.frame
rect.size.width = self.fixTabWidth ? self.tabWidth : self ._getTabWidthAtIndex(tabIndex: self.supportArabic ? 0 : index)
rect.size.height = self.tabHeight
rect.origin.x = preTabView!.frame.maxX + self.padding
rect.origin.y = 0
tabView.frame = rect
preTabView = tabView
tabContentWidth += (self.fixTabWidth ? self.tabWidth : self._getTabWidthAtIndex(tabIndex: self.supportArabic ? 0 : index)) + self.padding
}
if index == numberOfTabs - 1 {
tabContentWidth += self.trailingPadding
}
}
self.tabContentView.contentSize = CGSize(width: tabContentWidth, height: kTabHeight)
}
self.contentViews .removeAll()
self.contentViewControllers.removeAll()
if _datasourceHas.contentViewControllerForTabAtIndex {
for i in 0 ... numberOfTabs - 1 {
var viewController:UIViewController!
if self.supportArabic {
viewController = self.dataSource?.contentViewControllerForTabAtIndex!(self, index: numberOfTabs - i - 1)
assert(viewController .isKind(of: UIViewController.self), "This is not an UIViewController subclass")
self.contentViewControllers .insert(viewController, at: 0)
}
else {
viewController = self.dataSource?.contentViewControllerForTabAtIndex!(self, index: i)
assert(viewController .isKind(of: UIViewController.self), "This is not an UIViewController subclass")
self.contentViewControllers .append(viewController)
}
}
assert(self.defaultDisplayPageIndex <= self.contentViewControllers.count - 1, "Default display page index is bigger than amount of view controller")
self._setActivePageIndex(pageIndex: self.defaultDisplayPageIndex)
self._setActiveTabIndex(tabIndex: self.defaultDisplayPageIndex)
self._caculateTabOffsetWidth(pageIndex: self.defaultDisplayPageIndex)
self._currentPageIndex = self.defaultDisplayPageIndex
if _delegateHas.didChangeTabToIndex {
delegate?.didChangeTabToIndex!(self, index: _currentPageIndex, fromTabIndex: self.defaultDisplayPageIndex)
}
}
else if _datasourceHas.contentViewForTabAtIndex {
// MARK: - TODO
}
_needsReload = false
}
open func tabViewAtIndex(index:Int) -> UIView {
return self.tabViews[index]
}
func _selectTab(tabIndex:Int,animate:Bool) -> Void {
let prevPageIndex:Int = _currentPageIndex
self._disableViewPagerScroll()
self._setActivePageIndex(pageIndex: tabIndex)
self._setActiveTabIndex(tabIndex: tabIndex)
self._caculateTabOffsetWidth(pageIndex: tabIndex)
_currentPageIndex = tabIndex
_enableTabAnimationWhileScrolling = false
self ._enableViewPagerScroll()
if _delegateHas.didChangeTabToIndex {
delegate?.didChangeTabToIndex!(self, index: _currentPageIndex, fromTabIndex: prevPageIndex)
}
}
func _setNeedsReload() -> Void {
_needsReload = true
self.view.setNeedsLayout()
}
func _reloadDataIfNeed() -> Void {
if _needsReload {
self .reloadData()
}
}
func _layoutSubviews() -> Void {
let topLayoutGuide:CGFloat = self.topLayoutGuide.length
let bottomLayoutGuide:CGFloat = self.bottomLayoutGuide.length
var tabContentViewFrame:CGRect = self.tabContentView.frame
tabContentViewFrame.size.width = self.view.bounds.size.width
tabContentViewFrame.size.height = kTabHeight
tabContentViewFrame.origin.x = 0
tabContentViewFrame.origin.y = topLayoutGuide
self.tabContentView.frame = tabContentViewFrame
var pageViewCtrlFrame:CGRect = self.pageViewController.view.frame
pageViewCtrlFrame.size.width = self.view.bounds.size.width
pageViewCtrlFrame.size.height = self.view.bounds.size.height - topLayoutGuide - bottomLayoutGuide - self.tabContentView.frame.height
pageViewCtrlFrame.origin.x = 0
pageViewCtrlFrame.origin.y = topLayoutGuide + self.tabContentView.frame.height
self.pageViewController.view.frame = pageViewCtrlFrame
}
func _setActiveTabIndex(tabIndex:Int) -> Void {
assert(tabIndex <= self.tabViews.count - 1, "Default display page index is bigger than amount of view ocntroller")
let frameofTabView:CGRect = self ._caculateTabViewFrame(tabIndex: tabIndex)
if self.tabAnimationType == GLTabAnimationType.GLTabAnimationType_End ||
self.tabAnimationType == GLTabAnimationType.GLTabAnimationType_WhileScrolling{
UIView .animate(withDuration: TimeInterval(self.animationTabDuration), animations: {
self.indicatorView.frame = frameofTabView
})
}
else if self.tabAnimationType == GLTabAnimationType.GLTabAnimationType_None {
self.indicatorView.frame = frameofTabView
}
let tabView:UIView = self.tabViews[tabIndex]
var frame:CGRect = tabView.frame
frame.origin.x += frame.width / 2
frame.origin.x -= self.view.frame.width / 2
frame.size.width = self.view.frame.width
if frame.origin.x < 0 {
frame.origin.x = 0
}
if frame.origin.x + frame.width > self.tabContentView.contentSize.width {
frame.origin.x = self.tabContentView.contentSize.width - self.view.frame.width
}
DispatchQueue.main.async {
self.tabContentView .scrollRectToVisible(frame, animated: true)
}
}
func _setActivePageIndex(pageIndex:Int) -> Void {
assert(pageIndex < self.contentViewControllers.count, "Default display page index is bigger than amount of view controller")
var direction:UIPageViewControllerNavigationDirection = self.supportArabic ? UIPageViewControllerNavigationDirection.forward : UIPageViewControllerNavigationDirection.reverse
if pageIndex > _currentPageIndex {
direction = self.supportArabic ? UIPageViewControllerNavigationDirection.reverse : UIPageViewControllerNavigationDirection.forward
}
self.pageViewController .setViewControllers([self.contentViewControllers[pageIndex]], direction: direction, animated: true, completion: nil)
}
func _getTabWidthAtIndex(tabIndex:Int) -> CGFloat {
var tabWidth:CGFloat = 0
let tabView:UIView = self.tabViews[tabIndex]
if _delegateHas.widthForTabIndex {
tabWidth = (delegate?.widthForTabIndex?(self, index: tabView.tag - kTabTagBegin))!
}
return tabWidth == 0 ? tabView.intrinsicContentSize.width : tabWidth
}
func _caculateTabViewFrame(tabIndex:Int) -> CGRect {
var frameOfTabView:CGRect = CGRect.zero
if self.fixTabWidth {
if self.supportArabic {
frameOfTabView.origin.x = self.tabContentView.contentSize.width - ( CGFloat(tabIndex) * self.tabWidth + (CGFloat(tabIndex) * self.padding) + self.trailingPadding) - self.tabWidth
frameOfTabView.origin.y = self.tabHeight - self.indicatorHeight
frameOfTabView.size.height = self.indicatorHeight
frameOfTabView.size.width = self.tabWidth
}
else {
frameOfTabView.origin.x = CGFloat(tabIndex) * self.tabWidth + (CGFloat(tabIndex) * self.padding) + self.leadingPadding
frameOfTabView.origin.y = self.tabHeight - self.indicatorHeight
frameOfTabView.size.height = self.indicatorHeight
frameOfTabView.size.width = self.tabWidth
}
}
else {
if self.supportArabic {
let previousTabView:UIView = (tabIndex < self.tabViews.count - 1) ? self.tabViews[tabIndex + 1] : UIView()
var x:CGFloat = 0
if tabIndex == self.tabViews.count - 1 {
x += self.leadingPadding
}
else {
x += self.padding
}
x += previousTabView.frame.maxX
frameOfTabView = CGRect.zero
frameOfTabView.origin.x = x
frameOfTabView.origin.y = self.tabHeight - self.indicatorHeight
frameOfTabView.size.height = self.indicatorHeight
frameOfTabView.size.width = self ._getTabWidthAtIndex(tabIndex: tabIndex)
}
else {
let previousTabView:UIView = tabIndex > 0 ? self.tabViews[tabIndex - 1] : UIView()
var x:CGFloat = 0
if tabIndex == 0 {
x += self.leadingPadding
}
else {
x += self.padding
}
x += previousTabView.frame.maxX
frameOfTabView = CGRect.zero
frameOfTabView.origin.x = x
frameOfTabView.origin.y = self.tabHeight - self.indicatorHeight
frameOfTabView.size.height = self.indicatorHeight
frameOfTabView.size.width = self._getTabWidthAtIndex(tabIndex: tabIndex)
}
}
return frameOfTabView
}
func _caculateTabOffsetWidth(pageIndex:Int) -> Void {
let currentTabIndex:Int = pageIndex
let currentTabView:UIView = self.tabViews[currentTabIndex]
let previousTabView:UIView? = currentTabIndex > 0 ? self.tabViews[currentTabIndex - 1] : nil
let afterTabView:UIView? = (currentTabIndex < self.tabViews.count - 1) ? self.tabViews[currentTabIndex + 1] : nil
if currentTabIndex == 0 {
leftTabOffsetWidth = self.leadingPadding
rightTabOffsetWidth = (afterTabView?.frame.minX)! - currentTabView.frame.minX
leftMinusCurrentWidth = 0
rightMinusCurrentWidth = (afterTabView?.frame.width)! - currentTabView.frame.width
}
else if (currentTabIndex == self.tabViews.count - 1) {
leftTabOffsetWidth = currentTabView.frame.minX - (previousTabView?.frame.minX)!
rightTabOffsetWidth = self.trailingPadding
leftMinusCurrentWidth = (previousTabView?.frame.width)! - currentTabView.frame.width
rightTabOffsetWidth = 0
}
else {
leftTabOffsetWidth = currentTabView.frame.minX - (previousTabView?.frame.minX)!
rightTabOffsetWidth = (afterTabView?.frame.minX)! - currentTabView.frame.minX
leftMinusCurrentWidth = (previousTabView?.frame.width)! - currentTabView.frame.width
rightMinusCurrentWidth = (afterTabView?.frame.width)! - currentTabView.frame.width
}
}
func _disableViewPagerScroll() -> Void {
for view in self.pageViewController.view.subviews {
if let scrollView = view as? UIScrollView {
scrollView.isScrollEnabled = false
}
}
}
func _enableViewPagerScroll() -> Void {
for view in self.pageViewController.view.subviews {
if let scrollView = view as? UIScrollView {
//Do something with fruit
scrollView.isScrollEnabled = true
}
}
}
}
| [
-1
] |
11cc91daf6458ed82bafc47428034a8778041df7 | c8f0dea9f12851cd56e093aaa052376e21049459 | /CustomToolsStudiogenesis/ApiServiceTool.swift | 08779b45caa422b98aaec561f0c2f1cb3c885fff | [] | no_license | jorgegomezdeveloper/CustomToolsStudiogenesis | 8366616545e248e97df4e75db34df1881bd0beea | 98bf5ef7c3849560fd972e329f5806f16d6fe802 | refs/heads/main | 2023-04-20T01:36:38.332043 | 2021-04-30T08:12:10 | 2021-04-30T08:12:10 | 362,428,601 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,704 | swift | //
// ApiServiceTool.swift
// CustomToolsStudiogenesis
//
// Created by Jorge GA-studiogenesis on 28/04/2021.
// Copyright © 2021 Jorge GA-studiogenesis. All rights reserved.
//
public enum HttpMethodType: String {
case get = "GET"
case post = "POST"
}
public class ApiService: NSObject {
var defaultSession: URLSession!
var dataGetTask: URLSessionDataTask?
var expectedContentLength: Int64 = 0
var buffer = Data()
public func fetchFeedForUrlString(idText: String, urlString: String, httpMethod: HttpMethodType, params: [String : Any], userTokenForAuthorization: String?, timeoutBigger: Bool = false, completion: @escaping (_ data: Any?, _ error: Bool)->Void) {
guard InternetConnectionTool().isConnectedToNetwork() else {
completion("errorInternetConnection", true)
return
}
DateTools().setGlobalStartDate(id: "ApiService - \(idText)")
dataGetTask?.cancel()
defaultSession = URLSession(configuration: .default)
var request = URLRequest(url: URL(string: urlString)!)
request.httpMethod = httpMethod.rawValue
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
if timeoutBigger {
request.timeoutInterval = 900
} else {
request.timeoutInterval = 15
}
if params.count > 0 {
request.httpBody = try? JSONSerialization.data(withJSONObject: params, options: [])
}
if userTokenForAuthorization != nil, userTokenForAuthorization != "" {
request.setValue("\(userTokenForAuthorization!)", forHTTPHeaderField: "Authorization")
}
defer {dataGetTask?.resume()}
dataGetTask = defaultSession.dataTask(with: request) { data, response, error in
defer {
self.dataGetTask = nil
}
DateTools().setGlobalEndDate()
if error != nil {
completion(error, true)
} else {
completion(data, false)
}
}
}
public func fetchFeedForUrlStringDelegate(idText: String, urlString: String, httpMethod: HttpMethodType, params: [String : String], userTokenForAuthorization: String?, timeoutBigger: Bool = false) {
DateTools().setGlobalStartDate(id: "ApiServiceDelegate - \(idText)")
dataGetTask?.cancel()
defaultSession = URLSession(configuration: .default, delegate: self, delegateQueue: nil)
var request = URLRequest(url: URL(string: urlString)!)
request.httpMethod = httpMethod.rawValue
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
if timeoutBigger {
request.timeoutInterval = 900
} else {
request.timeoutInterval = 15
}
if params.count > 0 {
request.httpBody = try? JSONSerialization.data(withJSONObject: params, options: [])
}
if userTokenForAuthorization != nil, userTokenForAuthorization != "" {
request.setValue("\(userTokenForAuthorization!)", forHTTPHeaderField: "Authorization")
}
dataGetTask = defaultSession.dataTask(with: request)
dataGetTask!.resume()
}
}
extension ApiService: URLSessionDataDelegate {
public func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive response: URLResponse,
completionHandler: @escaping (URLSession.ResponseDisposition) -> Void) {
expectedContentLength = response.expectedContentLength
print("expectedContentLength: ", expectedContentLength)
completionHandler(.allow)
}
public func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data) {
buffer.append(data)
let percentageDownloaded = Double(buffer.count) / Double(expectedContentLength)
DispatchQueue.main.async {
print("percentageDownloaded:", percentageDownloaded)
}
}
public func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) {
DispatchQueue.main.async {
DateTools().setGlobalEndDate()
if error != nil {
print("ERROR")
} else {
print("SUCCESS")
print("# BUFFER >", self.buffer)
print("- - - - - - -")
}
}
}
}
| [
-1
] |
Subsets and Splits