blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 2
625
| content_id
stringlengths 40
40
| detected_licenses
listlengths 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
listlengths 1
9.02k
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
e320e18ed998a5e22cb41efb5acfa5f9096c6fba
|
0e08427b854bdb201cfe8c83893e799422c8ff5c
|
/Sources/GitHub/APIs/search/users/Search+Users.swift
|
2049d21056a58591fe873797932927734e3d36d6
|
[
"MIT"
] |
permissive
|
Ponyboy47/GitHub
|
70bb032149f6f80121aceb993f8ce9af65284d30
|
a137de172c4241225d1741bab5dd9140042355ba
|
refs/heads/master
| 2020-05-09T10:32:34.059618 | 2019-04-23T04:26:59 | 2019-04-23T04:26:59 | 181,046,022 | 1 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 2,181 |
swift
|
import HTTP
import URITemplate
public final class SearchUsers: GitHubAPI {
public typealias Response = GitHubSearchResponse<User>
public enum SortOptions: String, RestfulParameter {
case followers
case repositories
case joined
case bestMatch = "best-match"
public static let `default`: SortOptions = .bestMatch
}
public static let endpoint: URITemplate = "/search/users?q={+q}{&sort,order,page,perPage}"
public let connector: GitHubConnector
public init(connector: GitHubConnector) {
self.connector = connector
}
public func query(keywords: SearchKeyword = [],
qualifiers: UserQualifier,
sort: SortOptions = .default,
order: SortOrdering = .default,
page: Int = 1,
perPage: Int = githubPerPage) throws -> Response {
let query = SearchQuery(keywords: keywords, qualifiers: qualifiers).rawValue
return try self.query(query, sort: sort, order: order, page: page, perPage: perPage)
}
public func query(_ search: SearchQuery<UserQualifier>,
sort: SortOptions = .default,
order: SortOrdering = .default,
page: Int = 1,
perPage: Int = githubPerPage) throws -> Response {
return try query(search.rawValue, sort: sort, order: order, page: page, perPage: perPage)
}
public func query(_ string: String,
sort: SortOptions = .default,
order: SortOrdering = .default,
page: Int = 1,
perPage: Int = githubPerPage) throws -> Response {
var options = [String: RestfulParameter]()
options["q"] = string
if order != .default {
options["order"] = order
// The sort parameter is ignored if the ordering is not specified
if sort != .default {
options["sort"] = sort
}
}
options["page"] = page
options["perPage"] = perPage
return try get(parameters: options)
}
}
|
[
-1
] |
477cc29537069ae5d3ee76c673466a076d7679b3
|
6a6a1b06395826b72e91cef693869db013cce167
|
/DrawingWithCGContextDemo/DrawingWithCGContextDemo/AppDelegate.swift
|
3991ef4418309900a409bfbf9fb3db020a435762
|
[] |
no_license
|
mhuq1138/Drawing-in-View
|
92be307f72e47c3c8db64c07ff29c04210b34d29
|
667aa2b63bd0060d194d328075350019a1ce5a8c
|
refs/heads/master
| 2020-03-24T09:16:21.263277 | 2018-07-27T21:17:22 | 2018-07-27T21:17:22 | 142,623,078 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 522 |
swift
|
//
// AppDelegate.swift
// DrawingWithCGContextDemo
//
// Created by Mazharul Huq on 6/28/18.
// Copyright © 2018 Mazharul Huq. 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
}
}
|
[
103936,
314370,
402946,
399243,
230796,
399115,
204302,
241551,
223761,
326801,
317202,
233620,
201621,
190873,
111260,
133791,
358175,
302624,
286252,
249004,
326962,
241596,
299452,
241214,
241602,
315207,
241352,
310217,
257610,
332363,
329165,
205902,
398930,
334300,
399083,
302448,
299122,
159731,
254846
] |
c2cfe40132f2822ac16d3248081bad84445a087b
|
7908d7b593f67e9584c6fdc3aa954a5d0f9a448e
|
/GithubSuperStarsTests/WebserviceTests.swift
|
9e849edfcd61bd9705ddcc23ab6c0a89b6ca3a58
|
[] |
no_license
|
hvaghasia/GithubSuperStars
|
56165eaf342f7bc35de0fba2e1a8f543f8dd2953
|
732435a6ebb0083e7024c84edb9eedaa5a3219a4
|
refs/heads/master
| 2021-01-20T01:04:34.830985 | 2017-04-24T09:12:29 | 2017-04-24T09:12:29 | 89,217,892 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 2,187 |
swift
|
//
// WebserviceTests.swift
// GithubSuperStars
//
// Created by Hardik on 24/04/17.
// Copyright © 2017 Ugam. All rights reserved.
//
import XCTest
@testable import GithubSuperStars
class WebserviceTests: XCTestCase {
override func setUp() {
super.setUp()
}
override func tearDown() {
super.tearDown()
}
func testGetStarProjects() {
let expectation = self.expectation(description: "GetGithubStarProjects")
NetworkManager.default.getStarProjects {(result) in
switch (result) {
case .success(let projects):
XCTAssertTrue(projects.count != 0, "Project list count should not zero")
case .failure(let error):
XCTAssert(false, error.localizedDescription)
}
expectation.fulfill()
}
waitForExpectations(timeout: 10.0, handler:nil)
}
func testGetReadMe() {
let project = Project(response: ["id": 3081286,
"name": "Tetris",
"description": "A C implementation of Tetris using Pennsim through LC4",
"forks_count": 0,
"stargazers_count": 1,
"owner": ["login": "dtrupenn", "id": 872147, "avatar_url": "https://secure.gravatar.com/avatar/e7956084e75f239de85d3a31bc172ace?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png"]])
let expectation = self.expectation(description: "GetReadMe")
NetworkManager.default.getReadMe(forProject: project, completionHandler: { result in
switch (result) {
case .success(let readMeArray):
XCTAssertTrue(readMeArray.count != 0, "ReadMe objects count should not b zero")
case .failure(let error):
XCTAssert(false, error.localizedDescription)
}
expectation.fulfill()
})
waitForExpectations(timeout: 10.0, handler:nil)
}
}
|
[
-1
] |
ce211ce82d3f79f615c7463d8bbfcdb23a646d9b
|
e9d09f62c56983cac1b41dcaf41cdc5ddd5133fe
|
/X3Tools/Location/LocationTableViewCell.swift
|
fc850c49d5e7722b488d15dea551e725718382db
|
[] |
no_license
|
ahirz/miniature-bassoon
|
8b024193ea9ce64ff952ccb92da7c7b95d2c3753
|
8f7586534bfcf8e4cc41888f32f252e504b77bc3
|
refs/heads/master
| 2020-03-19T11:41:51.005870 | 2018-06-08T17:38:02 | 2018-06-08T17:38:02 | 136,470,213 | 0 | 0 | null | 2018-06-08T14:18:31 | 2018-06-07T11:53:33 |
Swift
|
UTF-8
|
Swift
| false | false | 1,126 |
swift
|
//
// LocationTableViewCell.swift
// X3Tools
//
// Created by Alex Hirzel on 6/4/18.
// Copyright © 2018 Alex Hirzel. All rights reserved.
//
import UIKit
class LocationTableViewCell: UITableViewCell {
@IBOutlet weak var itemLabel: UILabel!
@IBOutlet weak var lotLabel: UILabel!
@IBOutlet weak var quantityLabel: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
}
func update(with item: Item) {
itemLabel.text = item.product
//Function for updating a custom Location cell with item information
if item.lot != " " {
if item.sublot == " " || item.sublot == nil{
lotLabel.text = "Lot: \(item.lot)"
} else {
lotLabel.text = "Lot: \(item.lot) - \(item.sublot ?? "")"
}
} else {
lotLabel.text = "Lot: N/A"
}
quantityLabel.text = "\(item.quantity) \(item.units)"
}
}
|
[
-1
] |
9fe1cf977514a6711b16fd2c4f950bbb08feee57
|
2a33df9b15f16afbb833117da19955eb1a7b04be
|
/Carthage/Checkouts/Assertions/Assertions/Assertions.swift
|
88de67bdae18dd8587144beef1bc74f23c22e2b4
|
[
"MIT"
] |
permissive
|
sharplet/Swiftopt
|
0829a090c2ee3593dbfa2f23fbdb5792b901f9d4
|
d42689cdc5bdc569b52c282b44afd342038048ff
|
refs/heads/master
| 2016-09-10T17:43:17.502506 | 2015-02-23T11:46:59 | 2015-02-23T11:47:42 | 31,205,750 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 4,454 |
swift
|
// Copyright (c) 2014 Rob Rix. All rights reserved.
// MARK: - Matching
/// Asserts that a binary function matches two operands.
///
/// This is useful for asserting the equality of collections which only define equality for Equatable element types.
///
/// assert(x, ==, y)
public func assert<T, U>(@autoclosure expression1: () -> T?, test: (T, U) -> Bool, @autoclosure expression2: () -> U?, message: String = "", file: String = __FILE__, line: UInt = __LINE__) -> T? {
return assertExpected(expression1(), test, expression2(), message, file, line)
}
/// Asserts that a curried binary function matches two operands.
///
/// This is useful for asserting that some method applies to the receiver on the left and the operand on the right.
///
/// assert(Set([ 1, 2, 3 ]), Set.contains, 3)
public func assert<T, U>(@autoclosure expression1: () -> T?, test: T -> U -> Bool, @autoclosure expression2: () -> U?, message: String = "", file: String = __FILE__, line: UInt = __LINE__) -> T? {
return assertExpected(expression1(), { x, y in test(x)(y) }, expression2(), message, file, line)
}
/// Asserts the truth of a predicate applied to a value.
///
/// This is useful for asserting that a value has some property or other.
///
/// assert("", { $0.isEmpty })
public func assert<T>(@autoclosure expression: () -> T?, test: T -> Bool, message: String = "", file: String = __FILE__, line: UInt = __LINE__) -> T? {
return assertPredicate(expression(), test, message, file, line)
}
// MARK: - Equality
/// Asserts the equality of two Equatable values.
///
/// Returns the value, if equal and non-nil.
public func assertEqual<T: Equatable>(@autoclosure expression1: () -> T?, @autoclosure expression2: () -> T?, _ message: String = "", _ file: String = __FILE__, _ line: UInt = __LINE__) -> T? {
return assertExpected(expression1(), { $0 == $1 }, expression2(), message, file, line)
}
/// Asserts the equality of two arrays of Equatable values.
///
/// Returns the array, if equal and non-nil.
public func assertEqual<T: Equatable>(@autoclosure expression1: () -> [T]?, @autoclosure expression2: () -> [T]?, _ message: String = "", _ file: String = __FILE__, _ line: UInt = __LINE__) -> [T]? {
return assertExpected(expression1(), ==, expression2(), message, file, line)
}
/// Asserts the equality of two dictionaries of Equatable values.
///
/// Returns the dictionary, if equal and non-nil.
public func assertEqual<T: Hashable, U: Equatable>(@autoclosure expression1: () -> [T: U]?, @autoclosure expression2: () -> [T: U]?, _ message: String = "", _ file: String = __FILE__, _ line: UInt = __LINE__) -> [T: U]? {
return assertExpected(expression1(), ==, expression2(), message, file, line)
}
// MARK: - Nil/non-nil
/// Asserts that a value is nil.
public func assertNil<T>(@autoclosure expression: () -> T?, _ message: String = "", file: String = __FILE__, line: UInt = __LINE__) -> Bool {
return assertPredicate(expression(), { $0 == nil }, "is not nil. " + message, file, line) == nil
}
/// Asserts that a value is not nil.
public func assertNotNil<T>(@autoclosure expression: () -> T?, _ message: String = "", file: String = __FILE__, line: UInt = __LINE__) -> T? {
return assertPredicate(expression(), { $0 != nil }, "is nil. " + message, file, line)
}
// MARK: - Failure
/// Logs a failed assertion.
///
/// Returns nil, for use in `x ?? failure(…)` expressions.
public func failure<T>(message: String, file: String = __FILE__, line: UInt = __LINE__) -> T? {
XCTFail(message, file: file, line: line)
return nil
}
/// Logs a failed assertion.
///
/// Returns nil, for use in `x ?? failure(…)` expressions.
public func failure(message: String, file: String = __FILE__, line: UInt = __LINE__) -> Bool {
XCTFail(message, file: file, line: line)
return false
}
// MARK: - Implementation details
private func assertPredicate<T>(actual: T?, predicate: T -> Bool, message: String, file: String, line: UInt) -> T? {
return actual.map { predicate($0) ? actual : nil } ?? failure(message, file: file, line: line)
}
private func assertExpected<T, U>(actual: T?, match: (T, U) -> Bool, expected: U?, message: String, file: String, line: UInt) -> T? {
switch (actual, expected) {
case (.None, .None):
return actual
case let (.Some(x), .Some(y)) where match(x, y):
return actual
default:
return failure("\(actual) did not match \(expected). " + message, file: file, line: line)
}
}
// MARK: - Imports
import XCTest
|
[
-1
] |
62ba1c84442b7294119df000cbf6d7746ff302ee
|
61cd27fe3a081cc04ecfb7ed8e187ffd21c6a993
|
/CanLove/Network/APIManager.swift
|
e25eff46af7a5236c7237300581649213eb51016
|
[] |
no_license
|
PersonalProjectsAlex/canbackup
|
fb43cee720176a328aa40083456f106d79615d8f
|
f3cf3df97206e065a93fc9581ae586622dd2b06a
|
refs/heads/master
| 2020-04-12T17:41:19.547405 | 2018-12-21T02:14:49 | 2018-12-21T02:14:49 | 162,653,640 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 2,106 |
swift
|
//
// APIManager.swift
// travi
//
// Created by Administrador on 29/03/18.
//
import Foundation
import Alamofire
import CodableAlamofire
typealias Params = [String: Any]?
class APIManager {
func request<T: Codable>(endpoint: String, completionHandler: @escaping (T?) -> Void, method: HTTPMethod = .post, params: Parameters? = nil , headers: HTTPHeaders? = nil, keyPath: String? = nil, encoding: JSONEncoding? = nil) {
let url = URL(string: endpoint)!
let utilityQueue = DispatchQueue.global(qos: .utility)
let decoder = JSONDecoder()
decoder.dateDecodingStrategy = .secondsSince1970
print("Endpoint: \(endpoint), \(method)")
print("Params: \(params as? NSDictionary)")
Alamofire.SessionManager.default.session.configuration.timeoutIntervalForRequest = 15
Alamofire.request(url, method: method, parameters: params, headers: headers)
.responseDecodableObject(queue: utilityQueue, keyPath: keyPath, decoder: decoder) { (response: DataResponse<T>) in
//print(response)
response.result.ifFailure { print("ERROR: \(response.result.error.debugDescription)") }
DispatchQueue.main.sync {
if let object = response.value { completionHandler(object) }
else { completionHandler(nil) }
}
}
}
}
struct JSONStringArrayEncoding: ParameterEncoding {
private let myString: String
init(string: String) {
self.myString = string
}
func encode(_ urlRequest: URLRequestConvertible, with parameters: Parameters?) throws -> URLRequest {
var urlRequest = urlRequest.urlRequest
let data = myString.data(using: .utf8)!
if urlRequest?.value(forHTTPHeaderField: "Content-Type") == nil {
urlRequest?.setValue("application/json", forHTTPHeaderField: "Content-Type")
}
urlRequest?.httpBody = data
return urlRequest!
}}
|
[
-1
] |
154f8f6ab7b1bbd20a8a42987c81565dc9367ad0
|
d07242597af1a96781a22122ed59f4b2d68c4c23
|
/Parstagram/CameraViewController.swift
|
e2ad6d84eb843ca6cd176c2d44e1aa598943aec8
|
[] |
no_license
|
chandanapemmasani/Parstagram
|
f3d9f6102e8249bc5974f328227beb4572ce46d9
|
45cc11adb6fcd475e90c563999330775051addc9
|
refs/heads/main
| 2023-08-21T23:43:38.389499 | 2021-10-16T04:29:12 | 2021-10-16T04:29:12 | 414,430,219 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 1,943 |
swift
|
//
// CameraViewController.swift
// Parstagram
//
// Created by Chandana Pemmasani on 10/6/21.
//
import UIKit
import AlamofireImage
import Parse
class CameraViewController: UIViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate {
@IBOutlet weak var photoView: UIImageView!
@IBOutlet weak var textToPost: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
}
@IBAction func onCameraBtn(_ sender: Any) {
let picker = UIImagePickerController()
picker.delegate = self
picker.allowsEditing = true
if UIImagePickerController.isSourceTypeAvailable(.camera) {
picker.sourceType = .camera
} else {
picker.sourceType = .photoLibrary
}
present(picker, animated: true, completion: nil)
}
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
let image = info[.editedImage] as! UIImage
let size = CGSize(width: 300, height: 300)
let scaledImage = image.af_imageScaled(to: size)
photoView.image = scaledImage
dismiss(animated: true, completion: nil)
}
@IBAction func submitPost(_ sender: Any) {
let post = PFObject(className: "Posts")
post["caption"] = textToPost.text!
post["author"] = PFUser.current()!
let imageData = photoView.image!.pngData()
let file = PFFileObject(name: "image.png", data: imageData!)
post["image"] = file
post.saveInBackground { (success, error) in
if success {
self.dismiss(animated: true, completion: nil)
}
else {
print("error")
}
}
}
}
|
[
-1
] |
0492f74701027039ed07542a4e3634a9fe55552f
|
936fb157c8a1ab412cb2bc43321f935adc634050
|
/VclWalletIos/SjclEncryptMessage.swift
|
2c344f5efa3e881ebf954685b49e5369dbb42e0e
|
[] |
no_license
|
John-Tonny/VclWalletIos
|
52a620f832c4bc9535d6fa67be62583165c86751
|
b8ef55697dbb846532e4af69e6364bc820382155
|
refs/heads/master
| 2023-06-11T18:39:11.467059 | 2021-07-02T03:37:56 | 2021-07-02T03:37:56 | 381,990,880 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 1,991 |
swift
|
//
// SjclEncryptMessage.swift
// kkk
//
// Created by john on 2021/6/21.
//
import Foundation
import JavaScriptCore
public class SjclEncryptMessage {
public static func encrypt(msg: String, encryptKey: String) -> String? {
let jsContext = JSContext()
// set up exception handler for javascript errors
jsContext?.exceptionHandler = { context, exception in
if let exec = exception {
print("JS Exception:", exec.toString()!)
}
}
if let jsSourcePath = Bundle.main.path(forResource: "sjcl", ofType: "js") {
do {
let jsSourceContents = try String(contentsOfFile: jsSourcePath)
jsContext?.evaluateScript(jsSourceContents)
let ret = jsContext?.evaluateScript("sjcl.encrypt(sjcl.codec.base64.toBits(\"" + encryptKey + "\"),'" + msg + "'," + "{ks: 128, iter: 1})")
return ret?.toString()! ?? nil
} catch {
return nil
}
}
return nil
}
public static func decrypt(msg: String, encryptKey: String) -> String? {
let jsContext = JSContext()
// set up exception handler for javascript errors
jsContext?.exceptionHandler = { context, exception in
if let exec = exception {
print("JS Exception:", exec.toString()!)
}
}
if let jsSourcePath = Bundle.main.path(forResource: "sjcl", ofType: "js") {
do {
let jsSourceContents = try String(contentsOfFile: jsSourcePath)
jsContext?.evaluateScript(jsSourceContents)
let ret = jsContext?.evaluateScript("sjcl.decrypt(sjcl.codec.base64.toBits(\"" + encryptKey + "\"),'" + msg + "'," + "{ks: 128, iter: 1})")
return ret?.toString()! ?? nil
} catch {
return nil
}
}
return nil
}
}
|
[
-1
] |
af0176bdc3adfe6a433647349481061bdd831e67
|
9a6d4cba7560f9fe0cd00410359ceee08e3fa429
|
/w in the W/w in the W/ShopDetailViewController.swift
|
8b1d01f9eb810139005e24f78a0ed26a8dc2b723
|
[
"MIT"
] |
permissive
|
san2ride/Wander-West
|
dd12c8a071e24efe7ab1cc3891674b71a1c33394
|
8ebfbb8e575619525a696af3ada023a61a20e7a9
|
refs/heads/master
| 2021-01-23T01:21:09.017267 | 2017-03-24T06:23:48 | 2017-03-24T06:23:48 | 85,900,965 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 446 |
swift
|
//
// ShopDetailViewController.swift
// w in the W
//
// Created by don't touch me on 3/23/17.
// Copyright © 2017 trvl, LLC. All rights reserved.
//
import UIKit
class ShopDetailViewController: UIViewController {
@IBOutlet weak var shopImageView: UIImageView!
var shopImageURL: String?
override func viewDidLoad() {
super.viewDidLoad()
shopImageView.imageFromServer(urlString: shopImageURL!)
}
}
|
[
-1
] |
391e15a582b38dd51cbd69c0baa8cb1f24f7aa69
|
6f51b1d6f05087dedccaa82b402d9aee29074d5b
|
/MyMovies_ios/MovieTableViewController.swift
|
2daef152c245f721556f297a62dbfdc26f66db92
|
[] |
no_license
|
tianyanw/MyMovies_ios
|
4e29b6b313f9f2fddd5fd71236060ea31000858d
|
5ab9107345c90568b5d7abe4b500a57450783012
|
refs/heads/master
| 2021-01-10T02:32:36.983193 | 2016-02-25T04:50:08 | 2016-02-25T04:50:08 | 52,497,724 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 5,903 |
swift
|
/*
* Copyright 2016 Tianyan Wu,
*
* 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.
*
* The Instuctor: Tim Lindquist and Arizona State University has right to build and evaluate the software
* Package for the purpose of determining my grade and program assessment.
*
* Purpose: This project is a multiple view iOS app for managing MovieDescriptions. It uses more complex controls and multiple views to display and manage a collection of MovieDescription objects. It provide a list of all movie titles contained in the collection and allow the user to select one title and see all of the information about that title, and it provide the ability to add or remove movie description entries. New descriptions can be added to the collection by the user manually entering the appropriate information needed to create a MovieDescription object
*
* Ser423 Mobile Applications
* see http://pooh.poly.asu.edu/Mobile
* @author Tianyan Wu mailto: [email protected]
*
* @version February 2016
*/
// this is view controller class for the movie table
import UIKit
class MovieTableViewController: UITableViewController {
let myLibrary:MovieLibrary = MovieLibrary()
@IBOutlet var myTable: UITableView!
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
self.tableView.reloadData()
}
override func viewDidLoad() {
super.viewDidLoad()
self.title = "My Movie"
self.navigationItem.leftBarButtonItem = self.editButtonItem()
let addButton = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Add, target: self, action: "AddMovie")
self.navigationItem.rightBarButtonItem = addButton
// Uncomment the following line to preserve selection between presentations
// self.clearsSelectionOnViewWillAppear = false
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem()
}
func AddMovie(){
performSegueWithIdentifier("AddMovie", sender: self)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// MARK: - Table view data source
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return self.myLibrary.getSize()
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("MovieCell", forIndexPath: indexPath)as! MovieTableViewCell
cell.name.text = myLibrary.getMovie(indexPath.row).title
cell.plot.text = myLibrary.getMovie(indexPath.row).plot
return cell
}
/*
// Override to support conditional editing of the table view.
override func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> 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, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
if editingStyle == .Delete {
myLibrary.remove(indexPath.row)
// Delete the row from the data source
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade)
}
}
/*
// Override to support rearranging the table view.
override func tableView(tableView: UITableView, moveRowAtIndexPath fromIndexPath: NSIndexPath, toIndexPath: NSIndexPath) {
}
*/
/*
// Override to support conditional rearranging of the table view.
override func tableView(tableView: UITableView, canMoveRowAtIndexPath indexPath: NSIndexPath) -> 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 prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "showMovie" {
let selectedIndex: NSIndexPath = self.myTable.indexPathForCell(sender as! UITableViewCell)!
if let movieViewController:MovieViewController = segue.destinationViewController as? MovieViewController{
movieViewController.movie = myLibrary.getMovie(selectedIndex.row)
}
}
if segue.identifier == "AddMovie"{
if let AddViewController: AddViewController = segue.destinationViewController as? AddViewController {
AddViewController.myLibrary = myLibrary
}
}
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
}
|
[
-1
] |
225af1682782d0854c4bcfc9f07b80824a6c4a5e
|
b1333237eb41057b7c430342a71d0dd337c547c3
|
/test/SILGen/distributed_thunk.swift
|
bedc45b85be0558d54ad9af1f75024e130c7f59d
|
[
"Apache-2.0",
"Swift-exception"
] |
permissive
|
saagarjha/swift
|
edc7ab55d96c52e0ce6ab7b3b3b63dccc557bb98
|
bb499b2dcf4e4361e22bf4fbd32429e6e71e1f51
|
refs/heads/master
| 2022-03-26T04:59:26.591126 | 2022-02-19T08:59:47 | 2022-02-19T08:59:47 | 47,385,543 | 1 | 0 | null | 2015-12-04T06:20:22 | 2015-12-04T06:20:22 | null |
UTF-8
|
Swift
| false | false | 4,122 |
swift
|
// RUN: %target-swift-emit-silgen %s -enable-experimental-distributed -disable-availability-checking | %FileCheck %s --dump-input=fail
// REQUIRES: concurrency
// REQUIRES: distributed
import _Distributed
distributed actor DA {
typealias ActorSystem = FakeActorSystem
}
extension DA {
// CHECK-LABEL: sil hidden [thunk] [distributed] [ossa] @$s17distributed_thunk2DAC1fyyFTE : $@convention(method) @async (@guaranteed DA) -> @error Error
// CHECK: function_ref @swift_distributed_actor_is_remote
// Call the actor function
// CHECK: function_ref @$s17distributed_thunk2DAC1fyyF : $@convention(method) (@guaranteed DA) -> ()
distributed func f() { }
}
// ==== ----------------------------------------------------------------------------------------------------------------
// ==== Fake Address -----------------------------------------------------------
public struct ActorAddress: Hashable, Sendable, Codable {
public let address: String
public init(parse address : String) {
self.address = address
}
public init(from decoder: Decoder) throws {
let container = try decoder.singleValueContainer()
self.address = try container.decode(String.self)
}
public func encode(to encoder: Encoder) throws {
var container = encoder.singleValueContainer()
try container.encode(self.address)
}
}
// ==== Fake Transport ---------------------------------------------------------
public struct FakeActorSystem: DistributedActorSystem {
public typealias ActorID = ActorAddress
public typealias InvocationDecoder = FakeInvocationDecoder
public typealias InvocationEncoder = FakeInvocationEncoder
public typealias SerializationRequirement = Codable
init() {
print("Initialized new FakeActorSystem")
}
public func resolve<Act>(id: ActorID, as actorType: Act.Type) throws -> Act?
where Act: DistributedActor,
Act.ID == ActorID {
nil
}
public func assignID<Act>(_ actorType: Act.Type) -> ActorID
where Act: DistributedActor,
Act.ID == ActorID {
ActorAddress(parse: "xxx")
}
public func actorReady<Act>(_ actor: Act)
where Act: DistributedActor,
Act.ID == ActorID {
}
public func resignID(_ id: ActorID) {
}
public func makeInvocationEncoder() -> InvocationEncoder {
.init()
}
public func remoteCall<Act, Err, Res>(
on actor: Act,
target: RemoteCallTarget,
invocation invocationEncoder: inout InvocationEncoder,
throwing: Err.Type,
returning: Res.Type
) async throws -> Res
where Act: DistributedActor,
Act.ID == ActorID,
Err: Error,
Res: SerializationRequirement {
fatalError("not implemented")
}
public func remoteCallVoid<Act, Err>(
on actor: Act,
target: RemoteCallTarget,
invocation invocationEncoder: inout InvocationEncoder,
throwing: Err.Type
) async throws
where Act: DistributedActor,
Act.ID == ActorID,
Err: Error {
fatalError("not implemented")
}
}
// === Sending / encoding -------------------------------------------------
public struct FakeInvocationEncoder: DistributedTargetInvocationEncoder {
public typealias SerializationRequirement = Codable
public mutating func recordGenericSubstitution<T>(_ type: T.Type) throws {}
public mutating func recordArgument<Argument: SerializationRequirement>(_ argument: Argument) throws {}
public mutating func recordReturnType<R: SerializationRequirement>(_ type: R.Type) throws {}
public mutating func recordErrorType<E: Error>(_ type: E.Type) throws {}
public mutating func doneRecording() throws {}
}
// === Receiving / decoding -------------------------------------------------
public class FakeInvocationDecoder : DistributedTargetInvocationDecoder {
public typealias SerializationRequirement = Codable
public func decodeGenericSubstitutions() throws -> [Any.Type] { [] }
public func decodeNextArgument<Argument: SerializationRequirement>() throws -> Argument { fatalError() }
public func decodeReturnType() throws -> Any.Type? { nil }
public func decodeErrorType() throws -> Any.Type? { nil }
}
|
[
-1
] |
3cea3a1a3a46d8937b6e2ee6821135fedde5690e
|
4d899ee97be0401e5c12c1ec589d63d2f269a105
|
/WarcraftCharacterGenerator/WarcraftCharacterGenerator/AppDelegate.swift
|
4e7d05a27719aee16990cbc84cfbe286a57fb528
|
[] |
no_license
|
CharlemagneVI/WarcraftCharacterGenerator
|
6776be637733d6137efd47ab09ea6e146adfb57f
|
5be78915a22f05ff3b64171d4f9fbaa7c8ae1812
|
refs/heads/master
| 2020-03-26T12:48:04.008187 | 2018-08-29T00:48:27 | 2018-08-29T00:48:27 | 144,908,739 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 2,186 |
swift
|
//
// AppDelegate.swift
// WarcraftCharacterGenerator
//
// Created by Chad Fager on 8/13/18.
// Copyright © 2018 Norfare. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
|
[
229380,
229383,
229385,
278539,
294924,
229388,
278542,
327695,
229391,
229394,
278548,
229397,
229399,
229402,
352284,
229405,
278556,
278559,
229408,
294950,
229415,
229417,
327722,
237613,
229422,
237618,
229426,
229428,
286774,
286776,
319544,
286778,
229432,
204856,
352318,
286791,
237640,
286797,
278605,
311375,
163920,
237646,
196692,
319573,
311383,
278623,
278626,
319590,
311400,
278635,
303212,
278639,
131192,
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,
311601,
287032,
155966,
319809,
319810,
278849,
319814,
311623,
319818,
311628,
229709,
319822,
287054,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
278980,
98756,
278983,
319945,
278986,
319947,
278990,
278994,
311767,
279003,
279006,
188895,
172512,
287202,
279010,
279015,
172520,
319978,
279020,
172526,
311791,
279023,
172529,
279027,
319989,
172534,
180727,
164343,
279035,
311804,
287230,
279040,
303617,
287234,
279045,
172550,
303623,
172552,
320007,
287238,
279051,
172558,
279055,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
311850,
279082,
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,
189040,
172660,
287349,
189044,
189039,
287355,
287360,
295553,
172675,
295557,
287365,
311942,
303751,
352905,
311946,
287371,
279178,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
172702,
287390,
303773,
172705,
287394,
172707,
303780,
164509,
287398,
295583,
287400,
279208,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
328384,
172737,
279231,
287427,
312005,
312006,
107208,
172748,
287436,
107212,
172751,
287440,
295633,
172755,
303827,
279255,
172760,
287450,
303835,
279258,
189149,
303838,
213724,
312035,
279267,
295654,
279272,
230128,
312048,
312050,
230131,
205564,
303871,
230146,
328453,
295685,
230154,
33548,
312077,
295695,
295701,
230169,
369433,
295707,
328476,
295710,
230175,
295720,
303914,
279340,
205613,
279353,
230202,
312124,
328508,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
279390,
230241,
279394,
303976,
336744,
303985,
303987,
328563,
279413,
303991,
303997,
295806,
295808,
295813,
304005,
320391,
304007,
304009,
213895,
304011,
230284,
304013,
295822,
189325,
213902,
189329,
295825,
304019,
279438,
189331,
58262,
304023,
304027,
279452,
410526,
279461,
279462,
304042,
213931,
230327,
304055,
287675,
230334,
304063,
238528,
304065,
213954,
189378,
156612,
295873,
213963,
197580,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
312321,
295945,
230413,
197645,
295949,
320528,
140312,
295961,
238620,
197663,
304164,
304170,
238641,
312374,
238652,
238655,
230465,
238658,
336964,
296004,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
205931,
296044,
164973,
205934,
312432,
279669,
337018,
189562,
279679,
279683,
222340,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
238766,
165038,
230576,
238770,
304311,
230592,
312518,
279750,
230600,
230607,
148690,
320727,
279769,
304348,
279777,
304354,
296163,
320740,
279781,
304360,
320748,
279788,
279790,
304370,
296189,
320771,
312585,
296202,
296205,
230674,
320786,
230677,
296213,
230679,
320792,
230681,
296215,
214294,
304416,
230689,
173350,
312622,
296243,
312630,
222522,
296253,
222525,
296255,
312639,
230718,
296259,
378181,
296262,
230727,
238919,
296264,
320840,
296267,
296271,
222545,
230739,
312663,
222556,
337244,
230752,
312676,
230760,
173418,
148843,
410987,
230763,
230768,
296305,
312692,
230773,
304505,
304506,
181626,
279929,
181631,
312711,
296331,
288140,
288144,
230800,
304533,
288154,
337306,
288160,
173472,
288162,
288164,
279975,
304555,
370092,
279983,
173488,
288176,
279985,
312755,
296373,
312759,
279991,
288185,
337335,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
148946,
370130,
222676,
288210,
288212,
288214,
280021,
329177,
288217,
288218,
280027,
288220,
239070,
239064,
288224,
370146,
280034,
288226,
288229,
280036,
280038,
288232,
288230,
288234,
320998,
288236,
288238,
288240,
288242,
296435,
288244,
288250,
296446,
321022,
402942,
148990,
296450,
206336,
230916,
230919,
214535,
230923,
304651,
304653,
370187,
402969,
230940,
222752,
108066,
296486,
296488,
157229,
239152,
230961,
157236,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
288344,
280152,
239194,
280158,
403039,
370272,
181854,
239202,
370279,
312938,
280183,
280185,
280188,
280191,
116354,
280194,
280208,
280211,
288408,
280218,
280222,
419489,
190118,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
419522,
280260,
419525,
206536,
280264,
206539,
206541,
206543,
313044,
280276,
321239,
280283,
313052,
288478,
313055,
321252,
313066,
288494,
280302,
280304,
313073,
321266,
288499,
419570,
288502,
280314,
288510,
124671,
67330,
280324,
198405,
280331,
198416,
280337,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
296767,
288576,
345921,
337732,
280388,
304968,
280393,
280402,
173907,
313171,
313176,
42842,
280419,
321381,
296809,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280464,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
280487,
313258,
321458,
296883,
124853,
214966,
296890,
10170,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
354265,
354270,
239586,
313320,
354281,
231404,
124913,
165876,
321528,
239612,
313340,
288764,
239617,
313347,
288773,
313358,
305176,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
378941,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
149599,
280671,
149601,
321634,
149603,
223327,
329830,
280681,
313451,
223341,
280687,
149618,
215154,
313458,
280691,
313464,
329850,
321659,
280702,
288895,
321670,
215175,
141446,
141455,
275606,
141459,
280725,
313498,
100520,
288936,
280747,
288940,
288947,
280755,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
313548,
321740,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
157930,
280811,
280817,
125171,
280819,
157940,
182517,
280823,
280825,
280827,
280830,
280831,
280833,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
280888,
305464,
280891,
289087,
280897,
280900,
305480,
239944,
280906,
239947,
305485,
305489,
379218,
280919,
248153,
215387,
354653,
354656,
313700,
280937,
313705,
190832,
280946,
223606,
313720,
280956,
280959,
313731,
199051,
240011,
289166,
240017,
297363,
190868,
240021,
297365,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
289210,
305594,
281024,
289218,
289221,
289227,
436684,
281045,
281047,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
330244,
240132,
223752,
150025,
338440,
281095,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
281135,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
281179,
338528,
338532,
281190,
199273,
281196,
19053,
158317,
313973,
297594,
281210,
158347,
264845,
182926,
133776,
182929,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
199364,
297671,
158409,
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,
224151,
240535,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
420829,
281567,
289762,
322534,
297961,
183277,
322550,
134142,
322563,
330764,
175134,
322599,
322610,
314421,
281654,
314427,
314433,
207937,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
289912,
248995,
306341,
306344,
306347,
322734,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
126190,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
257334,
216376,
380226,
298306,
224584,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
290171,
314747,
298365,
290174,
306555,
224641,
281987,
298372,
314756,
281990,
224647,
265604,
298377,
314763,
142733,
298381,
314768,
224657,
306581,
314773,
314779,
314785,
314793,
282025,
282027,
241068,
241070,
241072,
282034,
241077,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
290291,
282101,
241142,
191992,
290298,
151036,
290302,
282111,
290305,
175621,
306694,
192008,
323084,
257550,
282127,
290321,
282130,
323090,
290325,
282133,
241175,
290328,
282137,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
282186,
224849,
282195,
282199,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
282255,
282261,
175770,
298651,
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,
315211,
282446,
307027,
315221,
323414,
315223,
241496,
241498,
307035,
307040,
110433,
282465,
241509,
110438,
298860,
110445,
282478,
315249,
282481,
110450,
315251,
315253,
315255,
339838,
315267,
282499,
315269,
241544,
282505,
241546,
241548,
298896,
298898,
282514,
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,
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,
307385,
176311,
258235,
307388,
176316,
307390,
307386,
299200,
184512,
307394,
299204,
307396,
184518,
307399,
323784,
233679,
307409,
307411,
176343,
299225,
233701,
307432,
184572,
282881,
184579,
282893,
291089,
282906,
291104,
233766,
176435,
307508,
315701,
332086,
307510,
307512,
168245,
307515,
307518,
282942,
282947,
323917,
282957,
110926,
233808,
323921,
315733,
323926,
233815,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299388,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
315801,
291226,
242075,
283033,
61855,
291231,
283042,
291238,
291241,
127403,
127405,
291247,
299440,
127407,
299444,
127413,
291254,
283062,
127417,
291260,
127421,
127424,
299457,
127429,
127431,
127434,
315856,
127440,
176592,
315860,
176597,
283095,
127447,
299481,
127449,
176605,
242143,
127455,
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,
135707,
234010,
135710,
242206,
242208,
291361,
242220,
291378,
152118,
234038,
234041,
315961,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
135808,
291456,
299655,
373383,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
225948,
135839,
299680,
225954,
299684,
135844,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
119509,
226005,
226008,
299740,
242396,
201444,
299750,
283368,
234219,
283372,
185074,
226037,
283382,
316151,
234231,
234236,
226045,
242431,
234239,
209665,
299778,
234242,
242436,
234246,
226056,
291593,
234248,
242443,
234252,
242445,
234254,
291601,
234258,
242450,
242452,
234261,
348950,
201496,
234264,
234266,
234269,
283421,
234272,
234274,
152355,
299814,
234278,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
160572,
283452,
234302,
234307,
242499,
234309,
292433,
316233,
234313,
316235,
234316,
283468,
234319,
242511,
234321,
234324,
185173,
201557,
234329,
234333,
308063,
234336,
242530,
349027,
234338,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
226171,
291711,
234368,
291714,
234370,
291716,
234373,
226182,
234375,
308105,
226185,
234379,
234384,
234388,
234390,
226200,
234393,
209818,
308123,
234396,
324504,
291742,
324508,
234398,
234401,
291747,
291748,
234405,
291750,
324518,
324520,
234407,
324522,
234410,
291756,
291754,
226220,
324527,
234414,
234417,
201650,
324531,
291760,
234422,
226230,
324536,
275384,
234428,
291773,
242623,
324544,
234431,
234434,
324546,
324548,
226239,
226245,
234437,
234439,
234443,
291788,
193486,
234446,
193488,
234449,
275406,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234475,
234478,
316400,
234481,
316403,
234484,
234485,
234487,
324599,
234490,
234493,
316416,
234496,
234501,
275462,
308231,
234504,
234507,
234510,
234515,
300054,
316439,
234520,
234519,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
234543,
234546,
275508,
300085,
234549,
300088,
234553,
234556,
234558,
316479,
234561,
316483,
160835,
234563,
308291,
234568,
234570,
316491,
234572,
300108,
234574,
300115,
234580,
234581,
234585,
275545,
242777,
234590,
234593,
234595,
234597,
300133,
234601,
300139,
234605,
160879,
234607,
275569,
234610,
316530,
300148,
234614,
398455,
144506,
234618,
234620,
275579,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
308373,
324757,
234647,
226453,
234648,
234650,
308379,
275608,
300189,
324766,
119967,
234653,
324768,
283805,
234657,
242852,
300197,
234661,
283813,
234664,
275626,
234667,
316596,
308414,
234687,
300223,
300226,
308418,
234692,
300229,
308420,
308422,
283844,
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,
349451,
177424,
275725,
283917,
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,
136562,
324978,
333178,
275834,
275836,
275840,
316803,
316806,
226696,
316811,
226699,
316814,
226703,
300433,
234899,
300436,
226709,
357783,
316824,
316826,
300448,
144807,
144810,
144812,
284076,
144814,
227426,
144820,
374196,
284084,
292279,
284087,
144826,
144828,
144830,
144832,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
226787,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
292338,
226802,
316917,
292343,
308727,
300537,
316933,
316947,
308757,
308762,
284191,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
194101,
284213,
316983,
194103,
284215,
308790,
284218,
226877,
284223,
284226,
284228,
243268,
292421,
284231,
226886,
128584,
284234,
276043,
317004,
366155,
284238,
226895,
284241,
194130,
284243,
300628,
284245,
276052,
284247,
276053,
235097,
243290,
284249,
284251,
317015,
300638,
284253,
284255,
243293,
284258,
292452,
292454,
284263,
177766,
284265,
292458,
284267,
292461,
284272,
284274,
284278,
292470,
276086,
292473,
284283,
276093,
284286,
292479,
284288,
292481,
284290,
325250,
284292,
292485,
325251,
276095,
276098,
284297,
317066,
284299,
317068,
284301,
276109,
284303,
284306,
276114,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
284329,
317098,
284331,
276137,
284333,
284335,
276144,
284337,
284339,
300726,
284343,
284346,
284350,
358080,
276160,
284354,
358083,
284358,
276166,
358089,
284362,
276170,
284365,
276175,
284368,
276177,
284370,
358098,
284372,
317138,
284377,
284379,
284381,
284384,
358114,
284386,
358116,
276197,
317158,
358119,
284392,
325353,
358122,
284394,
284397,
358126,
284399,
358128,
276206,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
300819,
317207,
300828,
300830,
276255,
300832,
325408,
300834,
317221,
227109,
358183,
186151,
276268,
300845,
243504,
300850,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
300872,
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,
317332,
358292,
399252,
284564,
284566,
350106,
284572,
276386,
284579,
276388,
358312,
317353,
284585,
276395,
292776,
292784,
276402,
358326,
161718,
358330,
276411,
276418,
276425,
301009,
301011,
301013,
292823,
358360,
301017,
301015,
292828,
276446,
153568,
276448,
292839,
276455,
350186,
292843,
276460,
292845,
178161,
227314,
276466,
325624,
350200,
276472,
317435,
276476,
276479,
350210,
276482,
178181,
317446,
276485,
350218,
276490,
292876,
350222,
317456,
276496,
317458,
178195,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
178224,
276528,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
276544,
243779,
325700,
284739,
292934,
243785,
276553,
350293,
350295,
309337,
227418,
350299,
194649,
350302,
194654,
350304,
178273,
309346,
227423,
194660,
350308,
309350,
309348,
292968,
309352,
350313,
309354,
350316,
227430,
276583,
301167,
276590,
350321,
284786,
276595,
227440,
350325,
252022,
350328,
292985,
301178,
350332,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
350366,
276638,
153765,
284837,
350375,
350379,
350381,
350383,
129200,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
301258,
309450,
276685,
309455,
276689,
309462,
301272,
276699,
194780,
309468,
309471,
301283,
317672,
317674,
325867,
243948,
194801,
227571,
309491,
309494,
243960,
227583,
276735,
227587,
276739,
211204,
276742,
227596,
325910,
309530,
342298,
211232,
317729,
276775,
211241,
325937,
325943,
211260,
260421,
276809,
285002,
276811,
235853,
276816,
235858,
276829,
276833,
391523,
276836,
293227,
276843,
293232,
276848,
186744,
211324,
227709,
285061,
366983,
317833,
178572,
285070,
285077,
178583,
227738,
317853,
276896,
317858,
342434,
285093,
317864,
285098,
276907,
235955,
276917,
293304,
293307,
293314,
309707,
293325,
129486,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
293346,
227810,
276964,
293352,
236013,
293364,
301562,
293370,
317951,
309764,
301575,
121352,
293387,
236043,
342541,
317963,
113167,
55822,
309779,
317971,
309781,
277011,
55837,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
285236,
23094,
277054,
244288,
219714,
129603,
301636,
318020,
301639,
301643,
285265,
399955,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
121458,
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,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
342745,
137946,
342747,
113378,
203491,
228069,
277223,
342760,
285417,
56041,
56043,
56045,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
228113,
285459,
277273,
293659,
326430,
228128,
285474,
293666,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
285494,
301880,
285499,
301884,
293696,
310080,
277317,
277322,
277329,
162643,
310100,
301911,
301913,
277337,
301921,
400236,
236397,
162671,
326514,
310134,
236408,
277368,
15224,
416639,
416640,
113538,
310147,
416648,
277385,
39817,
187274,
301972,
424853,
277405,
277411,
310179,
293798,
293802,
236460,
277426,
293811,
276579,
293817,
293820,
203715,
326603,
342994,
276586,
293849,
293861,
228327,
228328,
318442,
228330,
228332,
326638,
277486,
351217,
318450,
293876,
293877,
285686,
302073,
121850,
293882,
302075,
244731,
285690,
293887,
277504,
277507,
277511,
293899,
277519,
293908,
293917,
293939,
318516,
277561,
277564,
310336,
7232,
293956,
277573,
228422,
293960,
310344,
277577,
277583,
203857,
293971,
310355,
310359,
236632,
277594,
138332,
277598,
203872,
277601,
285792,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
367737,
285817,
302205,
285821,
392326,
285831,
253064,
294026,
302218,
285835,
162964,
384148,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
302241,
285862,
277671,
302248,
64682,
277678,
294063,
294065,
302258,
277687,
294072,
318651,
294076,
277695,
318657,
244930,
302275,
130244,
302277,
228550,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
310486,
302296,
384222,
310498,
285927,
318698,
302315,
228592,
294132,
138485,
228601,
204026,
228606,
204031,
64768,
310531,
138505,
228617,
318742,
204067,
277798,
130345,
277801,
113964,
285997,
384302,
285999,
277804,
113969,
277807,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
417086,
277822,
286016,
302403,
294211,
384328,
277832,
277836,
294221,
146765,
294223,
326991,
277839,
277842,
277847,
277850,
179547,
277853,
146784,
277857,
302436,
277860,
294246,
327015,
310632,
327017,
351594,
277864,
277869,
277872,
351607,
310648,
277880,
310651,
277884,
277888,
310657,
351619,
294276,
310659,
327046,
277892,
253320,
310665,
318858,
277894,
277898,
277903,
310672,
351633,
277905,
277908,
277917,
310689,
277921,
130468,
228776,
277928,
277932,
310703,
277937,
310710,
130486,
310712,
277944,
310715,
277947,
302526,
228799,
277950,
277953,
302534,
310727,
245191,
64966,
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,
310780,
286203,
40448,
228864,
286214,
228871,
302603,
302614,
302617,
286233,
302621,
286240,
187936,
146977,
187939,
40484,
294435,
40486,
286246,
294440,
40488,
294439,
294443,
40491,
294445,
245288,
310831,
286248,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
40521,
286283,
40525,
40527,
212560,
400976,
228944,
40533,
147032,
40537,
40539,
40541,
278109,
40544,
40548,
40550,
40552,
286312,
40554,
286313,
310892,
40557,
40560,
188022,
122488,
294521,
343679,
294537,
310925,
286354,
278163,
302740,
122517,
278168,
179870,
327333,
229030,
212648,
302764,
278188,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
294601,
302793,
343757,
212690,
319187,
286420,
278227,
229076,
286425,
319194,
278235,
301163,
229086,
278238,
286432,
294625,
294634,
302838,
319226,
286460,
278274,
302852,
278277,
302854,
294664,
311048,
352008,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
319280,
278320,
319290,
229192,
302925,
188247,
188252,
237409,
229233,
294776,
360317,
294785,
327554,
360322,
40840,
40851,
294803,
188312,
294811,
237470,
319390,
40865,
319394,
294817,
294821,
311209,
180142,
343983,
294831,
188340,
40886,
319419,
294844,
294847,
393177,
294876,
294879,
294883,
393190,
294890,
311279,
278513,
237555,
311283,
278516,
278519,
237562
] |
2f84e30941de64038ef89d29651b0880df21b364
|
c7674947bbdffb8f2e58997e1a7c49a7fcc9ee08
|
/window-shopper/window-shopper/ViewController.swift
|
f617cc9c2de8cef4f49975e2b63bf98c04585ea5
|
[] |
no_license
|
leonheart19/app-window-shopper
|
edfa673e263eaa593d786b1961f191d340cd8ef3
|
db0aa05d6f2e0eb7841695edcf918d1feaa68c08
|
refs/heads/master
| 2021-05-02T12:07:17.529596 | 2018-02-08T09:07:00 | 2018-02-08T09:07:00 | 120,733,996 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 510 |
swift
|
//
// ViewController.swift
// window-shopper
//
// Created by Kian Ti Chua on 8/2/18.
// Copyright © 2018 KianTiChua. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
|
[
278543,
317473,
286775,
288827,
286786,
159812,
286796,
237655,
307288,
200802,
309347,
276580,
309349,
309351,
309353,
307311,
276612,
280710,
303242,
311437,
278675,
278693,
100521,
307379,
280760,
280770,
227523,
280772,
280775,
280777,
276686,
229585,
307410,
280797,
278749,
301284,
280808,
280810,
286963,
280821,
286965,
280824,
280826,
280832,
276736,
287004,
287007,
282917,
233767,
307516,
278845,
289088,
289112,
311645,
289120,
227688,
313706,
299374,
199024,
276849,
278897,
311684,
313733,
233869,
227740,
285087,
289187,
289190,
289191,
305577,
289196,
305582,
278968,
127418,
293308,
278973,
289224,
311761,
281042,
279011,
276965,
281078,
236022,
233980,
287231,
279041,
279046,
215562,
277006,
281107,
279064,
281118,
295460,
289318,
309807,
281142,
279096,
234043,
277057,
129604,
301637,
158285,
311913,
281202,
277108,
287350,
285321,
227984,
117399,
228000,
225955,
287399,
326311,
277171,
285377,
226009,
277224,
199402,
234223,
312049,
289524,
226038,
234232,
230147,
226055,
299786,
281373,
228127,
281380,
283433,
293682,
289596,
283453,
279360,
293700,
279380,
279386,
308064,
293742,
162672,
277364,
207738,
291709,
303998,
183173,
304008,
324491,
304012,
304015,
226196,
277406,
234402,
291755,
297903,
324528,
230323,
234423,
277432,
293816,
281530,
291774,
295874,
299973,
234465,
168936,
289771,
183278,
277487,
293874,
277502,
277512,
275466,
300057,
304174,
300086,
234551,
300089,
238653,
293961,
203858,
281703,
296042,
277612,
164974,
312433,
300149,
234619,
226447,
234641,
349332,
285855,
283839,
277696,
228548,
228551,
279751,
279754,
230604,
298189,
302286,
230608,
290004,
290006,
189655,
302295,
298202,
298204,
298206,
363743,
298207,
290020,
228585,
120054,
300288,
312586,
277797,
130346,
300358,
238920,
234829,
296272,
306540,
333179,
290175,
275842,
224643,
300432,
226705,
310673,
370093,
286126,
277935,
279982,
282035,
292277,
296374,
130487,
306633,
286158,
280015,
310734,
163289,
280030,
286175,
286189,
282095,
296436,
302580,
310773,
288251,
290299,
290303,
282128,
286234,
282143,
284197,
296487,
296489,
286257,
226878,
288321,
228932,
226887,
288331,
288332,
226896,
212561,
284242,
292435,
228945,
300629,
276054,
280146,
284240,
282202,
212573,
40545,
292451,
284261,
306791,
286314,
284275,
314996,
284277,
276087,
284279,
292478,
284287,
284289,
276099,
284298,
278157,
282262,
280219,
284315,
284317,
282270,
282275,
284323,
313007,
284336,
284341,
286390,
300727,
276150,
282301,
296638,
302788,
282311,
284361,
282320,
317137,
284373,
282329,
282338,
282346,
294636,
358127,
282357,
288501,
358137,
358139,
282365,
286462,
282368,
358147,
282377,
300817,
282389,
282393,
278298,
329499,
315170,
282403,
282411,
159541,
282426,
288577,
307029,
241499,
188253,
292701,
292730,
284570,
294812,
284574,
284577,
284580,
284586,
276396,
282548,
10179,
165832,
301012,
301016,
294889,
231405,
227315,
237556,
237564
] |
d1979d60517a5b358be969ef7a0a4902b4eb7c9d
|
72d652464a9d1528aede99c2d416d6f0e0bf3a04
|
/Sources/Crypto/Key Derivation/HKDF.swift
|
5f47c2fb6120643268f49aed78583c67108cb47f
|
[
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
apple/swift-crypto
|
288985439732eea85a2aa5a9975147ed98da6152
|
953b34a60168bb44ffc5e0c3fc345189cdbca128
|
refs/heads/main
| 2023-09-06T00:35:42.620284 | 2023-08-17T13:53:44 | 2023-08-17T13:53:44 | 198,488,246 | 1,412 | 165 |
Apache-2.0
| 2023-09-13T11:03:23 | 2019-07-23T18:36:09 |
C
|
UTF-8
|
Swift
| false | false | 7,770 |
swift
|
//===----------------------------------------------------------------------===//
//
// This source file is part of the SwiftCrypto open source project
//
// Copyright (c) 2019-2020 Apple Inc. and the SwiftCrypto project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
#if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API
@_exported import CryptoKit
#else
import Foundation
/// A standards-based implementation of an HMAC-based Key Derivation Function
/// (HKDF).
///
/// The key derivation functions allow you to derive one or more secrets of the
/// size of your choice from a main key or passcode. The key derivation function
/// is compliant with IETF RFC 5869. Use one of the `deriveKey` functions, such
/// as ``deriveKey(inputKeyMaterial:outputByteCount:)`` or
/// ``deriveKey(inputKeyMaterial:salt:info:outputByteCount:)``, to derive a key
/// from a main secret or passcode in a single function.
///
/// To derive a key with more fine-grained control, use
/// ``extract(inputKeyMaterial:salt:)`` to create cryptographically strong key
/// material in the form of a hashed authentication code, then call
/// ``expand(pseudoRandomKey:info:outputByteCount:)`` using that key material to
/// generate a symmetric key of the length you specify.
public struct HKDF<H: HashFunction> {
/// Derives a symmetric encryption key from a main key or passcode using
/// HKDF key derivation with information and salt you specify.
///
/// - Parameters:
/// - inputKeyMaterial: The main key or passcode the derivation function
/// uses to derive a key.
/// - salt: The salt to use for key derivation.
/// - info: The shared information to use for key derivation.
/// - outputByteCount: The length in bytes of the resulting symmetric key.
///
/// - Returns: The derived symmetric key.
public static func deriveKey<Salt: DataProtocol, Info: DataProtocol>(inputKeyMaterial: SymmetricKey,
salt: Salt,
info: Info,
outputByteCount: Int) -> SymmetricKey {
return expand(pseudoRandomKey: extract(inputKeyMaterial: inputKeyMaterial, salt: salt), info: info, outputByteCount: outputByteCount)
}
/// Derives a symmetric encryption key from a main key or passcode using
/// HKDF key derivation with information you specify.
///
/// - Parameters:
/// - inputKeyMaterial: The main key or passcode the derivation function
/// uses to derive a key.
/// - info: The shared information to use for key derivation.
/// - outputByteCount: The length in bytes of the resulting symmetric key.
///
/// - Returns: The derived symmetric key.
public static func deriveKey<Info: DataProtocol>(inputKeyMaterial: SymmetricKey,
info: Info,
outputByteCount: Int) -> SymmetricKey {
return deriveKey(inputKeyMaterial: inputKeyMaterial, salt: [UInt8](), info: info, outputByteCount: outputByteCount)
}
/// Derives a symmetric encryption key from a main key or passcode using
/// HKDF key derivation with salt that you specify.
///
/// - Parameters:
/// - inputKeyMaterial: The main key or passcode the derivation function
/// uses to derive a key.
/// - salt: The salt to use for key derivation.
/// - outputByteCount: The length in bytes of the resulting symmetric key.
///
/// - Returns: The derived symmetric key.
public static func deriveKey<Salt: DataProtocol>(inputKeyMaterial: SymmetricKey,
salt: Salt,
outputByteCount: Int) -> SymmetricKey {
return deriveKey(inputKeyMaterial: inputKeyMaterial, salt: salt, info: [UInt8](), outputByteCount: outputByteCount)
}
/// Derives a symmetric encryption key from a main key or passcode using
/// HKDF key derivation.
///
/// - Parameters:
/// - inputKeyMaterial: The main key or passcode the derivation function
/// uses to derive a key.
/// - outputByteCount: The length in bytes of the resulting symmetric key.
///
/// - Returns: The derived symmetric key.
public static func deriveKey(inputKeyMaterial: SymmetricKey,
outputByteCount: Int) -> SymmetricKey {
return deriveKey(inputKeyMaterial: inputKeyMaterial, salt: [UInt8](), info: [UInt8](), outputByteCount: outputByteCount)
}
/// Creates cryptographically strong key material from a main key or
/// passcode that you specify.
///
/// Generate a derived symmetric key from the cryptographically strong key
/// material this function creates by calling
/// ``expand(pseudoRandomKey:info:outputByteCount:)``.
///
/// - Parameters:
/// - inputKeyMaterial: The main key or passcode the derivation function
/// uses to derive a key.
/// - salt: The salt to use for key derivation.
///
/// - Returns: A pseudorandom, cryptographically strong key in the form of a
/// hashed authentication code.
public static func extract<Salt: DataProtocol>(inputKeyMaterial: SymmetricKey, salt: Salt?) -> HashedAuthenticationCode<H> {
let key: SymmetricKey
if let salt = salt {
if salt.regions.count != 1 {
let contiguousBytes = Array(salt)
key = SymmetricKey(data: contiguousBytes)
} else {
key = SymmetricKey(data: salt.regions.first!)
}
} else {
key = SymmetricKey(data: [UInt8]())
}
return inputKeyMaterial.withUnsafeBytes { ikmBytes in
return HMAC<H>.authenticationCode(for: ikmBytes, using: key)
}
}
/// Expands cryptographically strong key material into a derived symmetric
/// key.
///
/// Generate cryptographically strong key material to use with this function
/// by calling ``extract(inputKeyMaterial:salt:)``.
///
/// - Parameters:
/// - prk: A pseudorandom, cryptographically strong key generated from the
/// ``extract(inputKeyMaterial:salt:)`` function.
/// - info: The shared information to use for key derivation.
/// - outputByteCount: The length in bytes of the resulting symmetric key.
///
/// - Returns: The derived symmetric key.
public static func expand<PRK: ContiguousBytes, Info: DataProtocol>(pseudoRandomKey prk: PRK, info: Info?, outputByteCount: Int) -> SymmetricKey {
let iterations: UInt8 = UInt8(ceil((Float(outputByteCount) / Float(H.Digest.byteCount))))
var output = SecureBytes()
let key = SymmetricKey(data: prk)
var TMinusOne = SecureBytes()
for i in 1...iterations {
var hmac = HMAC<H>(key: key)
hmac.update(data: TMinusOne)
if let info = info {
hmac.update(data: info)
}
withUnsafeBytes(of: i) { counter in
hmac.update(bufferPointer: counter)
}
TMinusOne = SecureBytes(hmac.finalize())
output.append(TMinusOne)
}
return SymmetricKey(data: output.prefix(outputByteCount))
}
}
#endif // Linux or !SwiftPM
|
[
-1
] |
f1b13823f8cbbe5a0a5f1ab0f0f8f54da62574ff
|
14e554ecf0b2a776f0e82ad0d1b1e21f59a77f29
|
/mvvm-maps/CoffeeQuest/CoffeeQuest/Adapters/YLP+BusinessSearchClient.swift
|
f41cc9756c7b74b135d5f3394a06de4054e57fa0
|
[] |
no_license
|
mdo91/ios-mvvm-2
|
aeea6e832446ed7f78bfcb8207458cee829265d6
|
b859c119e4d3939a1c6b41a0da73cb1b346674a5
|
refs/heads/master
| 2023-06-02T16:32:00.574418 | 2021-07-03T20:01:19 | 2021-07-03T20:01:19 | 327,980,194 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 3,195 |
swift
|
///// Copyright (c) 2020 Razeware LLC
///
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to deal
/// in the Software without restriction, including without limitation the rights
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
/// copies of the Software, and to permit persons to whom the Software is
/// furnished to do so, subject to the following conditions:
///
/// The above copyright notice and this permission notice shall be included in
/// all copies or substantial portions of the Software.
///
/// Notwithstanding the foregoing, you may not use, copy, modify, merge, publish,
/// distribute, sublicense, create a derivative work, and/or sell copies of the
/// Software in any work that is designed, intended, or marketed for pedagogical or
/// instructional purposes related to programming, coding, application development,
/// or information technology. Permission for such use, copying, modification,
/// merger, publication, distribution, sublicensing, creation of derivative works,
/// or sale is expressly withheld.
///
/// This project and source code may use libraries or frameworks that are
/// released under various Open-Source licenses. Use of those libraries and
/// frameworks are governed by their own individual licenses.
///
/// 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 MapKit
import YelpAPI
extension YLPClient:BusinessSearchClient{
func search(with coordinate: CLLocationCoordinate2D,
term: String,
limit: UInt,
offset: UInt,
success: @escaping (([Business]) -> Void),
failure: @escaping ((Error?) -> Void)) {
let yelCoordinate = YLPCoordinate(latitude: coordinate.latitude, longitude: coordinate.longitude)
search(with: yelCoordinate,
term: term,
limit: limit,
offset: offset,
sort: .bestMatched) { (searchResult, error) in
guard let searchResult = searchResult, error == nil else{
failure(error)
return
}
let businesses = searchResult.businesses.adaptToBusinesses()
success(businesses)
}
}
}
extension Array where Element : YLPBusiness{
func adaptToBusinesses() -> [Business]{
return compactMap { yelpBusiness in
guard let yelpCoordinate = yelpBusiness.location.coordinate else {return nil}
let coordinate = CLLocationCoordinate2D(latitude:yelpCoordinate.latitude , longitude: yelpCoordinate.longitude)
return Business(name: yelpBusiness.name, rating: yelpBusiness.rating, location: coordinate)
}
}
}
|
[
379616,
379716,
379620,
379719,
379627
] |
c13255237eca7308f1db696f485297e056e3347a
|
15ca32e05f1c3f0f865c1f448f09669f68891565
|
/Voice Recorder/AppDelegate.swift
|
96c9d3b1508838d08f8cca926b1e357c79fa87ad
|
[
"MIT"
] |
permissive
|
Mohsenqaysi/Voice-Recorder
|
34c358b6abc7141cb97936b3d7ce862f61b9bec3
|
a7443b5199e18b0f5d6fae5f0292990c502f2bb7
|
refs/heads/master
| 2023-06-29T10:15:07.286262 | 2021-03-24T09:15:46 | 2021-03-24T09:15:46 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 1,414 |
swift
|
//
// AppDelegate.swift
// Voice Recorder
//
// Created by Pinlun on 2019/10/30.
// Copyright © 2019 Pinlun. 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,
286831,
286844,
417924,
262283,
286879,
286888,
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,
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,
336512,
148105,
377484,
352918,
98968,
344744,
361129,
336555,
385713,
434867,
164534,
336567,
164538,
328378,
328386,
352968,
344776,
352971,
418507,
352973,
385742,
385748,
361179,
189153,
369381,
361195,
418553,
344831,
336643,
344841,
361230,
336659,
418580,
418585,
434970,
369435,
418589,
262942,
418593,
336675,
328484,
418598,
418605,
336696,
361273,
328515,
336708,
328519,
336711,
328522,
336714,
426841,
197468,
361309,
254812,
361315,
361322,
328573,
377729,
369542,
222128,
345035,
386003,
345043,
386011,
386018,
386022,
435187,
328702,
328714,
361489,
386069,
336921,
386073,
336925,
345118,
377887,
345133,
345138,
386101,
361536,
197707,
189520,
345169,
156761,
361567,
148578,
345199,
386167,
361593,
410745,
214149,
386186,
337047,
345246,
214175,
337071,
337075,
345267,
386258,
328924,
66782,
222437,
328941,
386285,
386291,
345376,
353570,
345379,
410917,
345382,
337205,
345399,
378169,
369978,
337222,
337229,
337234,
263508,
402791,
345448,
271730,
378227,
271745,
181638,
353673,
181643,
181649,
181654,
230809,
181670,
181673,
337329,
181681,
181684,
181690,
361917,
181696,
337349,
181703,
337365,
271839,
329191,
361960,
329194,
116210,
337398,
337415,
329226,
419339,
419343,
419349,
345625,
419355,
370205,
419359,
419362,
394786,
370213,
419368,
419376,
206395,
214593,
419400,
419402,
353867,
419406,
419410,
345701,
394853,
222830,
370297,
353919,
403075,
198280,
345736,
403091,
345749,
345757,
345762,
419491,
345765,
419497,
419501,
370350,
419506,
419509,
337592,
419512,
337599,
419527,
419530,
419535,
272081,
394966,
419542,
419544,
181977,
345818,
419547,
419550,
419559,
337642,
419563,
337645,
370415,
141051,
337659,
337668,
362247,
395021,
362255,
321299,
116509,
345887,
378663,
345905,
354106,
354111,
247617,
354117,
370503,
329544,
370509,
354130,
247637,
337750,
370519,
313180,
354142,
345967,
345970,
345974,
403320,
354172,
247691,
337808,
247700,
329623,
436126,
436132,
337833,
362413,
337844,
346057,
247759,
346063,
329697,
354277,
190439,
247789,
354313,
346139,
436289,
378954,
395339,
338004,
100453,
329832,
329855,
329867,
329885,
411805,
346272,
362660,
100524,
387249,
379066,
387260,
256191,
395466,
346316,
411861,
411864,
411868,
411873,
379107,
411876,
387301,
346343,
338152,
387306,
387312,
346355,
436473,
321786,
379134,
411903,
379152,
395538,
387349,
338199,
387352,
182558,
338211,
395566,
248111,
362822,
436555,
190796,
321879,
379233,
354673,
321910,
248186,
420236,
379278,
272786,
354727,
338352,
330189,
338381,
338386,
256472,
338403,
338409,
248308,
199164,
330252,
199186,
330267,
354855,
10828,
199249,
174695,
248425,
191084,
338543,
191092,
346742,
330383,
354974,
150183,
174774,
248504,
174777,
223934,
273108,
355028,
264918,
183005,
256734,
338660,
338664,
264941,
363251,
207619,
264964,
338700,
256786,
199452,
363293,
396066,
346916,
396069,
215853,
355122,
355131,
355140,
355143,
338763,
355150,
330580,
355166,
265055,
355175,
387944,
355179,
330610,
330642,
355218,
412599,
207808,
379848,
396245,
248792,
248798,
347105,
257008,
183282,
265207,
330748,
330760,
330768,
248862,
396328,
158761,
199728,
330800,
396336,
396339,
339001,
388154,
388161,
347205,
248904,
330826,
248914,
183383,
339036,
412764,
257120,
248951,
420984,
330889,
347287,
248985,
339097,
44197,
380070,
339112,
249014,
126144,
330958,
330965,
265432,
388319,
388347,
175375,
159005,
175396,
208166,
273708,
372015,
347441,
372018,
199988,
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,
380332,
396722,
208311,
372163,
216517,
380360,
216522,
339404,
372176,
208337,
339412,
413141,
339417,
249308,
339420,
339424,
339428,
339434,
249328,
69113,
372228,
339461,
208398,
380432,
175635,
339503,
265778,
265795,
396872,
265805,
224853,
224857,
257633,
224870,
372327,
257646,
372337,
224884,
224887,
224890,
224894,
372353,
224897,
216707,
339588,
126596,
421508,
224904,
224909,
159374,
11918,
339601,
126610,
224913,
224916,
224919,
126616,
208538,
224922,
224926,
224929,
224932,
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,
184094,
225058,
339747,
339749,
257833,
225066,
257836,
413484,
225070,
225073,
372532,
257845,
225079,
397112,
225082,
397115,
225087,
225092,
225096,
323402,
257868,
225103,
257871,
397139,
225108,
225112,
257883,
257886,
225119,
257890,
339814,
225127,
257896,
274280,
257901,
225137,
339826,
257908,
225141,
257912,
257916,
225148,
257920,
225155,
339844,
225165,
397200,
225170,
380822,
225175,
225180,
118691,
184244,
372664,
372702,
356335,
380918,
405533,
430129,
266294,
266297,
217157,
421960,
356439,
430180,
421990,
266350,
356466,
266362,
381068,
225423,
250002,
250004,
225429,
356506,
225437,
135327,
225441,
438433,
225444,
438436,
225447,
438440,
225450,
258222,
225455,
430256,
225458,
225461,
225466,
389307,
225470,
381120,
372929,
430274,
225475,
389320,
225484,
225487,
225490,
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,
250199,
250202,
332125,
250210,
348525,
332152,
250238,
389502,
332161,
356740,
332172,
373145,
340379,
389550,
324030,
266687,
340451,
160234,
127471,
340472,
324094,
266754,
324099,
324102,
324111,
340500,
324117,
324131,
332324,
381481,
324139,
356907,
324142,
356916,
324149,
324155,
348733,
324160,
324164,
356934,
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,
389926,
152370,
348978,
340789,
348982,
398139,
127814,
357206,
389978,
430939,
357211,
357214,
201579,
201582,
349040,
340849,
201588,
430965,
324472,
398201,
119674,
324475,
430972,
340861,
324478,
340858,
324481,
373634,
398211,
324484,
324487,
381833,
324492,
324495,
324498,
430995,
324501,
324510,
422816,
324513,
398245,
201637,
324524,
340909,
324533,
5046,
324538,
324541,
398279,
340939,
340941,
340957,
431072,
398306,
340963,
209895,
201711,
349172,
349180,
439294,
431106,
209943,
209946,
250914,
357410,
185380,
357418,
209965,
209968,
209971,
209975,
209979,
209987,
209990,
341071,
349267,
250967,
210010,
341091,
210025,
210027,
210030,
210039,
341113,
210044,
349308,
152703,
160895,
349311,
210052,
349319,
210055,
210067,
210071,
210077,
210080,
210084,
251044,
185511,
210088,
210095,
210098,
210107,
210115,
332997,
333009,
210131,
333014,
210138,
218354,
251128,
218360,
275706,
275712,
275715,
275721,
349459,
333078,
251160,
349484,
349491,
251189,
415033,
251210,
357708,
210260,
365911,
259421,
365921,
333154,
251235,
374117,
333162,
234866,
390516,
333175,
357755,
251271,
136590,
112020,
349590,
357792,
259515,
415166,
415185,
366034,
366038,
415193,
415199,
423392,
333284,
415207,
366056,
415216,
210420,
423423,
415257,
415263,
366117,
415270,
144939,
415278,
415281,
415285,
210487,
415290,
415293,
349761,
415300,
333386,
333399,
366172,
333413,
423528,
423532,
210544,
415353,
333439,
415361,
267909,
153227,
333498,
333511,
210631,
259788,
358099,
333534,
366307,
366311,
431851,
366318,
210672,
366321,
366325,
210695,
210698,
366348,
210706,
399128,
333594,
210719,
358191,
210739,
366387,
399159,
358200,
325440,
366401,
341829,
325446,
46920,
341834,
341838,
341843,
415573,
358234,
341851,
350045,
399199,
259938,
399206,
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,
350410,
260298,
350416,
350422,
211160,
350425,
268507,
334045,
350445,
375026,
358644,
350458,
350461,
350464,
325891,
350467,
350475,
268559,
350480,
432405,
350486,
350490,
325914,
325917,
350493,
350498,
350504,
358700,
350509,
391468,
358704,
358713,
358716,
383306,
334161,
383321,
383330,
383333,
391530,
383341,
334203,
268668,
194941,
391563,
366990,
268701,
416157,
342430,
375208,
326058,
375216,
334262,
334275,
326084,
358856,
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,
375574,
162591,
326441,
326451,
326454,
244540,
326460,
260924,
375612,
326467,
244551,
326473,
326477,
326485,
416597,
326490,
342874,
326502,
375656,
326507,
326510,
211825,
211831,
351097,
392060,
351104,
400259,
342915,
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,
359476,
343131,
384098,
384101,
367723,
384107,
187502,
343154,
384114,
212094,
351364,
384135,
384139,
384143,
351381,
384151,
384160,
384168,
367794,
244916,
384181,
384188,
351423,
384191,
384198,
326855,
244937,
384201,
253130,
343244,
384208,
146642,
384224,
359649,
343270,
351466,
384246,
351479,
384249,
343306,
261389,
359694,
253200,
261393,
384275,
384283,
245020,
384288,
245029,
171302,
351534,
376110,
245040,
384314,
425276,
384323,
212291,
343365,
212303,
367965,
343393,
343398,
367980,
425328,
343409,
154999,
253303,
343417,
327034,
245127,
384397,
245136,
245142,
245145,
343450,
245148,
245151,
245154,
245157,
245162,
327084,
359865,
384443,
146876,
327107,
384453,
327110,
327115,
327117,
359886,
359890,
343507,
368092,
343534,
343539,
368119,
343544,
368122,
409091,
359947,
359955,
359983,
343630,
327275,
245357,
138864,
155254,
155273,
245409,
425638,
425649,
155322,
425662,
155327,
245460,
155351,
155354,
212699,
245475,
155363,
245483,
155371,
409335,
155393,
155403,
245525,
155422,
360223,
155438,
155442,
155447,
155461,
360261,
376663,
155482,
261981,
425822,
155487,
376671,
155490,
155491,
327531,
261996,
376685,
261999,
262002,
327539,
425845,
262005,
147317,
262008,
262011,
155516,
155521,
155525,
360326,
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
] |
6b7302380d440ef180aae07dd61b000bdfa2b083
|
67339adaae79e74ff917e1c5298658551fd38404
|
/VaccineAssistant/AppDelegate.swift
|
26bb2189df099e56de67f780a35017bdab62f933
|
[] |
no_license
|
asad-ali-dev/VaccineAssistant
|
a5641378421cc06ba768dd56885ec7b41bd25b34
|
f1c032d900ad224ee0d62852a804b83435e2dcab
|
refs/heads/main
| 2023-06-04T02:10:50.985680 | 2021-06-24T10:43:02 | 2021-06-24T10:43:02 | 379,541,016 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 1,354 |
swift
|
//
// AppDelegate.swift
// VaccineAssistant
//
// Created by Asad Ali on 05/06/2021.
//
import UIKit
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
// MARK: UISceneSession Lifecycle
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
}
|
[
393222,
393224,
393230,
393250,
344102,
393261,
393266,
213048,
385081,
376889,
393275,
376905,
254030,
286800,
368727,
180313,
368735,
180320,
376931,
286831,
368752,
286844,
417924,
262283,
286879,
286888,
377012,
164028,
377036,
180431,
377046,
418007,
418010,
377060,
327914,
205036,
393456,
393460,
418043,
336123,
385280,
262404,
164106,
180490,
368911,
262416,
262422,
377117,
262436,
336180,
262454,
393538,
262472,
344403,
213332,
65880,
262496,
418144,
262499,
213352,
246123,
262507,
262510,
213372,
385419,
393612,
262550,
262552,
385440,
385443,
262566,
385451,
262573,
393647,
385458,
262586,
344511,
262592,
360916,
369118,
328177,
328179,
328182,
328189,
328192,
164361,
410128,
393747,
254490,
188958,
385570,
33316,
377383,
197159,
352821,
197177,
418363,
188987,
369223,
385609,
385616,
352864,
369253,
262760,
352874,
352887,
254587,
377472,
148105,
377484,
352918,
98968,
344744,
361129,
385713,
434867,
164534,
336567,
328378,
164538,
328386,
344776,
352968,
352971,
418507,
352973,
385742,
385748,
361179,
189153,
369381,
361195,
418553,
344831,
344835,
336643,
344841,
361230,
336659,
418580,
418585,
434970,
369435,
418589,
262942,
418593,
336675,
328484,
418598,
418605,
336696,
361273,
328515,
336708,
328519,
361288,
336711,
328522,
336714,
426841,
197468,
254812,
361309,
361315,
361322,
328573,
377729,
369542,
361360,
222128,
345035,
386003,
345043,
386011,
386018,
386022,
435187,
328702,
328714,
361489,
386069,
386073,
336921,
336925,
345118,
377887,
345133,
345138,
386101,
361536,
189520,
345169,
156761,
361567,
148578,
345199,
386167,
361593,
410745,
361598,
214149,
345222,
386186,
337047,
345246,
214175,
337071,
337075,
386258,
328924,
66782,
222437,
386285,
328941,
386291,
345376,
353570,
345379,
410917,
345382,
337205,
345399,
378169,
369978,
337222,
337229,
337234,
263508,
402791,
345448,
271730,
378227,
271745,
181638,
353673,
181643,
181649,
181654,
230809,
181673,
181681,
337329,
181684,
361917,
181696,
337349,
337365,
271839,
329191,
361960,
329194,
116210,
337398,
329226,
419339,
419343,
419349,
345625,
419355,
370205,
419359,
394786,
419362,
370213,
419368,
419376,
206395,
214593,
419400,
419402,
353867,
419406,
419410,
394853,
345701,
222830,
370297,
403070,
403075,
345736,
198280,
403091,
345749,
419483,
345757,
345762,
419491,
345765,
419497,
419501,
370350,
419506,
419509,
419512,
337592,
419517,
337599,
419527,
419530,
419535,
272081,
394966,
419542,
419544,
181977,
345818,
419547,
419550,
419559,
337642,
419563,
337645,
370415,
337659,
337668,
362247,
395021,
362255,
116509,
345887,
378663,
345905,
354106,
354111,
247617,
354117,
370503,
329544,
345930,
370509,
354130,
247637,
337750,
370519,
313180,
354142,
354150,
354156,
345967,
345970,
345974,
403320,
354172,
247691,
337808,
329623,
436126,
436132,
337833,
362413,
337844,
346057,
346063,
247759,
329697,
354277,
190439,
247789,
354313,
346139,
436289,
378954,
395339,
338004,
100453,
329832,
329855,
329885,
346272,
362660,
100524,
387249,
379066,
387260,
256191,
395466,
346316,
411861,
411864,
411868,
411873,
379107,
411876,
387301,
346343,
338152,
387306,
387312,
346355,
436473,
321786,
379134,
411903,
411916,
379152,
395538,
387349,
338199,
387352,
182558,
338211,
248111,
362822,
436555,
190796,
379233,
354673,
321910,
248186,
420236,
379278,
272786,
354727,
338352,
338381,
338386,
338403,
248308,
199164,
330252,
199186,
420376,
330267,
354855,
10828,
199249,
346721,
248425,
191084,
338543,
191092,
346742,
354974,
150183,
248504,
223934,
355024,
273108,
355028,
264918,
183005,
256734,
436962,
264941,
363251,
207619,
264964,
338700,
256786,
199452,
363293,
396066,
346916,
396069,
215853,
355122,
355131,
355140,
355143,
338763,
355150,
330580,
355166,
265055,
265058,
355175,
387944,
355179,
330610,
355218,
330642,
412599,
207808,
379848,
396245,
347105,
257008,
183282,
265207,
330748,
265214,
330760,
330768,
248862,
347176,
396328,
158761,
199728,
396336,
330800,
396339,
339001,
388154,
388161,
347205,
248904,
330826,
248914,
412764,
339036,
257120,
265320,
248951,
420984,
347287,
248985,
339097,
44197,
380070,
339112,
126144,
330958,
330965,
265432,
265436,
388319,
388347,
175375,
159005,
175396,
208166,
273708,
347437,
372015,
347441,
372018,
199988,
44342,
175415,
396600,
437566,
175423,
437570,
437575,
437583,
331088,
437587,
331093,
396633,
175450,
437595,
175457,
208227,
175460,
175463,
265580,
437620,
175477,
249208,
175483,
249214,
175486,
175489,
249218,
249227,
175513,
175516,
396705,
175522,
355748,
380332,
396722,
208311,
388542,
372163,
216517,
380360,
216522,
339404,
372176,
208337,
339412,
413141,
339417,
339420,
249308,
339424,
339428,
339434,
249328,
69113,
372228,
208398,
380432,
175635,
265778,
265795,
396872,
265805,
224853,
224857,
257633,
224870,
372327,
257646,
372337,
224884,
224887,
224890,
224894,
372353,
224897,
216707,
421508,
126596,
224904,
11918,
159374,
224913,
126610,
224916,
224919,
126616,
208538,
224922,
224926,
224929,
224932,
257704,
224936,
224942,
257712,
224947,
257716,
257720,
257724,
224959,
257732,
224965,
224969,
339662,
224975,
257747,
224981,
224986,
257761,
224993,
257764,
224999,
339695,
225012,
257787,
225020,
257790,
225025,
257794,
339721,
257801,
257804,
225038,
257807,
225043,
372499,
225048,
257819,
225053,
184094,
225058,
257833,
225066,
257836,
413484,
225070,
225073,
372532,
257845,
225079,
397112,
225082,
397115,
225087,
225092,
225096,
323402,
257868,
225103,
257871,
397139,
225108,
225112,
257883,
257886,
225119,
257890,
225127,
274280,
257896,
257901,
225137,
257908,
225141,
257912,
225148,
257916,
257920,
225155,
339844,
225165,
397200,
225170,
380822,
225175,
225180,
118691,
184244,
372664,
372702,
372706,
356335,
372738,
405533,
430129,
266294,
266297,
421960,
356439,
430180,
421990,
266350,
356466,
266362,
381068,
225423,
250002,
250004,
225429,
356506,
225437,
135327,
225441,
438433,
225444,
438436,
225447,
438440,
225450,
258222,
225455,
225458,
225461,
225466,
389307,
225470,
381120,
372929,
430274,
225475,
389320,
225484,
225487,
225490,
225493,
266453,
225496,
225499,
225502,
225505,
356578,
225510,
217318,
225514,
225518,
372976,
381176,
397571,
389380,
356637,
356640,
356643,
356646,
266536,
356649,
356655,
332080,
340275,
356660,
397622,
332090,
225597,
332097,
348488,
332106,
332117,
348502,
250199,
250202,
332125,
250210,
332152,
389502,
250238,
332161,
356740,
332172,
373145,
340379,
373148,
389550,
324030,
266687,
127471,
340472,
381436,
324094,
266754,
324111,
340500,
381481,
356907,
324142,
356916,
324149,
324155,
348733,
324164,
356934,
348743,
381512,
324173,
324176,
389723,
332380,
381545,
340627,
184982,
373398,
258721,
332453,
332459,
389805,
332463,
381617,
332471,
332483,
332486,
373449,
357069,
332493,
357073,
332511,
332520,
332533,
348924,
373510,
389926,
348978,
152370,
340789,
348982,
398139,
127814,
357201,
357206,
389978,
430939,
357211,
357214,
349040,
340849,
201588,
430965,
381813,
324472,
398201,
119674,
324475,
430972,
340858,
340861,
324478,
324481,
373634,
398211,
324484,
324487,
381833,
324492,
324495,
324498,
430995,
324501,
324510,
422816,
324513,
398245,
201637,
324524,
340909,
324533,
324538,
324541,
398279,
340939,
340941,
209873,
431072,
398306,
340963,
209895,
349172,
381946,
349180,
431106,
357410,
250914,
185380,
357418,
209965,
209968,
209975,
209979,
209987,
209995,
341071,
349267,
250967,
210010,
341091,
210025,
210027,
210030,
210036,
210039,
349308,
349311,
160895,
152703,
210052,
210055,
349319,
210067,
210071,
210077,
210080,
251044,
210084,
185511,
210088,
210098,
210107,
210115,
332997,
210127,
333009,
210131,
333014,
210138,
210143,
218354,
218360,
251128,
275712,
275715,
275721,
349459,
333078,
251160,
349484,
349491,
251189,
415033,
251210,
357708,
210260,
365911,
259421,
365921,
333154,
251235,
374117,
333162,
234866,
390516,
333175,
357755,
136590,
374160,
112020,
349590,
357792,
259515,
415166,
415185,
366038,
415191,
415193,
415196,
415199,
423392,
333284,
415207,
366056,
366061,
415216,
210420,
415224,
423423,
415257,
415263,
366117,
415270,
144939,
415278,
415281,
415285,
210487,
415290,
415293,
349761,
415300,
333386,
366172,
333413,
423528,
423532,
210544,
415353,
333439,
415361,
267909,
333498,
210631,
358099,
153302,
333534,
366307,
366311,
431851,
366318,
210672,
366321,
366325,
210695,
268041,
210698,
366348,
210706,
399128,
210719,
358191,
366387,
210739,
399159,
358200,
325440,
366401,
341829,
325446,
46920,
341834,
341838,
415573,
341851,
350045,
399199,
259938,
399206,
399215,
358255,
268143,
358259,
341876,
243579,
333698,
333708,
333724,
382890,
350146,
333774,
358371,
350189,
350193,
350202,
350206,
350213,
268298,
350224,
350231,
333850,
350237,
350240,
350244,
350248,
178218,
350251,
350256,
350259,
350271,
243781,
350285,
374864,
342111,
374902,
432271,
334011,
260289,
260298,
350410,
350416,
350422,
211160,
350425,
268507,
334045,
350445,
375026,
358644,
350458,
350461,
350464,
350467,
325891,
350475,
268559,
350480,
432405,
350486,
325914,
350490,
325917,
350493,
325919,
350498,
194852,
350504,
358700,
391468,
350509,
358704,
358713,
358716,
383306,
383321,
383330,
383333,
391530,
383341,
334203,
268668,
194941,
391563,
366990,
416157,
268701,
342430,
375216,
334262,
334275,
326084,
358856,
334304,
334311,
375277,
334321,
350723,
391690,
186897,
334358,
342550,
342554,
334363,
350761,
252461,
334384,
358961,
383536,
334394,
252482,
219718,
334407,
350822,
375400,
334465,
334468,
162445,
326290,
342679,
342683,
260766,
342710,
244409,
260797,
260801,
350917,
391894,
416473,
64230,
342766,
375535,
203506,
342776,
391937,
391948,
375568,
326416,
375571,
375574,
162591,
326441,
383793,
326451,
260924,
375612,
326460,
244540,
326467,
244551,
326473,
326477,
416597,
326485,
326490,
326502,
375656,
433000,
326507,
326510,
211825,
211831,
351097,
392060,
359295,
351104,
342915,
400259,
236430,
342930,
252822,
392091,
400285,
252836,
359334,
211884,
400306,
351168,
359361,
359366,
326598,
359382,
359388,
383967,
343015,
359407,
261108,
244726,
261111,
383997,
261129,
261147,
359451,
211998,
261153,
261159,
359470,
359476,
343131,
384098,
384101,
367723,
384107,
187502,
343154,
384114,
212094,
351364,
384135,
384139,
384143,
351381,
384160,
384168,
367794,
384181,
367800,
351423,
326855,
244937,
253130,
343244,
146642,
359649,
343270,
351466,
351479,
343306,
261389,
359694,
384269,
253200,
261393,
384275,
245020,
245029,
171302,
351534,
376110,
425276,
212291,
384323,
343365,
212303,
367965,
343393,
343398,
367980,
425328,
343409,
253303,
154999,
343417,
327034,
384397,
245136,
245142,
245145,
343450,
245154,
245157,
245162,
327084,
359865,
384443,
146876,
327107,
384453,
327110,
327115,
327117,
359886,
359890,
343507,
368092,
343534,
343539,
368119,
343544,
368122,
409091,
359947,
359955,
359983,
343630,
179802,
327275,
245357,
138864,
155254,
155273,
368288,
245409,
425638,
425649,
155322,
425662,
155327,
155351,
155354,
212699,
155363,
245475,
155371,
245483,
409335,
155393,
155403,
155422,
360223,
155438,
155442,
155447,
417595,
360261,
155461,
376663,
155482,
261981,
425822,
376671,
155487,
155490,
155491,
327531,
261996,
376685,
261999,
262002,
327539,
425845,
147317,
262005,
262008,
262011,
155516,
155521,
155525,
360326,
376714,
155531,
262027,
262030,
262033,
262036,
262039,
262042,
155549,
262045,
262048,
262051,
327589,
155559,
155562,
155565,
393150,
393169,
384977,
155611,
155619,
253923,
155621,
253926,
204784,
393203,
360438,
253943,
393206,
393212,
155646
] |
4bad2493916f40aa8c57f1f6238bbf83e7142a25
|
dbde5cf21c4bf110b3526222b7f8daa69df27416
|
/MyPlayground.playground/Contents.swift
|
7e2d289121f531f9312c5befe36a6ccf9fb1694e
|
[
"Unlicense"
] |
permissive
|
E5SC/WWDC18
|
cba0448d4e0633adeeebd47178aae4accbcf1140
|
30dedfda40cd9cfa47274f64241c36517f8481a0
|
refs/heads/master
| 2021-01-24T21:47:12.547838 | 2018-02-28T11:34:14 | 2018-02-28T11:34:14 | 123,276,239 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 11,772 |
swift
|
//: A UIKit based Playground for presenting user interface
import UIKit
import PlaygroundSupport
import SceneKit
import AVFoundation
let mainView = UIView(frame: CGRect(x: 0, y: 0, width: 600, height: 400))
let menuButton = UIButton(frame: CGRect(x: 10, y: 10, width: 25, height: 25))
public class Responder{
public let view = SCNView(frame: CGRect(x: 0, y: 0, width: 600, height: 400))
var player: AVAudioPlayer!
let earthName = Bundle.main.url(forResource: "Earth.mp3", withExtension: "mp3")
let jupiterName = Bundle.main.url(forResource: "Jupiter.mp3", withExtension: "mp3")
let marsName = Bundle.main.url(forResource: "Mars.mp3", withExtension: "mp3")
let mercuryName = Bundle.main.url(forResource: "Mercury.mp3", withExtension: "mp3")
let neptuneName = Bundle.main.url(forResource: "Neptune.mp3", withExtension: "mp3")
let saturnName = Bundle.main.url(forResource: "Saturn.mp3", withExtension: "mp3")
let uranusName = Bundle.main.url(forResource: "Uranus.mp3", withExtension: "mp3")
let venusName = Bundle.main.url(forResource: "Venus.mp3", withExtension: "mp3")
let images = Constants.imagesNames
let names = Constants.names
let dSol = Constants.diameterSun
let distance = Constants.distanceAPlanetToSun
let rotationSpeed = Constants.turningSpeed
let angleRotation = Constants.inclination
@objc public func openMenu(){
}
@objc public func createdSolarSystemView(){
let scene = SCNScene()
view.scene = scene
scene.background.contents = UIImage(named: "space.jpg")
view.allowsCameraControl = true
let camera = SCNNode()
camera.camera = SCNCamera()
camera.position = SCNVector3(x: 0, y: 0, z: 3600)
camera.camera?.zFar = 5000
camera.camera?.zNear = 0.5
camera.camera?.automaticallyAdjustsZRange = true
scene.rootNode.addChildNode(camera)
let light1 = SCNNode()
light1.light = SCNLight()
light1.light?.type = .probe
light1.position = SCNVector3(x: 0, y: 0, z: 0)
scene.rootNode.addChildNode(light1)
//SUN NODE
var solGeometry: SCNGeometry!
solGeometry = SCNSphere(radius: 50)
solGeometry.firstMaterial?.diffuse.contents = UIImage(named: "sol.jpg")
let solNode = SCNNode(geometry: solGeometry)
solNode.position = SCNVector3(x:0, y:0, z:0)
scene.rootNode.addChildNode(solNode)
//MERCURY NODE
var mercuryNode: SCNNode!
let mercuryOrbitNode = SCNNode(geometry: SCNSphere(radius: 2))
solNode.addChildNode(mercuryOrbitNode)
let angle1 = (angleRotation[0] * Double.pi) / 180
let action1 = SCNAction.rotateBy(x: 0, y: CGFloat(rotationSpeed[0]), z: 0, duration: 5)
let action11 = SCNAction.rotate(toAxisAngle: SCNVector4(0.0, 0.0, 0.0, Float(angle1)), duration: 6)
let repeat11 = SCNAction.repeatForever(action11)
let repeat1 = SCNAction.repeatForever(action1)
let sqc1: SCNAction = SCNAction.sequence([repeat1, repeat11])
mercuryOrbitNode.runAction(sqc1)
let moonGeo = SCNSphere(radius: 5)
moonGeo.firstMaterial?.diffuse.contents = UIImage(named: "mercurio.jpg")
mercuryNode = SCNNode(geometry: moonGeo)
mercuryOrbitNode.addChildNode(mercuryNode)
mercuryNode.position = SCNVector3(0, 0, CGFloat(distance[0]))
//VENUS NODE
var venusNode: SCNNode!
let venusOrbitNode = SCNNode(geometry: SCNSphere(radius: 5))
solNode.addChildNode(venusOrbitNode)
let angle2 = (angleRotation[1] * Double.pi) / 180
let action2 = SCNAction.rotateBy(x: 0, y: CGFloat(rotationSpeed[1]), z: 0, duration: 5)
let action22 = SCNAction.rotate(toAxisAngle: SCNVector4(0.0, 0.0, 0.0, Float(angle2)), duration: 6)
let repeat22 = SCNAction.repeatForever(action22)
let repeat2 = SCNAction.repeatForever(action2)
let sqc2: SCNAction = SCNAction.sequence([repeat2, repeat22])
venusOrbitNode.runAction(sqc2)
let venusGeo = SCNSphere(radius: 10)
venusGeo.firstMaterial?.diffuse.contents = UIImage(named: "venus.jpg")
venusNode = SCNNode(geometry: venusGeo)
venusOrbitNode.addChildNode(venusNode)
venusNode.position = SCNVector3(0, 0, CGFloat(distance[1]))
//EARTH NODE
var earthNode: SCNNode!
let earthOrbitNode = SCNNode(geometry: SCNSphere(radius: 8))
solNode.addChildNode(earthOrbitNode)
let angle3 = (angleRotation[2] * Double.pi) / 180
let action3 = SCNAction.rotateBy(x: 0, y: CGFloat(rotationSpeed[2]), z: 0, duration: 5)
let action33 = SCNAction.rotate(toAxisAngle: SCNVector4(0.0, 0.0, 0.0, Float(angle3)), duration: 6)
let repeat33 = SCNAction.repeatForever(action33)
let repeat3 = SCNAction.repeatForever(action3)
let sqc3: SCNAction = SCNAction.sequence([repeat3, repeat33])
earthOrbitNode.runAction(sqc3)
let earthGeo = SCNSphere(radius: 10)
earthGeo.firstMaterial?.diffuse.contents = UIImage(named: "earth.jpg")
earthNode = SCNNode(geometry: earthGeo)
earthOrbitNode.addChildNode(earthNode)
earthNode.position = SCNVector3(0, 0, CGFloat(distance[2]))
//LUNA NODE
var moonNode: SCNNode!
let moonOrbitNode = SCNNode(geometry: SCNSphere(radius: 1))
earthNode.addChildNode(moonOrbitNode)
let angle4 = (angleRotation[3] * Double.pi) / 180
let action4 = SCNAction.rotateBy(x: 0, y: CGFloat(rotationSpeed[3]), z: 0, duration: 5)
let action44 = SCNAction.rotate(toAxisAngle: SCNVector4(0.0, 0.0, 0.0, Float(angle4)), duration: 6)
let repeat44 = SCNAction.repeatForever(action44)
let repeat4 = SCNAction.repeatForever(action4)
let sqc4: SCNAction = SCNAction.sequence([repeat4, repeat44])
moonOrbitNode.runAction(sqc4)
let moonGeo2 = SCNSphere(radius: 5)
moonGeo2.firstMaterial?.diffuse.contents = UIImage(named: "luna.jpg")
moonNode = SCNNode(geometry: moonGeo2)
moonOrbitNode.addChildNode(moonNode)
moonNode.position = SCNVector3(0, 0, CGFloat(distance[3]))
//MARTES NODE
var martesNode: SCNNode!
let martesOrbitNode = SCNNode(geometry: SCNSphere(radius: 5))
solNode.addChildNode(martesOrbitNode)
let angle5 = (angleRotation[4] * Double.pi) / 180
let action5 = SCNAction.rotateBy(x: 0, y: CGFloat(rotationSpeed[4]), z: 0, duration: 5)
let action55 = SCNAction.rotate(toAxisAngle: SCNVector4(0.0, 0.0, 0.0, Float(angle5)), duration: 6)
let repeat55 = SCNAction.repeatForever(action55)
let repeat5 = SCNAction.repeatForever(action5)
let sqc5: SCNAction = SCNAction.sequence([repeat5, repeat55])
martesOrbitNode.runAction(sqc5)
let martesGeo = SCNSphere(radius: 10)
martesGeo.firstMaterial?.diffuse.contents = UIImage(named: "marte.jpg")
martesNode = SCNNode(geometry: martesGeo)
martesOrbitNode.addChildNode(martesNode)
martesNode.position = SCNVector3(0, 0, CGFloat(distance[4]))
//JUPITER NODE
var jupiterNode: SCNNode!
let jupiterOrbitNode = SCNNode(geometry: SCNSphere(radius: 30))
solNode.addChildNode(jupiterOrbitNode)
let angle6 = (angleRotation[5] * Double.pi) / 180
let action6 = SCNAction.rotateBy(x: 0, y: CGFloat(rotationSpeed[5]), z: 0, duration: 5)
let action66 = SCNAction.rotate(toAxisAngle: SCNVector4(0.0, 0.0, 0.0, Float(angle6)), duration: 6)
let repeat66 = SCNAction.repeatForever(action66)
let repeat6 = SCNAction.repeatForever(action6)
let sqc6: SCNAction = SCNAction.sequence([repeat6, repeat66])
jupiterOrbitNode.runAction(sqc6)
let jupiterGeo = SCNSphere(radius: 10)
jupiterGeo.firstMaterial?.diffuse.contents = UIImage(named: "jupiter.jpg")
jupiterNode = SCNNode(geometry: jupiterGeo)
jupiterOrbitNode.addChildNode(jupiterNode)
jupiterNode.position = SCNVector3(0, 0, CGFloat(distance[5]))
//SATURNO NODE
var saturnoNode: SCNNode!
let saturnoOrbitNode = SCNNode(geometry: SCNSphere(radius: 20))
solNode.addChildNode(saturnoOrbitNode)
let angle7 = (angleRotation[6] * Double.pi) / 180
let action7 = SCNAction.rotateBy(x: 0, y: CGFloat(rotationSpeed[6]), z: 0, duration: 5)
let action77 = SCNAction.rotate(toAxisAngle: SCNVector4(0.0, 0.0, 0.0, Float(angle7)), duration: 6)
let repeat77 = SCNAction.repeatForever(action77)
let repeat7 = SCNAction.repeatForever(action7)
let sqc7: SCNAction = SCNAction.sequence([repeat7, repeat77])
saturnoOrbitNode.runAction(sqc7)
let saturnoGeo = SCNSphere(radius: 10)
saturnoGeo.firstMaterial?.diffuse.contents = UIImage(named: "saturno.jpg")
saturnoNode = SCNNode(geometry: saturnoGeo)
saturnoOrbitNode.addChildNode(saturnoNode)
saturnoNode.position = SCNVector3(0, 0, CGFloat(distance[6]))
//URANO NODE
var uranoNode: SCNNode!
let uranoOrbitNode = SCNNode(geometry: SCNSphere(radius: 15))
solNode.addChildNode(uranoOrbitNode)
let angle8 = (angleRotation[7] * Double.pi) / 180
let action8 = SCNAction.rotateBy(x: 0, y: CGFloat(rotationSpeed[7]), z: 0, duration: 5)
let action88 = SCNAction.rotate(toAxisAngle: SCNVector4(0.0, 0.0, 0.0, Float(angle8)), duration: 6)
let repeat88 = SCNAction.repeatForever(action88)
let repeat8 = SCNAction.repeatForever(action8)
let sqc8: SCNAction = SCNAction.sequence([repeat8, repeat88])
uranoOrbitNode.runAction(sqc8)
let uranoGeo = SCNSphere(radius: 10)
uranoGeo.firstMaterial?.diffuse.contents = UIImage(named: "urano.jpg")
uranoNode = SCNNode(geometry: uranoGeo)
uranoOrbitNode.addChildNode(uranoNode)
uranoNode.position = SCNVector3(0, 0, CGFloat(distance[7]))
//NEPTUNO NODE
var neptunoNode: SCNNode!
let neptunoOrbitNode = SCNNode(geometry: SCNSphere(radius: 12))
solNode.addChildNode(neptunoOrbitNode)
let angle9 = (angleRotation[8] * Double.pi) / 180
let action9 = SCNAction.rotateBy(x: 0, y: CGFloat(rotationSpeed[8]), z: 0, duration: 5)
let action99 = SCNAction.rotate(toAxisAngle: SCNVector4(0.0, 0.0, 0.0, Float(angle9)), duration: 6)
let repeat99 = SCNAction.repeatForever(action99)
let repeat9 = SCNAction.repeatForever(action9)
let sqc9: SCNAction = SCNAction.sequence([repeat9, repeat99])
neptunoOrbitNode.runAction(sqc9)
let neptunoGeo = SCNSphere(radius: 10)
neptunoGeo.firstMaterial?.diffuse.contents = UIImage(named: "neptuno.jpg")
neptunoNode = SCNNode(geometry: neptunoGeo)
neptunoOrbitNode.addChildNode(neptunoNode)
neptunoNode.position = SCNVector3(0, 0, CGFloat(distance[8]))
mainView.addSubview(view)
}
}
let classe = Responder()
menuButton.setImage(UIImage(named: "menu.png"), for: UIControlState.normal)
menuButton.imageView?.contentMode = .scaleAspectFit
menuButton.addTarget(classe, action: #selector(Responder.openMenu), for: .touchUpInside)
let borderColor = UIColor(red: 0/255.0, green: 0/255.0, blue: 0/255.0, alpha: 1.0)
mainView.layer.borderColor = borderColor.cgColor
mainView.layer.borderWidth = 5
classe.createdSolarSystemView()
mainView.addSubview(classe.view)
mainView.addSubview(menuButton)
// Present the view controller in the Live View window
PlaygroundPage.current.liveView = mainView
|
[
-1
] |
8318439a2bdf61d604525bbf4c8f3e91f1bc42ef
|
19ffa6601b1818ff1d98186a7f2fc5711ab2b1d0
|
/submodules/TelegramCore/Sources/TelegramEngine/Peers/RecentPeers.swift
|
b298bc0f0f3120786d4fb54ef0698f4dae3ed0da
|
[] |
no_license
|
cloudveiltech/Telegram-iOS
|
aa41c34b5cee0d9ec70e3fc2f9d108aca183a3ba
|
6d8493ad435bd43ffbd309151a333897a1d5706b
|
refs/heads/master
| 2023-04-15T15:27:24.068847 | 2023-03-31T12:42:54 | 2023-03-31T12:42:54 | 172,799,618 | 1 | 0 | null | 2019-02-26T22:18:29 | 2019-02-26T22:18:28 | null |
UTF-8
|
Swift
| false | false | 12,156 |
swift
|
import Foundation
import Postbox
import TelegramApi
import SwiftSignalKit
public enum RecentPeers {
case peers([Peer])
case disabled
}
private func cachedRecentPeersEntryId() -> ItemCacheEntryId {
return ItemCacheEntryId(collectionId: 101, key: CachedRecentPeers.cacheKey())
}
func _internal_recentPeers(account: Account) -> Signal<RecentPeers, NoError> {
let key = PostboxViewKey.cachedItem(cachedRecentPeersEntryId())
return account.postbox.combinedView(keys: [key])
|> mapToSignal { views -> Signal<RecentPeers, NoError> in
if let value = (views.views[key] as? CachedItemView)?.value?.get(CachedRecentPeers.self) {
if value.enabled {
return account.postbox.multiplePeersView(value.ids)
|> map { view -> RecentPeers in
var peers: [Peer] = []
for id in value.ids {
if let peer = view.peers[id], id != account.peerId {
peers.append(peer)
}
}
return .peers(peers)
}
} else {
return .single(.disabled)
}
} else {
return .single(.peers([]))
}
}
}
public func _internal_getRecentPeers(transaction: Transaction) -> [PeerId] {
guard let entry = transaction.retrieveItemCacheEntry(id: cachedRecentPeersEntryId())?.get(CachedRecentPeers.self) else {
return []
}
return entry.ids
}
func _internal_managedUpdatedRecentPeers(accountPeerId: PeerId, postbox: Postbox, network: Network) -> Signal<Void, NoError> {
let key = PostboxViewKey.cachedItem(cachedRecentPeersEntryId())
let peersEnabled = postbox.combinedView(keys: [key])
|> map { views -> Bool in
if let value = (views.views[key] as? CachedItemView)?.value?.get(CachedRecentPeers.self) {
return value.enabled
} else {
return true
}
}
|> distinctUntilChanged
let updateOnce =
network.request(Api.functions.contacts.getTopPeers(flags: 1 << 0, offset: 0, limit: 50, hash: 0))
|> `catch` { _ -> Signal<Api.contacts.TopPeers, NoError> in
return .complete()
}
|> mapToSignal { result -> Signal<Void, NoError> in
return postbox.transaction { transaction -> Void in
switch result {
case let .topPeers(_, _, users):
var peers: [Peer] = []
var peerPresences: [PeerId: Api.User] = [:]
for user in users {
let telegramUser = TelegramUser(user: user)
peers.append(telegramUser)
peerPresences[telegramUser.id] = user
}
updatePeers(transaction: transaction, peers: peers, update: { return $1 })
updatePeerPresences(transaction: transaction, accountPeerId: accountPeerId, peerPresences: peerPresences)
if let entry = CodableEntry(CachedRecentPeers(enabled: true, ids: peers.map { $0.id })) {
transaction.putItemCacheEntry(id: cachedRecentPeersEntryId(), entry: entry)
}
case .topPeersNotModified:
break
case .topPeersDisabled:
if let entry = CodableEntry(CachedRecentPeers(enabled: false, ids: [])) {
transaction.putItemCacheEntry(id: cachedRecentPeersEntryId(), entry: entry)
}
}
}
}
return peersEnabled |> mapToSignal { _ -> Signal<Void, NoError> in
return updateOnce
}
}
func _internal_removeRecentPeer(account: Account, peerId: PeerId) -> Signal<Void, NoError> {
return account.postbox.transaction { transaction -> Signal<Void, NoError> in
guard let entry = transaction.retrieveItemCacheEntry(id: cachedRecentPeersEntryId())?.get(CachedRecentPeers.self) else {
return .complete()
}
if let index = entry.ids.firstIndex(of: peerId) {
var updatedIds = entry.ids
updatedIds.remove(at: index)
if let entry = CodableEntry(CachedRecentPeers(enabled: entry.enabled, ids: updatedIds)) {
transaction.putItemCacheEntry(id: cachedRecentPeersEntryId(), entry: entry)
}
}
if let peer = transaction.getPeer(peerId), let apiPeer = apiInputPeer(peer) {
return account.network.request(Api.functions.contacts.resetTopPeerRating(category: .topPeerCategoryCorrespondents, peer: apiPeer))
|> `catch` { _ -> Signal<Api.Bool, NoError> in
return .single(.boolFalse)
}
|> mapToSignal { _ -> Signal<Void, NoError> in
return .complete()
}
} else {
return .complete()
}
} |> switchToLatest
}
func _internal_updateRecentPeersEnabled(postbox: Postbox, network: Network, enabled: Bool) -> Signal<Void, NoError> {
return postbox.transaction { transaction -> Signal<Void, NoError> in
var currentValue = true
if let entry = transaction.retrieveItemCacheEntry(id: cachedRecentPeersEntryId())?.get(CachedRecentPeers.self) {
currentValue = entry.enabled
}
if currentValue == enabled {
return .complete()
}
return network.request(Api.functions.contacts.toggleTopPeers(enabled: enabled ? .boolTrue : .boolFalse))
|> `catch` { _ -> Signal<Api.Bool, NoError> in
return .single(.boolFalse)
}
|> mapToSignal { _ -> Signal<Void, NoError> in
return postbox.transaction { transaction -> Void in
if !enabled {
if let entry = CodableEntry(CachedRecentPeers(enabled: false, ids: [])) {
transaction.putItemCacheEntry(id: cachedRecentPeersEntryId(), entry: entry)
}
} else {
let entry = transaction.retrieveItemCacheEntry(id: cachedRecentPeersEntryId())?.get(CachedRecentPeers.self)
if let codableEntry = CodableEntry(CachedRecentPeers(enabled: true, ids: entry?.ids ?? [])) {
transaction.putItemCacheEntry(id: cachedRecentPeersEntryId(), entry: codableEntry)
}
}
}
}
} |> switchToLatest
}
func _internal_managedRecentlyUsedInlineBots(postbox: Postbox, network: Network, accountPeerId: PeerId) -> Signal<Void, NoError> {
let remotePeers = network.request(Api.functions.contacts.getTopPeers(flags: 1 << 2, offset: 0, limit: 16, hash: 0))
|> retryRequest
|> map { result -> ([Peer], [PeerId: Api.User], [(PeerId, Double)])? in
switch result {
case .topPeersDisabled:
break
case let .topPeers(categories, _, users):
var peers: [Peer] = []
var peerPresences: [PeerId: Api.User] = [:]
for user in users {
let telegramUser = TelegramUser(user: user)
peers.append(telegramUser)
peerPresences[telegramUser.id] = user
}
var peersWithRating: [(PeerId, Double)] = []
for category in categories {
switch category {
case let .topPeerCategoryPeers(_, _, topPeers):
for topPeer in topPeers {
switch topPeer {
case let .topPeer(apiPeer, rating):
peersWithRating.append((apiPeer.peerId, rating))
}
}
}
}
return (peers, peerPresences, peersWithRating)
case .topPeersNotModified:
break
}
return ([], [:], [])
}
let updatedRemotePeers = remotePeers
|> mapToSignal { peersAndPresences -> Signal<Void, NoError> in
if let (peers, peerPresences, peersWithRating) = peersAndPresences {
return postbox.transaction { transaction -> Void in
updatePeers(transaction: transaction, peers: peers, update: { return $1 })
updatePeerPresences(transaction: transaction, accountPeerId: accountPeerId, peerPresences: peerPresences)
let sortedPeersWithRating = peersWithRating.sorted(by: { $0.1 > $1.1 })
transaction.replaceOrderedItemListItems(collectionId: Namespaces.OrderedItemList.CloudRecentInlineBots, items: sortedPeersWithRating.compactMap { (peerId, rating) in
if let entry = CodableEntry(RecentPeerItem(rating: rating)) {
return OrderedItemListEntry(id: RecentPeerItemId(peerId).rawValue, contents: entry)
} else {
return nil
}
})
}
} else {
return .complete()
}
}
return updatedRemotePeers
}
func _internal_addRecentlyUsedInlineBot(postbox: Postbox, peerId: PeerId) -> Signal<Void, NoError> {
return postbox.transaction { transaction -> Void in
var maxRating = 1.0
for entry in transaction.getOrderedListItems(collectionId: Namespaces.OrderedItemList.CloudRecentInlineBots) {
if let contents = entry.contents.get(RecentPeerItem.self) {
maxRating = max(maxRating, contents.rating)
}
}
if let entry = CodableEntry(RecentPeerItem(rating: maxRating)) {
transaction.addOrMoveToFirstPositionOrderedItemListItem(collectionId: Namespaces.OrderedItemList.CloudRecentInlineBots, item: OrderedItemListEntry(id: RecentPeerItemId(peerId).rawValue, contents: entry), removeTailIfCountExceeds: 20)
}
}
}
func _internal_recentlyUsedInlineBots(postbox: Postbox) -> Signal<[(Peer, Double)], NoError> {
return postbox.combinedView(keys: [.orderedItemList(id: Namespaces.OrderedItemList.CloudRecentInlineBots)])
|> take(1)
|> mapToSignal { view -> Signal<[(Peer, Double)], NoError> in
return postbox.transaction { transaction -> [(Peer, Double)] in
var peers: [(Peer, Double)] = []
if let view = view.views[.orderedItemList(id: Namespaces.OrderedItemList.CloudRecentInlineBots)] as? OrderedItemListView {
for item in view.items {
let peerId = RecentPeerItemId(item.id).peerId
if let peer = transaction.getPeer(peerId), let contents = item.contents.get(RecentPeerItem.self) {
peers.append((peer, contents.rating))
}
}
}
return peers
}
}
}
func _internal_removeRecentlyUsedInlineBot(account: Account, peerId: PeerId) -> Signal<Void, NoError> {
return account.postbox.transaction { transaction -> Signal<Void, NoError> in
transaction.removeOrderedItemListItem(collectionId: Namespaces.OrderedItemList.CloudRecentInlineBots, itemId: RecentPeerItemId(peerId).rawValue)
if let peer = transaction.getPeer(peerId), let apiPeer = apiInputPeer(peer) {
return account.network.request(Api.functions.contacts.resetTopPeerRating(category: .topPeerCategoryBotsInline, peer: apiPeer))
|> `catch` { _ -> Signal<Api.Bool, NoError> in
return .single(.boolFalse)
}
|> mapToSignal { _ -> Signal<Void, NoError> in
return .complete()
}
} else {
return .complete()
}
} |> switchToLatest
}
|
[
-1
] |
d058af893c0fed24d5c57f3820bd27ebc08dada0
|
7e53a9644d57d8a864a866cd43cf96c58b6f5d3c
|
/DDD/View/Attend/PopUpView.swift
|
123ce631524cdd774894f11bf07d34edee372665
|
[
"MIT"
] |
permissive
|
DevelopDesignDayDay/iOS
|
161886d1a0553caceeb64b31983dc450229949a1
|
304c42ea8545d92d459f7c48aed7543f104700a2
|
refs/heads/master
| 2020-04-22T11:30:19.702367 | 2019-04-01T01:02:41 | 2019-04-01T01:02:41 | 170,342,811 | 0 | 0 |
MIT
| 2019-04-01T08:18:52 | 2019-02-12T15:34:54 |
Swift
|
UTF-8
|
Swift
| false | false | 2,086 |
swift
|
//
// PopUpView.swift
// DDD
//
// Created by ParkSungJoon on 01/03/2019.
// Copyright © 2019 Gunter. All rights reserved.
//
import UIKit
class PopUpView: UIView {
@IBOutlet weak var backgroundView: UIView!
@IBOutlet weak var imageView: UIImageView!
@IBOutlet weak var descriptionLabel: UILabel!
@IBOutlet weak var acceptButton: UIButton!
@IBAction func acceptButton(_ sender: Any) {
self.removeAnimate()
}
override init(frame: CGRect) {
super.init(frame: frame)
commonInit()
roundCorners(layer: backgroundView.layer, radius: 16)
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
commonInit()
roundCorners(layer: backgroundView.layer, radius: 16)
}
private func commonInit() {
guard let view = Bundle.main.loadNibNamed(
"PopUpView",
owner: self,
options: nil)?.first as? UIView
else { return }
view.frame = self.bounds
self.addSubview(view)
}
func setupPopUpView(by userType: Int, _ isSuccess: Bool, _ message: String) {
switch UserType(userType: userType) {
case .admin:
backgroundView.backgroundColor = UIColor.dddRed
descriptionLabel.text = message
imageView.image = isSuccess ? #imageLiteral(resourceName: "popupCheckIcon") : #imageLiteral(resourceName: "popupExclamationMarkIcon")
case .general:
descriptionLabel.text = message
imageView.image = isSuccess ? #imageLiteral(resourceName: "popupCheckIcon") : #imageLiteral(resourceName: "popupExclamationMarkIcon")
backgroundView.backgroundColor = UIColor.dddGray
}
}
private func removeAnimate() {
UIView.animate(withDuration: 0.25, animations: {
self.transform = CGAffineTransform(scaleX: 1.3, y: 1.3)
self.alpha = 0.0
}) { (finished) in
if finished {
self.removeFromSuperview()
}
}
}
}
|
[
-1
] |
01c68a7fd4ac675fe837101970c885d11ea24920
|
d28b7da11f93c05f26db84bef59f81068e47bf62
|
/ChatRoom/MediaPicker/Coordinator.swift
|
16c6e2bd0cefa599a2fcf790d7c64927042a1f45
|
[] |
no_license
|
harsh1729/LucChatSDK
|
a13f528726f1838e631cf025dde55f18d6700d42
|
d4198143e81b9d682e5c92db9378f2de32979137
|
refs/heads/master
| 2020-11-26T10:22:03.734822 | 2019-12-19T11:49:15 | 2019-12-19T11:49:15 | 229,041,108 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 1,463 |
swift
|
/*
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
*/
import UIKit
/// Protocol describing a [Coordinator](http://khanlou.com/2015/10/coordinators-redux/).
/// Coordinators are the objects which control the navigation flow of the application.
/// It helps to isolate and reuse view controllers and pass dependencies down the navigation hierarchy.
protocol Coordinator: class {
/// Starts job of the coordinator.
func start()
/// Child coordinators to retain. Prevent them from getting deallocated.
var childCoordinators: [Coordinator] { get set }
/// Stores coordinator to the `childCoordinators` array.
///
/// - Parameter childCoordinator: Child coordinator to store.
func add(childCoordinator: Coordinator)
/// Remove coordinator from the `childCoordinators` array.
///
/// - Parameter childCoordinator: Child coordinator to remove.
func remove(childCoordinator: Coordinator)
}
// `Coordinator` default implementation
extension Coordinator {
func add(childCoordinator coordinator: Coordinator) {
childCoordinators.append(coordinator)
}
func remove(childCoordinator: Coordinator) {
self.childCoordinators = self.childCoordinators.filter { $0 !== childCoordinator }
}
}
|
[
-1
] |
e66f039350f45686e8038723462a9f058900306d
|
a61b239112cd268aa74daa42e56f0bdbf71771d1
|
/FinalProject/MovableBlockProtocol.swift
|
3b16eda6c94e93392f4e8f2ec69e94fe42e8fc30
|
[] |
no_license
|
louislai/bloatyrex
|
ce7c1f35c4163b327f227653a782f20c2d37f508
|
9c6a3842ff6d629460687a45b8596956275d7615
|
refs/heads/master
| 2021-01-09T09:35:15.110405 | 2016-04-24T02:38:24 | 2016-04-24T02:38:24 | 56,418,655 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 967 |
swift
|
//
// MovableBlockProtocol.swift
// FinalProject
//
// Created by Koh Wai Kit on 10/4/16.
// Copyright © 2016 nus.cs3217.2016Group6. All rights reserved.
//
import SpriteKit
/// Protocol for blocks that are meant to be moved around in the programming view.
/// These required methods help to position, categorize, and control the behaviour of the blocks
/// correctly
protocol MovableBlockProtocol: class {
var position: CGPoint { get set }
var zPosition: CGFloat { get set }
var containingBlock: ContainerBlockProtocol { get set }
var blockPosition: Int { get }
var category: BlockCategory { get }
/**
Deactivates the drop zones for the block. This is especially important when moving blocks, such
that the block does not snap to itself
**/
func deactivateDropZone()
/**
Activateds the drop zone to allow other blocks to snap to it.
**/
func activateDropZone()
func removeFromParent()
}
|
[
-1
] |
98e27e8c5b928c42868da68d8d7db0121b0b5ce3
|
f37871cb5e48fd11667f37c1e2271861bae5852f
|
/ios/Pods/Charts/Charts/Classes/Renderers/RadarChartRenderer.swift
|
f703d88e6ca8db32b0ff2e6ddd4de29995826438
|
[
"MIT",
"Apache-2.0"
] |
permissive
|
hxxy2003/malalaoshi
|
fa93d00ece1edc90160a6e2d9df7f9bf75b7144d
|
82efdb136b80d6063e412d07b077d9db1df82a1c
|
HEAD
| 2017-04-20T14:37:34.802772 | 2016-08-23T10:02:54 | 2016-08-24T09:36:45 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 14,303 |
swift
|
//
// RadarChartRenderer.swift
// Charts
//
// Created by Daniel Cohen Gindi on 4/3/15.
//
// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda
// A port of MPAndroidChart for iOS
// Licensed under Apache License 2.0
//
// https://github.com/danielgindi/ios-charts
//
import Foundation
import CoreGraphics
#if !os(OSX)
import UIKit
#endif
public class RadarChartRenderer: LineRadarChartRenderer
{
public weak var chart: RadarChartView?
public init(chart: RadarChartView, animator: ChartAnimator?, viewPortHandler: ChartViewPortHandler)
{
super.init(animator: animator, viewPortHandler: viewPortHandler)
self.chart = chart
}
public override func drawData(context context: CGContext)
{
guard let chart = chart else { return }
let radarData = chart.data
if (radarData != nil)
{
var mostEntries = 0
for set in radarData!.dataSets
{
if set.entryCount > mostEntries
{
mostEntries = set.entryCount
}
}
for set in radarData!.dataSets as! [IRadarChartDataSet]
{
if set.isVisible && set.entryCount > 0
{
drawDataSet(context: context, dataSet: set, mostEntries: mostEntries)
}
}
}
}
/// Draws the RadarDataSet
///
/// - parameter context:
/// - parameter dataSet:
/// - parameter mostEntries: the entry count of the dataset with the most entries
internal func drawDataSet(context context: CGContext, dataSet: IRadarChartDataSet, mostEntries: Int)
{
guard let
chart = chart,
animator = animator
else { return }
CGContextSaveGState(context)
let phaseX = animator.phaseX
let phaseY = animator.phaseY
let sliceangle = chart.sliceAngle
// calculate the factor that is needed for transforming the value to pixels
let factor = chart.factor
let center = chart.centerOffsets
let entryCount = dataSet.entryCount
let path = CGPathCreateMutable()
var hasMovedToPoint = false
for j in 0 ..< entryCount
{
guard let e = dataSet.entryForIndex(j) else { continue }
let p = ChartUtils.getPosition(
center: center,
dist: CGFloat(e.value - chart.chartYMin) * factor * phaseY,
angle: sliceangle * CGFloat(j) * phaseX + chart.rotationAngle)
if p.x.isNaN
{
continue
}
if !hasMovedToPoint
{
CGPathMoveToPoint(path, nil, p.x, p.y)
hasMovedToPoint = true
}
else
{
CGPathAddLineToPoint(path, nil, p.x, p.y)
}
}
// if this is the largest set, close it
if dataSet.entryCount < mostEntries
{
// if this is not the largest set, draw a line to the center before closing
CGPathAddLineToPoint(path, nil, center.x, center.y)
}
CGPathCloseSubpath(path)
// draw filled
if dataSet.isDrawFilledEnabled
{
if dataSet.fill != nil
{
drawFilledPath(context: context, path: path, fill: dataSet.fill!, fillAlpha: dataSet.fillAlpha)
}
else
{
drawFilledPath(context: context, path: path, fillColor: dataSet.fillColor, fillAlpha: dataSet.fillAlpha)
}
}
// draw the line (only if filled is disabled or alpha is below 255)
if !dataSet.isDrawFilledEnabled || dataSet.fillAlpha < 1.0
{
CGContextSetStrokeColorWithColor(context, dataSet.colorAt(0).CGColor)
CGContextSetLineWidth(context, dataSet.lineWidth)
CGContextSetAlpha(context, 1.0)
CGContextBeginPath(context)
CGContextAddPath(context, path)
CGContextStrokePath(context)
}
CGContextRestoreGState(context)
}
public override func drawValues(context context: CGContext)
{
guard let
chart = chart,
data = chart.data,
animator = animator
else { return }
let phaseX = animator.phaseX
let phaseY = animator.phaseY
let sliceangle = chart.sliceAngle
// calculate the factor that is needed for transforming the value to pixels
let factor = chart.factor
let center = chart.centerOffsets
let yoffset = CGFloat(5.0)
for i in 0 ..< data.dataSetCount
{
let dataSet = data.getDataSetByIndex(i) as! IRadarChartDataSet
if !dataSet.isDrawValuesEnabled || dataSet.entryCount == 0
{
continue
}
let entryCount = dataSet.entryCount
for j in 0 ..< entryCount
{
guard let e = dataSet.entryForIndex(j) else { continue }
let p = ChartUtils.getPosition(
center: center,
dist: CGFloat(e.value) * factor * phaseY,
angle: sliceangle * CGFloat(j) * phaseX + chart.rotationAngle)
let valueFont = dataSet.valueFont
guard let formatter = dataSet.valueFormatter else { continue }
ChartUtils.drawText(
context: context,
text: formatter.stringFromNumber(e.value)!,
point: CGPoint(x: p.x, y: p.y - yoffset - valueFont.lineHeight),
align: .Center,
attributes: [NSFontAttributeName: valueFont,
NSForegroundColorAttributeName: dataSet.valueTextColorAt(j)]
)
}
}
}
public override func drawExtras(context context: CGContext)
{
drawWeb(context: context)
}
private var _webLineSegmentsBuffer = [CGPoint](count: 2, repeatedValue: CGPoint())
public func drawWeb(context context: CGContext)
{
guard let
chart = chart,
data = chart.data
else { return }
let sliceangle = chart.sliceAngle
CGContextSaveGState(context)
// calculate the factor that is needed for transforming the value to
// pixels
let factor = chart.factor
let rotationangle = chart.rotationAngle
var points = [CGPoint]()
let center = chart.centerOffsets
// draw the web lines that come from the center
CGContextSetLineWidth(context, chart.webLineWidth)
CGContextSetStrokeColorWithColor(context, chart.webColor.CGColor)
CGContextSetAlpha(context, chart.webAlpha)
let xIncrements = 1 + chart.skipWebLineCount
// get points
for i in 0.stride(to: data.xValCount, by: xIncrements)
{
let p = ChartUtils.getPosition(
center: center,
dist: CGFloat(chart.yRange) * factor,
angle: sliceangle * CGFloat(i) + rotationangle)
points.append(p)
}
// draw background
for (index, point) in points.enumerate() {
if index == 0 {
CGContextMoveToPoint(context, point.x, point.y)
}else {
CGContextAddLineToPoint(context, point.x, point.y)
}
}
CGContextClosePath(context)
CGContextSetRGBFillColor(context, 201/255, 228/255, 248/255, 1)
CGContextEOFillPath(context)
// draw web lines
for p in points {
_webLineSegmentsBuffer[0].x = center.x
_webLineSegmentsBuffer[0].y = center.y
_webLineSegmentsBuffer[1].x = p.x
_webLineSegmentsBuffer[1].y = p.y
CGContextStrokeLineSegments(context, _webLineSegmentsBuffer, 2)
}
// draw the inner-web
CGContextSetLineWidth(context, chart.innerWebLineWidth)
CGContextSetStrokeColorWithColor(context, chart.innerWebColor.CGColor)
CGContextSetAlpha(context, chart.webAlpha)
let labelCount = chart.yAxis.entryCount
for j in 0 ..< labelCount
{
for i in 0 ..< data.xValCount
{
let r = CGFloat(chart.yAxis.entries[j] - chart.chartYMin) * factor
let p1 = ChartUtils.getPosition(center: center, dist: r, angle: sliceangle * CGFloat(i) + rotationangle)
let p2 = ChartUtils.getPosition(center: center, dist: r, angle: sliceangle * CGFloat(i + 1) + rotationangle)
_webLineSegmentsBuffer[0].x = p1.x
_webLineSegmentsBuffer[0].y = p1.y
_webLineSegmentsBuffer[1].x = p2.x
_webLineSegmentsBuffer[1].y = p2.y
CGContextStrokeLineSegments(context, _webLineSegmentsBuffer, 2)
}
}
CGContextRestoreGState(context)
}
private var _highlightPointBuffer = CGPoint()
public override func drawHighlighted(context context: CGContext, indices: [ChartHighlight])
{
guard let
chart = chart,
data = chart.data as? RadarChartData,
animator = animator
else { return }
CGContextSaveGState(context)
CGContextSetLineWidth(context, data.highlightLineWidth)
if (data.highlightLineDashLengths != nil)
{
CGContextSetLineDash(context, data.highlightLineDashPhase, data.highlightLineDashLengths!, data.highlightLineDashLengths!.count)
}
else
{
CGContextSetLineDash(context, 0.0, nil, 0)
}
let phaseX = animator.phaseX
let phaseY = animator.phaseY
let sliceangle = chart.sliceAngle
let factor = chart.factor
let center = chart.centerOffsets
for i in 0 ..< indices.count
{
guard let set = chart.data?.getDataSetByIndex(indices[i].dataSetIndex) as? IRadarChartDataSet else { continue }
if !set.isHighlightEnabled
{
continue
}
CGContextSetStrokeColorWithColor(context, set.highlightColor.CGColor)
// get the index to highlight
let xIndex = indices[i].xIndex
let e = set.entryForXIndex(xIndex)
if e?.xIndex != xIndex
{
continue
}
let j = set.entryIndex(entry: e!)
let y = (e!.value - chart.chartYMin)
if (y.isNaN)
{
continue
}
_highlightPointBuffer = ChartUtils.getPosition(
center: center,
dist: CGFloat(y) * factor * phaseY,
angle: sliceangle * CGFloat(j) * phaseX + chart.rotationAngle)
// draw the lines
drawHighlightLines(context: context, point: _highlightPointBuffer, set: set)
if (set.isDrawHighlightCircleEnabled)
{
if (!_highlightPointBuffer.x.isNaN && !_highlightPointBuffer.y.isNaN)
{
var strokeColor = set.highlightCircleStrokeColor
if strokeColor == nil
{
strokeColor = set.colorAt(0)
}
if set.highlightCircleStrokeAlpha < 1.0
{
strokeColor = strokeColor?.colorWithAlphaComponent(set.highlightCircleStrokeAlpha)
}
drawHighlightCircle(
context: context,
atPoint: _highlightPointBuffer,
innerRadius: set.highlightCircleInnerRadius,
outerRadius: set.highlightCircleOuterRadius,
fillColor: set.highlightCircleFillColor,
strokeColor: strokeColor,
strokeWidth: set.highlightCircleStrokeWidth)
}
}
}
CGContextRestoreGState(context)
}
internal func drawHighlightCircle(
context context: CGContext,
atPoint point: CGPoint,
innerRadius: CGFloat,
outerRadius: CGFloat,
fillColor: NSUIColor?,
strokeColor: NSUIColor?,
strokeWidth: CGFloat)
{
CGContextSaveGState(context)
if let fillColor = fillColor
{
CGContextBeginPath(context)
CGContextAddEllipseInRect(context, CGRectMake(point.x - outerRadius, point.y - outerRadius, outerRadius * 2.0, outerRadius * 2.0))
if innerRadius > 0.0
{
CGContextAddEllipseInRect(context, CGRectMake(point.x - innerRadius, point.y - innerRadius, innerRadius * 2.0, innerRadius * 2.0))
}
CGContextSetFillColorWithColor(context, fillColor.CGColor)
CGContextEOFillPath(context)
}
if let strokeColor = strokeColor
{
CGContextBeginPath(context)
CGContextAddEllipseInRect(context, CGRectMake(point.x - outerRadius, point.y - outerRadius, outerRadius * 2.0, outerRadius * 2.0))
CGContextSetStrokeColorWithColor(context, strokeColor.CGColor)
CGContextSetLineWidth(context, strokeWidth)
CGContextStrokePath(context)
}
CGContextRestoreGState(context)
}
}
|
[
179970,
39235
] |
1e9c07e9019e167aca7315358afa79eebc9b23c8
|
3be844f3fa61d6c8b1d0b6404d9c69855462bb7e
|
/CoreTextView.swift
|
98cd1c14aa2fe5eeacc2adb5a8ee996835327ee0
|
[] |
no_license
|
nikhiljay/prioritize-app
|
ba86e70a472f4ff3ff3dac1c8fa2a441c1cd7d97
|
f82a8ba217710cfca3a75c3ff7deff5e1328340e
|
refs/heads/master
| 2021-03-22T00:15:31.235539 | 2015-11-26T22:29:49 | 2015-11-26T22:29:49 | 32,247,384 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 5,216 |
swift
|
//
// CoreTextView.swift
// DesignerNewsApp
//
// Created by James Tang on 26/1/15.
// Copyright (c) 2015 Meng To. All rights reserved.
//
import UIKit
var imageSizes : [NSURL:CGSize] = [NSURL:CGSize]()
@objc protocol CoreTextViewDelegate : class {
func coreTextView(textView: CoreTextView, linkDidTap link:NSURL)
optional func coreTextView(textView: CoreTextView, newImageSizeDidCache size:CGSize)
}
class CoreTextView: DTAttributedTextContentView, DTAttributedTextContentViewDelegate, DTLazyImageViewDelegate {
weak var linkDelegate : CoreTextViewDelegate?
private var imageViews = [DTLazyImageView]()
required init(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.delegate = self
self.edgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
self.clipsToBounds = true
}
override func layoutSubviews() {
super.layoutSubviews()
// Fix warning when layer is to high
CoreTextView.setLayerClass(NSClassFromString("DTTiledLayerWithoutFade"))
}
func linkDidTap(sender: DTLinkButton) {
if let url = sender.URL {
if let delegate = self.linkDelegate {
delegate.coreTextView(self, linkDidTap: url)
} else {
UIApplication.sharedApplication().openURL(url)
}
}
}
func attributedTextContentView(attributedTextContentView: DTAttributedTextContentView!, viewForAttributedString string: NSAttributedString!, frame: CGRect) -> UIView! {
let attributes = string.attributesAtIndex(0, effectiveRange: nil)
let url = attributes[DTLinkAttribute] as? NSURL
let identifier = attributes[DTGUIDAttribute] as? String
let button = DTLinkButton(frame: frame)
button.URL = url
button.GUID = identifier
button.minimumHitSize = CGSizeMake(25, 25)
button.addTarget(self, action: "linkDidTap:", forControlEvents: .TouchUpInside)
return button
}
func attributedTextContentView(attributedTextContentView: DTAttributedTextContentView!, viewForAttachment attachment: DTTextAttachment!, frame: CGRect) -> UIView! {
if let attachment = attachment as? DTImageTextAttachment {
let size = self.aspectFitSizeForURL(attachment.contentURL)
let aspectFrame = CGRectMake(frame.origin.x, frame.origin.y, size.width, size.height)
let imageView = DTLazyImageView(frame: aspectFrame)
imageView.delegate = self
imageView.url = attachment.contentURL
imageView.contentMode = UIViewContentMode.ScaleAspectFill
imageView.clipsToBounds = true
imageView.backgroundColor = UIColor(white: 0.98, alpha: 1.0)
imageView.shouldShowProgressiveDownload = true
imageViews.append(imageView)
return imageView
}
return nil
}
// MARK: DTLazyImageViewDelegate
func lazyImageView(lazyImageView: DTLazyImageView!, didChangeImageSize size: CGSize) {
let url = lazyImageView.url
let pred = NSPredicate(format: "contentURL == %@", url)
if let layoutFrame = self.layoutFrame {
var attachments = layoutFrame.textAttachmentsWithPredicate(pred)
var needsNotifyNewImageSize = false
for var i = 0; i < attachments.count; i++ {
if var one = attachments[i] as? DTImageTextAttachment {
one.originalSize = self.aspectFitImageSize(size)
if let cachedSize = imageSizes[one.contentURL] {
if !CGSizeEqualToSize(cachedSize, size) {
needsNotifyNewImageSize = true
self.linkDelegate?.coreTextView?(self, newImageSizeDidCache: size)
}
} else {
needsNotifyNewImageSize = true
}
imageSizes[one.contentURL] = size
}
}
self.layouter = nil
self.relayoutText()
if needsNotifyNewImageSize {
self.linkDelegate?.coreTextView?(self, newImageSizeDidCache: size)
}
}
}
override func intrinsicContentSize() -> CGSize {
var size = super.intrinsicContentSize()
if let layoutFrame = self.layoutFrame {
for attachments in layoutFrame.textAttachments() {
if let attachment = attachments as? DTImageTextAttachment {
size.height += self.aspectFitSizeForURL(attachment.contentURL).height
}
}
}
return size
}
func aspectFitSizeForURL(url: NSURL) -> CGSize {
let imageSize = imageSizes[url] ?? CGSizeMake(4, 3)
return self.aspectFitImageSize(imageSize)
}
func aspectFitImageSize(size : CGSize) -> CGSize {
if CGSizeEqualToSize(size, CGSizeZero) {
return size
}
return CGSizeMake(self.bounds.size.width, self.bounds.size.width/size.width * size.height)
}
deinit {
for imageView in imageViews {
imageView.delegate = nil
}
}
}
|
[
-1
] |
f07fd23a99ecd3c7722b9b7a069e7451a6cac253
|
d789d7c7d69e05b1a64b74f1f8205b5e8d282db5
|
/CloudKitPractice/AppDelegate.swift
|
413f8e93de5fd5fdaadf9e4faeaf6acb9b0bfd3a
|
[] |
no_license
|
tatsuyamoriguchi/CloudKitPractice
|
2e970f695b3f21ec06cb836a2e3f8d029294e7b6
|
316809c32d4a5e26e5fec9641abbab392954c821
|
refs/heads/master
| 2020-05-07T12:20:12.897302 | 2019-04-10T04:14:28 | 2019-04-10T04:14:28 | 180,500,480 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 2,186 |
swift
|
//
// AppDelegate.swift
// CloudKitPractice
//
// Created by Tatsuya Moriguchi on 4/9/19.
// Copyright © 2019 Becko's Inc. 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,
229388,
229391,
327695,
229394,
229397,
229399,
229402,
278556,
229405,
229408,
278564,
229415,
229417,
327722,
237613,
229422,
360496,
229426,
237618,
229428,
286774,
319544,
204856,
229432,
286776,
286778,
352318,
286791,
237640,
278605,
286797,
311375,
237646,
196692,
319573,
311383,
319590,
311400,
278635,
303212,
278639,
131192,
278648,
237693,
303230,
327814,
131209,
303241,
417930,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
286916,
286922,
286924,
286926,
319694,
286928,
131281,
278747,
295133,
155872,
319716,
237807,
303345,
286962,
303347,
229622,
327930,
278781,
278783,
278785,
237826,
319751,
286987,
319757,
311569,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
155966,
319809,
319810,
278849,
319814,
311623,
319818,
311628,
229709,
319822,
287054,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
319879,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
278980,
278983,
319945,
278986,
278990,
278994,
311767,
279003,
279006,
188895,
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,
213575,
172618,
303690,
33357,
303696,
279124,
172634,
262752,
254563,
172644,
311911,
189034,
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,
295583,
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,
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,
279353,
230202,
312124,
328508,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
279390,
230241,
279394,
303976,
336744,
303981,
303985,
303987,
328563,
303991,
303997,
295808,
304005,
295813,
304007,
320391,
213895,
304009,
304011,
304013,
279438,
295822,
189329,
295825,
189331,
304019,
58262,
304023,
279452,
279461,
279462,
304042,
213931,
304055,
230327,
287675,
197564,
230334,
304063,
238528,
304065,
213954,
189378,
156612,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
295945,
295949,
230413,
197645,
320528,
140312,
295961,
238620,
304164,
304170,
304175,
238641,
312374,
238652,
238655,
230465,
238658,
296004,
132165,
336964,
205895,
320584,
238666,
296021,
402518,
230497,
296036,
361576,
296040,
205931,
296044,
279661,
205934,
164973,
312432,
279669,
337018,
189562,
279679,
66690,
279683,
222340,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
165038,
238766,
230576,
238770,
304311,
230592,
312518,
279750,
230600,
230607,
148690,
320727,
279769,
304348,
279777,
304354,
296163,
320740,
279781,
304360,
320748,
279788,
279790,
304370,
296189,
320771,
312585,
296202,
296205,
230674,
320786,
230677,
296213,
296215,
320792,
230681,
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,
230763,
230768,
296305,
312692,
230773,
304505,
181626,
304506,
181631,
312711,
312712,
296331,
288140,
288144,
230800,
304533,
337306,
288154,
288160,
173472,
288162,
288164,
279975,
304555,
370092,
279983,
173488,
288176,
279985,
312755,
296373,
312759,
337335,
288185,
279991,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
288210,
370130,
288212,
222676,
280021,
288214,
239064,
329177,
288217,
280027,
288220,
288218,
239070,
288224,
280034,
288226,
280036,
288229,
280038,
288230,
288232,
370146,
320998,
288234,
288236,
288238,
288240,
288242,
296435,
288244,
288250,
148990,
321022,
206336,
402942,
296446,
296450,
230916,
230919,
304651,
370187,
304653,
230923,
230940,
222752,
108066,
296486,
296488,
157229,
230961,
157236,
288320,
288325,
124489,
288338,
280149,
288344,
280152,
239194,
280158,
403039,
370272,
239202,
312938,
280183,
280185,
116354,
288408,
280222,
419489,
190118,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
419522,
313027,
280260,
419525,
206536,
280264,
206539,
206541,
206543,
263888,
280276,
321239,
280283,
18140,
313052,
288478,
313055,
419555,
321252,
313066,
280302,
288494,
313073,
419570,
288499,
321266,
288502,
280314,
288510,
124671,
67330,
280324,
198405,
288519,
280331,
198416,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
288576,
345921,
280388,
304968,
280393,
280402,
173907,
313176,
280419,
321381,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
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,
280681,
313451,
223341,
280687,
215154,
313458,
280691,
149618,
313464,
329850,
321659,
288895,
321670,
215175,
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,
305464,
280891,
289087,
280897,
280900,
239944,
305480,
280906,
239947,
305485,
305489,
280919,
248153,
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,
289227,
281047,
215526,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
240132,
281095,
223752,
338440,
150025,
223757,
281102,
223763,
223765,
281113,
322074,
281121,
182819,
281127,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
338528,
338532,
281190,
199273,
281196,
158317,
19053,
313973,
297594,
281210,
158347,
264845,
133776,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
314047,
314051,
199364,
297671,
158409,
256716,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
322310,
264969,
322314,
322318,
281361,
281372,
322341,
215850,
281388,
289593,
281401,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
174955,
224110,
207733,
207737,
183172,
158596,
338823,
322440,
314249,
240519,
183184,
240535,
289687,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
281567,
289762,
322534,
297961,
183277,
281581,
322550,
134142,
322563,
314372,
330764,
175134,
322599,
322610,
314421,
281654,
314427,
314433,
207937,
322642,
314456,
281691,
314461,
281702,
281704,
281711,
289912,
248995,
306341,
306344,
306347,
322734,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
216303,
322801,
388350,
363802,
199976,
199978,
314671,
298292,
298294,
216376,
298306,
380226,
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,
298377,
314763,
314768,
224657,
306581,
314773,
314779,
314785,
314793,
282025,
282027,
241068,
241070,
241072,
282034,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
282101,
241142,
191992,
290298,
151036,
290302,
290305,
192008,
323084,
290321,
282130,
282133,
290325,
241175,
290328,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
28219,
282186,
224849,
282195,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
257658,
315016,
282249,
290445,
324757,
282261,
175770,
298651,
323229,
282269,
298655,
323231,
61092,
282277,
323260,
282300,
323266,
282310,
323273,
282319,
306897,
241362,
306904,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
241450,
282410,
306988,
306991,
315184,
315190,
241464,
159545,
282425,
298811,
307009,
413506,
241475,
307012,
298822,
148946,
315211,
307027,
315221,
315223,
241496,
241498,
307035,
307040,
110433,
282465,
241509,
110438,
298860,
110445,
282478,
315249,
110450,
315251,
315253,
315255,
339838,
315267,
315269,
241544,
282505,
241546,
241548,
298896,
298898,
282514,
241556,
298901,
44948,
241560,
282520,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
241581,
241583,
323504,
241586,
282547,
290739,
241588,
241590,
241592,
241598,
290751,
241600,
241605,
151495,
241610,
298975,
241632,
298984,
241643,
298988,
241646,
241649,
241652,
323574,
290807,
241661,
299006,
282623,
315396,
241669,
315397,
282632,
307211,
282639,
282645,
241693,
241701,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
307278,
307287,
315482,
217179,
315483,
192605,
233567,
200801,
299105,
217188,
299109,
307303,
315495,
356457,
307307,
45163,
315502,
192624,
307314,
323700,
299126,
233591,
307329,
315524,
307338,
233613,
241813,
307352,
299164,
241821,
184479,
299167,
184481,
315557,
184486,
307370,
307372,
307374,
307376,
299185,
323763,
176311,
299191,
307385,
307386,
258235,
307388,
176316,
307390,
184503,
299200,
307394,
307396,
299204,
184518,
307399,
323784,
307409,
307411,
299225,
233701,
307432,
282881,
282893,
323854,
291089,
282906,
291104,
233766,
307508,
315701,
332086,
307510,
307512,
307515,
307518,
282942,
282947,
323917,
110926,
282957,
233808,
323921,
315733,
323926,
233815,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
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,
291299,
127463,
242152,
291305,
127466,
176620,
127474,
291314,
291317,
135672,
233979,
291323,
291330,
127490,
283142,
127497,
233994,
135689,
127500,
233998,
127506,
234003,
127509,
234006,
127511,
152087,
283161,
242202,
234010,
135707,
135710,
242206,
242208,
291361,
291378,
152118,
234038,
234041,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
135808,
291456,
373383,
299655,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
135839,
299680,
225954,
135844,
299684,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
119509,
226005,
201444,
283368,
234219,
283372,
226037,
283382,
316151,
234231,
234236,
226045,
242431,
234239,
209665,
234242,
299778,
242436,
226053,
234246,
226056,
234248,
291593,
242443,
234252,
242445,
234254,
291601,
242450,
234258,
242452,
234261,
348950,
201496,
234264,
234266,
234269,
283421,
234272,
234274,
152355,
234278,
299814,
283432,
234281,
234284,
234287,
283440,
185138,
234292,
234296,
234298,
160572,
283452,
234302,
234307,
234309,
316233,
234313,
316235,
234316,
283468,
242511,
234319,
234321,
234324,
201557,
185173,
234333,
308063,
234336,
234338,
349027,
242530,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
234364,
291711,
234368,
234370,
201603,
291716,
234373,
316294,
226182,
234375,
308105,
226185,
234379,
234384,
234388,
234390,
324504,
234393,
209818,
308123,
324508,
234396,
291742,
226200,
234401,
291747,
291748,
234405,
291750,
234407,
324520,
324518,
234410,
291754,
291756,
324522,
226220,
324527,
291760,
234417,
201650,
324531,
234422,
226230,
324536,
275384,
234428,
291773,
234431,
242623,
324544,
324546,
234434,
324548,
234437,
226245,
234439,
234443,
291788,
234446,
275406,
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,
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,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
308373,
226453,
234647,
275606,
275608,
234650,
308379,
234648,
234653,
300189,
119967,
324768,
324766,
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,
300299,
177419,
242957,
283917,
300301,
177424,
275725,
349451,
349464,
415009,
283939,
259367,
292143,
283951,
300344,
243003,
283963,
283973,
300357,
283983,
316758,
357722,
316766,
316768,
292192,
218464,
292197,
316774,
218473,
284010,
324978,
136562,
275834,
333178,
275836,
275840,
316803,
316806,
316811,
316814,
226703,
300433,
234899,
226709,
357783,
316824,
316826,
144796,
300448,
144807,
144810,
144812,
284076,
144814,
144820,
284084,
284087,
292279,
144826,
144828,
144830,
144832,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
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,
308790,
284215,
316983,
194103,
284218,
226877,
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,
284258,
292452,
292454,
284263,
284265,
292458,
284267,
292461,
284272,
284274,
276086,
284278,
292470,
292473,
284283,
276093,
284286,
292479,
284288,
292481,
284290,
325250,
284292,
292485,
276095,
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,
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,
300832,
300834,
317221,
227109,
358183,
276268,
300845,
243504,
300850,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
292681,
153417,
358224,
276308,
178006,
317271,
284502,
276315,
292700,
284511,
317279,
227175,
292715,
300912,
284529,
292721,
300915,
292729,
317306,
284540,
292734,
325512,
276365,
358292,
284564,
317332,
284566,
399252,
350106,
284572,
276386,
284579,
276388,
358312,
284585,
317353,
276395,
292784,
358326,
161718,
276410,
276411,
358330,
276418,
301009,
301011,
301013,
292823,
301015,
301017,
358360,
292828,
276446,
153568,
276448,
276452,
292839,
276455,
292843,
276460,
276464,
178161,
227314,
276466,
325624,
276472,
317435,
276476,
276479,
276482,
276485,
317446,
276490,
350218,
350222,
317456,
276496,
317458,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
276528,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
276544,
284739,
325700,
243779,
292934,
243785,
350293,
350295,
309337,
194649,
227418,
350299,
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,
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,
309468,
309471,
301283,
317672,
317674,
325867,
243948,
309491,
227571,
309494,
243960,
276735,
227583,
227587,
276739,
276742,
227593,
227596,
325910,
309530,
342298,
211232,
317729,
276775,
211241,
325937,
325943,
211260,
260421,
276809,
285002,
276811,
235853,
235858,
276829,
276833,
391523,
276836,
276843,
293227,
276848,
293232,
186744,
211324,
227709,
285061,
366983,
317833,
178572,
285070,
285077,
227738,
317853,
276896,
317858,
342434,
285093,
317864,
276907,
235955,
276917,
293304,
293307,
293314,
309707,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
227810,
293346,
276964,
293352,
236013,
301562,
317951,
309764,
301575,
121352,
236043,
342541,
113167,
309779,
317971,
309781,
277011,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
23094,
277054,
219714,
129603,
318020,
301639,
301643,
277071,
285265,
399955,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
309871,
121458,
277106,
170619,
309885,
309888,
277122,
277128,
285320,
301706,
318092,
326285,
334476,
318094,
277136,
277139,
227992,
318108,
285340,
318110,
227998,
137889,
383658,
285357,
318128,
277170,
342707,
318132,
154292,
293555,
277173,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
342745,
137946,
342747,
342749,
113378,
228069,
277223,
342760,
285417,
56043,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
228113,
285459,
277273,
293659,
326430,
228128,
293666,
285474,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
285494,
301880,
301884,
310080,
293696,
277317,
277322,
293706,
310100,
301911,
277337,
301913,
301921,
400236,
236397,
162671,
310134,
15224,
236408,
277368,
416639,
416640,
113538,
416648,
39817,
187274,
277385,
301972,
424853,
277405,
277411,
310179,
293798,
293802,
236460,
277426,
276579,
293811,
293817,
293820,
203715,
326603,
342994,
276586,
293849,
293861,
228327,
228330,
318442,
228332,
326638,
277486,
351217,
318450,
293876,
293877,
285686,
302073,
285690,
121850,
302075,
244731,
293882,
293887,
277504,
277507,
277511,
277519,
293917,
293939,
318516,
277561,
310336,
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,
384148,
162964,
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,
64768,
310531,
285958,
138505,
228617,
318742,
277798,
130345,
113964,
285997,
285999,
113969,
318773,
318776,
286010,
417086,
286016,
302403,
294211,
384328,
326991,
294223,
179547,
146784,
302436,
294246,
327015,
310632,
327017,
351594,
351607,
310648,
310651,
310657,
310659,
351619,
294276,
327046,
253320,
310665,
318858,
310672,
351633,
310689,
130468,
228776,
277932,
310703,
310710,
130486,
310712,
310715,
302526,
228799,
302534,
245191,
310727,
64966,
163272,
292968,
302541,
302543,
310737,
228825,
163290,
310749,
310755,
187880,
310764,
286188,
310772,
40440,
212472,
40443,
286203,
310780,
40448,
228864,
286214,
228871,
302603,
65038,
302614,
302617,
286233,
302621,
286240,
146977,
294435,
187939,
40484,
40486,
286246,
40488,
278057,
294439,
40491,
294440,
294443,
294445,
310831,
245288,
40499,
212538,
40507,
40511,
40513,
228933,
40521,
286283,
40525,
40527,
400976,
212560,
228944,
40533,
147032,
40537,
40539,
40541,
278109,
40544,
40548,
40550,
40552,
286312,
40554,
286313,
310892,
40557,
40560,
294521,
343679,
294537,
310925,
286354,
278163,
122517,
278168,
179870,
327333,
229030,
278188,
302764,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
302793,
294601,
343757,
212690,
278227,
286420,
319187,
229076,
286425,
319194,
278235,
278238,
229086,
294625,
294634,
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,
294776,
360317,
294785,
327554,
360322,
40851,
294811,
319390,
237470,
40865,
319394,
294817,
294821,
311209,
180142,
294831,
188340,
40886,
294844,
294847,
237508,
393177,
294876,
294879,
294883,
393190,
294890,
311279,
278513,
237555,
311283,
278516,
237562
] |
bbcbce1d8a8806f31433d89d909d42677f9be073
|
6efd62f9ed348860c1895cbcd49aa0eb66d61f3c
|
/Luzaz/Scenes/Chat/Conversation/ConversationViewController+PresenterDelegate.swift
|
4584cca4ce45922e2d84cb45f18444732470c99f
|
[] |
no_license
|
anasmohamed/Luzaz
|
37d192eb92097d529a721ef7edc0c7f44e630591
|
3ac592d99b010a2867da61af2744ad06cb93abca
|
refs/heads/master
| 2020-06-30T03:58:46.688124 | 2020-06-21T17:04:28 | 2020-06-21T17:04:28 | 200,716,433 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 782 |
swift
|
//
// ConversationViewController+PresenterDelegate.swift
// Luzaz
//
// Created by jets on 1/14/1441 AH.
// Copyright © 1441 AH Luzaz. All rights reserved.
//
import UIKit
import Foundation
extension ConverstionViewController : ConversationView {
func getConversationSuccess() {
tableView.reloadData()
}
func showError(error: String) {
let alertController = UIAlertController(title: "Error".localiz(), message: error.localiz(), preferredStyle: .alert)
let action = UIAlertAction(title: "OK".localiz(), style: .default, handler: nil)
alertController.addAction(action)
present(alertController, animated: true, completion: nil)
}
func addConversationSucces() {
tableView.reloadData()
}
}
|
[
-1
] |
68b3bd2b24268c29d5e51e1cd95df905a1a3e622
|
06e19c610e72dcf8eee76f1aeec5ab5da7660f11
|
/MapKitPathRenderer.swift
|
6365439c558dda7fd75d03446194595dfba533e5
|
[
"MIT"
] |
permissive
|
HemDutt/MapKitPathRenderer
|
15a16b06ae9dba93392f7dd030828f865309bb29
|
9fb49eab15b36502d517efbdf5e49ba6d9525f4b
|
refs/heads/master
| 2020-03-13T19:13:19.398614 | 2018-05-02T07:43:22 | 2018-05-02T07:43:22 | 131,249,301 | 4 | 1 |
MIT
| 2018-05-03T15:58:37 | 2018-04-27T05:25:09 |
Swift
|
UTF-8
|
Swift
| false | false | 1,525 |
swift
|
//
// MapKitPathRenderer.swift
// MapKitPathRenderer
//
// Created by Hem Dutt on 27/04/18.
//
import UIKit
import MapKit
struct MapSourceDestinationStruct
{
var sourceCoordinate : CLLocationCoordinate2D? = nil
var destinationCoordinate : CLLocationCoordinate2D? = nil
}
//defaultStepCount is the count of points needed between source and destiation coordinates
//let defaultStepCount = 20
public class MapKitPathRenderer: NSObject
{
public func getRoutePathBetween(source : CLLocationCoordinate2D , destination : CLLocationCoordinate2D , straightLinePath : Bool = true ,steps : Int = 20) -> (MKPolyline?, [CLLocationCoordinate2D]?)
{
if straightLinePath == true
{
//Return straight line route between source, destination points
return MKPRStraightLineRoute.init().getRoutePathBetween(source: source, destination: destination, steps: steps)
}
return (nil , nil)
}
func getRoutesForSourceDestinatonStructArray(_ sdArray : [MapSourceDestinationStruct] ,straightLinePath : Bool = true, steps : Int = 20) -> [(MKPolyline?, [CLLocationCoordinate2D]?)]
{
var routes : [(MKPolyline?, [CLLocationCoordinate2D]?)] = []
if straightLinePath == true
{
//Return multiple straight line routes for multiple source, destination points in sdArray
routes = MKPRStraightLineRoute.init().getRoutesForSourceDestinatonStructArray(sdArray, steps: steps)
}
return routes
}
}
|
[
-1
] |
5c0be3a9d12de44446d804d7fb565b8118baeb81
|
8c0e84e2bb5baa05218ffc746e21d01aff5451ea
|
/WavesWallet-iOS/CustomViews/AddressBookButton.swift
|
7487c03a37832a2f96e83097ac7cd4f2fe1b9740
|
[
"MIT"
] |
permissive
|
bianxiang/WavesWallet-iOS-FirebaseRemoved
|
e3642af08cc06e4c0c3269e709b97fefe9a2386a
|
4e59840cf4b351db92081455156f00dd9a9fda60
|
refs/heads/master
| 2022-10-15T01:55:34.659665 | 2019-08-21T03:18:31 | 2019-08-21T03:18:31 | 203,492,071 | 0 | 0 |
MIT
| 2022-10-06T06:36:01 | 2019-08-21T02:39:08 |
Swift
|
UTF-8
|
Swift
| false | false | 1,806 |
swift
|
//
// AddressBookButton.swift
// WavesWallet-iOS
//
// Created by rprokofev on 11/03/2019.
// Copyright © 2019 Waves Platform. All rights reserved.
//
import Foundation
import UIKit
final class AddressBookButton: UIButton {
enum Kind {
case edit
case add
}
override func awakeFromNib() {
super.awakeFromNib()
titleLabel?.font = .systemFont(ofSize: 13, weight: .regular)
setTitleColor(.white, for: .normal)
setBackgroundImage(UIColor.submit300.image, for: .normal)
setBackgroundImage(UIColor.submit200.image, for: .highlighted)
imageEdgeInsets = UIEdgeInsets(top: 0,
left: -4,
bottom: 0,
right: 0)
contentEdgeInsets = UIEdgeInsets(top: 0,
left: 8,
bottom: 0,
right: 8)
imageView?.tintColor = .white
layer.masksToBounds = true
layer.cornerRadius = 4
update(with: .edit)
}
}
extension AddressBookButton: ViewConfiguration {
func update(with model: AddressBookButton.Kind) {
switch model {
case .edit:
setTitle(Localizable.Waves.Addressbookbutton.Title.editName, for: .normal)
setImage(Images.editaddress24Submit300.image, for: .normal)
setImage(Images.editaddress24Submit200.image, for: .highlighted)
case .add:
setTitle(Localizable.Waves.Addressbookbutton.Title.saveAddress, for: .normal)
setImage(Images.addaddress24Submit300.image, for: .normal)
setImage(Images.addaddress24Submit200.image, for: .highlighted)
}
}
}
|
[
-1
] |
9e7acedcfcd2ba854172e7d951f25da2bbf670fa
|
249a530d82daab24499f5a580c61e3212822b9a7
|
/MVVMDemo/AppDelegate.swift
|
7abf4edecf6206e3adfd9c76a06ceff5b243d50d
|
[] |
no_license
|
ShitalTJadhav/MVVM
|
c88829f4eb271206132ed4cfb212afb2f1a4314a
|
ac88be93972647b41524cb18da78a99c717de04b
|
refs/heads/master
| 2020-04-15T22:31:01.094107 | 2019-01-10T14:35:45 | 2019-01-10T14:35:45 | 165,075,412 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 2,182 |
swift
|
//
// AppDelegate.swift
// MVVMDemo
//
// Created by Tushar Jadhav on 2019-01-09.
// Copyright © 2019 Shital Jadhav. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
|
[
229380,
229383,
229385,
278539,
294924,
229388,
278542,
229391,
327695,
229394,
278548,
229397,
229399,
229402,
352284,
229405,
278556,
278559,
229408,
278564,
294950,
229415,
229417,
327722,
237613,
229422,
229426,
237618,
229428,
311349,
286774,
286776,
319544,
286778,
229432,
204856,
286791,
237640,
286797,
278605,
311375,
163920,
237646,
196692,
319573,
311383,
278623,
278626,
319590,
311400,
278635,
303212,
278639,
131192,
278648,
237693,
303230,
327814,
303241,
131209,
417930,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
131264,
286916,
295110,
286922,
286924,
286926,
319694,
286928,
131281,
278743,
278747,
295133,
155872,
319716,
237807,
303345,
286962,
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,
213902,
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,
214294,
304416,
230689,
173350,
312622,
296243,
312630,
222522,
296253,
222525,
296255,
312639,
230718,
296259,
378181,
296262,
230727,
238919,
296264,
320840,
296267,
296271,
222545,
230739,
312663,
222556,
337244,
230752,
312676,
230760,
173418,
148843,
410987,
230763,
230768,
296305,
312692,
230773,
304505,
304506,
279929,
181626,
181631,
148865,
312711,
312712,
296331,
288140,
288144,
230800,
304533,
337306,
288154,
288160,
173472,
288162,
288164,
279975,
304555,
370092,
279983,
173488,
288176,
279985,
312755,
296373,
312759,
279991,
288185,
337335,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
288210,
370130,
288212,
222676,
148946,
288214,
239064,
288217,
329177,
280027,
288220,
288218,
239070,
288224,
280034,
288226,
280036,
288229,
280038,
288230,
288232,
370146,
288234,
320998,
288236,
288238,
288240,
288242,
296435,
288244,
288250,
296446,
321022,
402942,
148990,
296450,
206336,
230916,
230919,
214535,
230923,
304651,
304653,
370187,
230940,
222752,
108066,
296486,
296488,
157229,
239152,
230961,
157236,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
288344,
280152,
239194,
280158,
403039,
370272,
181854,
239202,
312938,
280183,
280185,
280188,
280191,
116354,
280194,
280208,
280211,
288408,
280218,
280222,
190118,
198310,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
313027,
280260,
206536,
280264,
206539,
206541,
206543,
313044,
280276,
321239,
280283,
313052,
18140,
288478,
313055,
321252,
313066,
288494,
280302,
280304,
313073,
321266,
288499,
419570,
288502,
280314,
288510,
124671,
67330,
280324,
198405,
288519,
280331,
198416,
280337,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
296767,
288576,
345921,
280388,
337732,
304968,
280393,
280402,
173907,
313171,
313176,
42842,
280419,
321381,
296809,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280464,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
280487,
313258,
321458,
296883,
124853,
214966,
296890,
10170,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
239586,
313320,
231404,
124913,
165876,
321528,
239612,
313340,
288764,
239617,
313347,
288773,
313358,
305176,
321560,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
378941,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
149599,
280671,
149601,
321634,
149603,
223327,
329830,
280681,
313451,
223341,
280687,
149618,
215154,
313458,
280691,
313464,
329850,
321659,
280702,
288895,
321670,
215175,
141446,
141455,
141459,
280725,
313498,
100520,
288936,
280747,
288940,
288947,
280755,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
313548,
321740,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
157930,
280811,
280817,
125171,
157940,
280819,
182517,
280823,
280825,
280827,
280830,
280831,
280833,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
280888,
305464,
280891,
289087,
280897,
280900,
305480,
239944,
280906,
239947,
305485,
305489,
379218,
280919,
354653,
354656,
313700,
280937,
313705,
190832,
280946,
223606,
313720,
280956,
239997,
280959,
313731,
199051,
240011,
289166,
240017,
297363,
190868,
240021,
297365,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
289210,
305594,
281024,
289218,
289221,
289227,
281045,
281047,
215526,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
240132,
281095,
223752,
150025,
338440,
330244,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
281135,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
281179,
338528,
338532,
281190,
199273,
281196,
19053,
158317,
313973,
297594,
281210,
158347,
182926,
133776,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
199364,
297671,
158409,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322314,
322318,
281361,
281372,
322341,
215850,
281388,
289593,
281401,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
281442,
174955,
224110,
207733,
207737,
158596,
183172,
240519,
322440,
314249,
338823,
183184,
142226,
289687,
240535,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
281567,
289762,
322534,
297961,
183277,
281581,
322550,
134142,
322563,
314372,
330764,
175134,
322599,
322610,
314421,
281654,
314427,
314433,
207937,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
289912,
248995,
306341,
306344,
306347,
322734,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
126190,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
257334,
216376,
380226,
298306,
224584,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
290171,
314747,
306555,
290174,
298365,
224641,
281987,
298372,
314756,
281990,
224647,
265604,
298377,
314763,
142733,
298381,
314768,
224657,
306581,
314773,
314779,
314785,
314793,
282025,
282027,
241068,
241070,
241072,
282034,
241077,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
290291,
282101,
241142,
191992,
290298,
151036,
290302,
282111,
290305,
175621,
306694,
192008,
323084,
257550,
282127,
290321,
282130,
323090,
290325,
282133,
241175,
290328,
282137,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
282186,
224849,
282195,
282199,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
324757,
282261,
175770,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
306856,
196133,
282295,
282300,
323260,
323266,
282310,
323273,
282319,
306897,
241362,
306904,
282328,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
241450,
282410,
306988,
306991,
315184,
323376,
315190,
241464,
159545,
282425,
298811,
118593,
307009,
413506,
307012,
241475,
315211,
282446,
307027,
315221,
323414,
315223,
241496,
241498,
307035,
307040,
110433,
282465,
241509,
110438,
298860,
110445,
282478,
315249,
110450,
315251,
282481,
315253,
315255,
339838,
315267,
282499,
315269,
241544,
282505,
241546,
241548,
298896,
298898,
282514,
241556,
44948,
298901,
241560,
282520,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
36779,
241581,
282542,
241583,
323504,
241586,
282547,
241588,
290739,
241590,
241592,
241598,
290751,
241600,
241605,
151495,
241610,
298975,
241632,
298984,
241640,
241643,
298988,
241646,
241649,
241652,
323574,
290807,
299003,
241661,
299006,
282623,
315396,
241669,
315397,
282632,
307211,
282639,
290835,
282645,
241693,
282654,
241701,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
307278,
192596,
176213,
307287,
307290,
217179,
315482,
192605,
315483,
233567,
299105,
200801,
217188,
299109,
307303,
315495,
356457,
45163,
307307,
315502,
192624,
307314,
323700,
299126,
233591,
299136,
307329,
307338,
233613,
241813,
307352,
299164,
299167,
315552,
184479,
184481,
315557,
184486,
307370,
307372,
184492,
307374,
307376,
299185,
323763,
184503,
176311,
299191,
307385,
307386,
307388,
258235,
307390,
176316,
299200,
184512,
307394,
299204,
307396,
184518,
307399,
323784,
233679,
307409,
307411,
176343,
299225,
233701,
307432,
184572,
282881,
184579,
282893,
291089,
282906,
291104,
233766,
295583,
176435,
307508,
315701,
332086,
307510,
307512,
168245,
307515,
307518,
282942,
282947,
323917,
110926,
282957,
233808,
323921,
315733,
323926,
233815,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299388,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
315801,
283033,
242075,
291226,
194654,
61855,
291231,
283042,
291238,
291241,
127403,
127405,
291247,
299440,
127407,
299444,
127413,
283062,
291254,
127417,
291260,
283069,
127421,
127424,
299457,
127429,
127431,
127434,
315856,
176592,
127440,
315860,
176597,
283095,
127447,
299481,
127449,
176605,
242143,
127455,
127457,
291299,
340454,
127463,
242152,
291305,
127466,
176620,
127469,
127474,
291314,
291317,
127480,
135672,
291323,
233979,
127485,
291330,
127490,
283142,
127494,
135689,
233994,
127497,
127500,
291341,
233998,
127506,
234003,
127509,
234006,
127511,
152087,
283161,
242202,
234010,
135707,
242206,
135710,
242208,
291361,
242220,
291378,
234038,
152118,
234041,
315961,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
291456,
135808,
373383,
299655,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
225948,
135839,
299680,
225954,
299684,
135844,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
119509,
226005,
226008,
299740,
242396,
201444,
299750,
283368,
234219,
283372,
226037,
283382,
316151,
234231,
234236,
226045,
242431,
234239,
209665,
234242,
299778,
242436,
226053,
234246,
226056,
234248,
291593,
242443,
234252,
242445,
234254,
291601,
234258,
242450,
242452,
234261,
348950,
201496,
234264,
234266,
234269,
283421,
234272,
234274,
152355,
299814,
234278,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
160572,
283452,
234302,
234307,
242499,
234309,
292433,
316233,
234313,
316235,
234316,
283468,
234319,
242511,
234321,
234324,
185173,
201557,
234329,
234333,
308063,
234336,
242530,
349027,
234338,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
226171,
291711,
234368,
291714,
234370,
291716,
234373,
201603,
226182,
234375,
308105,
226185,
234379,
324490,
234384,
234388,
234390,
324504,
234393,
209818,
308123,
324508,
234396,
291742,
226200,
234398,
234401,
291747,
291748,
234405,
291750,
234407,
324520,
324518,
324522,
234410,
291756,
226220,
291754,
324527,
291760,
234417,
201650,
324531,
234414,
234422,
226230,
275384,
324536,
234428,
291773,
242623,
324544,
234431,
234434,
324546,
324548,
226245,
234437,
234439,
226239,
234443,
291788,
234446,
275406,
193486,
234449,
316370,
193488,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234475,
234478,
316400,
234481,
316403,
234484,
234485,
234487,
324599,
234490,
234493,
316416,
234496,
308226,
234501,
275462,
308231,
234504,
234507,
234510,
234515,
300054,
316439,
234520,
234519,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
144430,
234543,
234546,
275508,
300085,
234549,
300088,
234553,
234556,
234558,
316479,
234561,
316483,
160835,
234563,
308291,
234568,
234570,
316491,
234572,
300108,
234574,
300115,
234580,
234581,
242777,
234585,
275545,
234590,
234593,
234595,
234597,
300133,
234601,
300139,
234605,
160879,
234607,
275569,
234610,
316530,
300148,
234614,
398455,
144506,
234618,
234620,
275579,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
308373,
226453,
234647,
275606,
275608,
234650,
308379,
234648,
300189,
324766,
119967,
234653,
324768,
283805,
234657,
242852,
300197,
234661,
283813,
234664,
275626,
234667,
316596,
308414,
234687,
300223,
300226,
308418,
234692,
300229,
308420,
308422,
226500,
283844,
300234,
283850,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
300267,
161003,
300270,
300272,
120053,
300278,
275703,
316663,
300284,
275710,
300287,
292097,
300289,
161027,
300292,
300294,
275719,
234760,
177419,
300299,
242957,
300301,
283917,
177424,
275725,
349464,
283939,
259367,
292143,
283951,
300344,
226617,
243003,
283963,
226628,
300357,
283973,
177482,
283983,
316758,
357722,
316766,
292192,
316768,
218464,
292197,
316774,
243046,
218473,
284010,
136562,
324978,
275834,
333178,
275836,
275840,
316803,
316806,
226696,
316811,
226699,
316814,
226703,
300433,
234899,
300436,
226709,
357783,
316824,
316826,
144796,
300448,
144807,
144810,
144812,
284076,
144814,
144820,
374196,
284084,
292279,
284087,
144826,
144828,
144830,
144832,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
226787,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
292338,
226802,
227440,
316917,
308727,
292343,
300537,
316933,
316947,
308757,
308762,
284191,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
194101,
284213,
316983,
194103,
284215,
308790,
284218,
226877,
292414,
284223,
284226,
284228,
292421,
226886,
284231,
128584,
243268,
284234,
276043,
317004,
366155,
284238,
226895,
284241,
194130,
284243,
300628,
284245,
276053,
284247,
317015,
284249,
243290,
284251,
276052,
284253,
300638,
284255,
235097,
243293,
284258,
292452,
292454,
284263,
177766,
284265,
292458,
284267,
292461,
284272,
284274,
284278,
292470,
276086,
292473,
284283,
276093,
284286,
292479,
284288,
292481,
284290,
325250,
284292,
292485,
325251,
276095,
276098,
284297,
317066,
284299,
317068,
284301,
276109,
284303,
284306,
276114,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
284329,
317098,
284331,
276137,
284333,
284335,
276144,
284337,
284339,
300726,
284343,
284346,
284350,
276160,
358080,
284354,
358083,
284358,
276166,
358089,
284362,
276170,
284365,
276175,
284368,
276177,
284370,
358098,
284372,
317138,
284377,
276187,
284379,
284381,
284384,
358114,
284386,
358116,
276197,
317158,
358119,
284392,
325353,
358122,
284394,
284397,
358126,
284399,
358128,
276206,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
300819,
317207,
284440,
300828,
300830,
276255,
300832,
325408,
300834,
317221,
227109,
358183,
186151,
276268,
300845,
243504,
300850,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
300872,
292681,
153417,
358224,
284499,
276308,
284502,
317271,
178006,
276315,
292700,
317279,
284511,
227175,
292715,
300912,
292721,
284529,
300915,
284533,
292729,
317306,
284540,
292734,
325512,
169868,
276365,
317332,
358292,
284564,
284566,
350106,
284572,
276386,
284579,
276388,
358312,
317353,
284585,
276395,
292776,
292784,
276402,
358326,
161718,
358330,
276410,
276411,
276418,
276425,
301009,
301011,
301013,
292823,
358360,
301017,
301015,
292828,
276446,
153568,
276448,
276452,
292839,
276455,
292843,
276460,
292845,
276464,
178161,
227314,
276466,
325624,
276472,
317435,
276476,
276479,
276482,
276485,
317446,
276490,
292876,
317456,
276496,
317458,
178195,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
276528,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
276544,
284739,
325700,
243779,
292934,
243785,
276553,
350293,
350295,
309337,
194649,
227418,
350299,
350302,
227423,
350304,
178273,
309346,
194657,
194660,
350308,
309350,
309348,
292968,
309352,
227426,
276579,
227430,
276583,
309354,
301167,
276590,
350321,
350313,
350316,
284786,
350325,
252022,
276595,
350328,
292985,
301178,
350332,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
194708,
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,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
137946,
113378,
203491,
228069,
277223,
342760,
285417,
56041,
56043,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
228113,
285459,
277273,
293659,
326430,
228128,
285474,
293666,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
285494,
301880,
285499,
301884,
310080,
293696,
277317,
277322,
277329,
162643,
310100,
301911,
301913,
277337,
301921,
400236,
236397,
162671,
326514,
310134,
236408,
15224,
277368,
416639,
416640,
113538,
310147,
416648,
39817,
187274,
277385,
301972,
424853,
277405,
277411,
310179,
293798,
293802,
236460,
277426,
293811,
293817,
293820,
203715,
326603,
276586,
293849,
293861,
228327,
228328,
318442,
228330,
228332,
326638,
277486,
318450,
293876,
293877,
285686,
302073,
121850,
293882,
302075,
285690,
244731,
293887,
277504,
277507,
277511,
293899,
277519,
293908,
302105,
293917,
293939,
318516,
277561,
277564,
310336,
7232,
293956,
277573,
228422,
293960,
310344,
277577,
277583,
203857,
293971,
310355,
310359,
236632,
277594,
138332,
277598,
203872,
277601,
285792,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
367737,
285817,
302205,
285821,
392326,
285831,
253064,
294026,
302218,
285835,
162964,
384148,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
302241,
285862,
277671,
302248,
64682,
277678,
294063,
294065,
302258,
277687,
294072,
318651,
294076,
277695,
318657,
244930,
302275,
130244,
302277,
228550,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
310486,
302296,
384222,
310498,
285927,
318698,
302315,
195822,
228592,
294132,
138485,
228601,
204026,
228606,
204031,
64768,
310531,
285958,
138505,
228617,
318742,
204067,
277798,
130345,
277801,
113964,
285997,
277804,
285999,
277807,
113969,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
417086,
277822,
286016,
302403,
294211,
384328,
277832,
277836,
294221,
294223,
326991,
277839,
277842,
277847,
277850,
179547,
277853,
146784,
277857,
302436,
277860,
294246,
327015,
310632,
327017,
351594,
277864,
277869,
277872,
351607,
310648,
277880,
310651,
277884,
277888,
310657,
351619,
294276,
310659,
327046,
277892,
253320,
310665,
318858,
277894,
277898,
277903,
310672,
351633,
277905,
277908,
277917,
310689,
277921,
130468,
228776,
277928,
277932,
310703,
277937,
310710,
130486,
310712,
277944,
310715,
277947,
302526,
228799,
277950,
277953,
302534,
310727,
64966,
245191,
163272,
277959,
277963,
302541,
277966,
302543,
310737,
277971,
228825,
163290,
277978,
310749,
277981,
277984,
310755,
277989,
277991,
187880,
277995,
310764,
286188,
278000,
228851,
310772,
278003,
278006,
40440,
212472,
278009,
40443,
286203,
310780,
40448,
228864,
286214,
228871,
302603,
65038,
302614,
286233,
302617,
302621,
286240,
146977,
187939,
40484,
294435,
40486,
286246,
294440,
40488,
294439,
294443,
40491,
294445,
278057,
310831,
245288,
286248,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
327240,
40521,
286283,
40525,
40527,
212560,
400976,
228944,
40533,
147032,
40537,
40539,
40541,
278109,
40544,
40548,
40550,
40552,
286313,
40554,
286312,
310892,
40557,
40560,
188022,
122488,
294521,
343679,
294537,
310925,
286354,
278163,
302740,
122517,
278168,
179870,
327333,
229030,
212648,
278188,
302764,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
294601,
302793,
343757,
212690,
319187,
278227,
286420,
229076,
286425,
319194,
278235,
301163,
278238,
229086,
286432,
294625,
294634,
302838,
319226,
286460,
278274,
302852,
278277,
302854,
294664,
311048,
352008,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
278320,
319280,
319290,
229192,
302925,
188247,
280021,
188252,
237409,
229233,
294776,
360317,
294785,
327554,
40840,
40851,
294803,
188312,
294811,
237470,
319390,
40865,
319394,
294817,
294821,
311209,
180142,
343983,
294831,
188340,
40886,
319419,
294844,
294847,
393177,
294876,
294879,
294883,
294890,
311279,
278513,
237555,
278516,
311283,
278519,
237562
] |
e9d3bca8f3eb3b00380ef7a0f0952d6ef1fe76ef
|
b76e72bd5ca6ec8974f2daa1ac990e338c4979ce
|
/ios/ViteWallet/ProjectViteWallet/ViteWallet/CoreLayer/NetworkService/Utils/DataParser.swift
|
7c6f9958537527360a9f8a6cf07a42892ae838a4
|
[
"Apache-2.0"
] |
permissive
|
FarFlare/vite-wallet
|
afa9caec4345f290e85847f9ef13cabc87ab2f68
|
4eb724a3dd3fe4fcf6a47dfc2b9fd224b74cc7b5
|
refs/heads/main
| 2023-07-01T00:19:23.157621 | 2021-07-08T00:14:14 | 2021-07-08T00:14:14 | 382,427,125 | 1 | 1 | null | 2021-07-08T00:14:15 | 2021-07-02T18:07:32 |
Python
|
UTF-8
|
Swift
| false | false | 1,081 |
swift
|
//
// DataParser.swift
// ClubhouseAvatarMaker
//
// Created by Anton Tekutov on 07.07.21.
//
import Foundation
class DataParser {
static func parse<T: Codable>(data: Data) -> T? {
do {
let parcedData = try JSONDecoder().decode(T.self, from: data)
return (parcedData)
} catch DecodingError.dataCorrupted(let context) {
print(context)
} catch DecodingError.keyNotFound(let key, let context) {
print("Key '\(key)' not found:", context.debugDescription)
print("codingPath:", context.codingPath)
} catch DecodingError.valueNotFound(let value, let context) {
print("Value '\(value)' not found:", context.debugDescription)
print("codingPath:", context.codingPath)
} catch DecodingError.typeMismatch(let type, let context) {
print("Type '\(type)' mismatch:", context.debugDescription)
print("codingPath:", context.codingPath)
} catch {
print("error: ", error)
}
return nil
}
}
|
[
-1
] |
9143bba61228bbc1fd660505fe9961584d95fd7f
|
1206103e8be4b2a7f3664853a7adf91394e81242
|
/FinanceStackApp/Networking/ApiConstants.swift
|
644532b411dd9d2dd35691304e25a732eaed7940
|
[] |
no_license
|
rahulnarang021/FinanceStackApp
|
f79268a5665d04a6f3821b19a82eb2b407a7f9ce
|
5d69f8a7dad0455598e863b40276d19aecdcfc51
|
refs/heads/main
| 2023-04-28T19:11:23.920774 | 2021-05-17T03:41:46 | 2021-05-17T03:41:46 | 367,713,214 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 387 |
swift
|
//
// APIConstants.swift
// FinanceStackAppTests
//
// Created by RN on 15/05/21.
//
import Foundation
public enum ApiConstants {
public static let contentType: String = "Content-Type"
public static let accept: String = "Accept"
public static let applicationJson: String = "application/json"
public static let parsingError: String = "Unable to parse the response"
}
|
[
-1
] |
d78270f3fa0eabe726572992877461d711c454ca
|
cc8e39fe3700ddfcfaee45aa62463754ba9f6e6c
|
/PinterestSwift-master/PinterestSwift/NTHorizontalPageViewCell.swift
|
b8b9ae0b15852461530d3310d299ec1831b6b0a9
|
[
"MIT"
] |
permissive
|
hidekiohnuma/test
|
70f13589c4931c1d85b2a7f0bceda99a24e8d296
|
50d3a3c41c8513df8dc23c0598a43536ad181518
|
refs/heads/master
| 2021-01-18T22:34:10.486408 | 2015-04-24T08:16:09 | 2015-04-24T08:16:09 | 14,676,200 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 3,277 |
swift
|
//
// NTHorizontalPageViewCell.swift
// PinterestSwift
//
// Created by Nicholas Tau on 7/1/14.
// Copyright (c) 2014 Nicholas Tau. All rights reserved.
//
import Foundation
import UIKit
let cellIdentify = "cellIdentify"
class NTTableViewCell : UITableViewCell{
override init(style: UITableViewCellStyle, reuseIdentifier: String!) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
self.textLabel?.font = UIFont.systemFontOfSize(13)
}
required init(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func layoutSubviews() {
super.layoutSubviews()
let imageView :UIImageView = self.imageView!;
imageView.frame = CGRectZero
if (imageView.image != nil) {
let imageHeight = imageView.image!.size.height*screenWidth/imageView.image!.size.width
imageView.frame = CGRectMake(0, 0, screenWidth, imageHeight)
}
}
}
class NTHorizontalPageViewCell : UICollectionViewCell, UITableViewDelegate, UITableViewDataSource{
var imageName : String?
var pullAction : ((offset : CGPoint) -> Void)?
var tappedAction : (() -> Void)?
let tableView = UITableView(frame: screenBounds, style: UITableViewStyle.Plain)
override init(frame: CGRect) {
super.init(frame: frame)
backgroundColor = UIColor.lightGrayColor()
contentView.addSubview(tableView)
tableView.registerClass(NTTableViewCell.self, forCellReuseIdentifier: cellIdentify)
tableView.delegate = self
tableView.dataSource = self
}
required init(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func layoutSubviews() {
super.layoutSubviews()
tableView.reloadData()
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 10
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
{
let cell = tableView.dequeueReusableCellWithIdentifier(cellIdentify) as NTTableViewCell!
cell.imageView?.image = nil
cell.textLabel?.text = nil
if indexPath.row == 0 {
let image = UIImage(named: imageName!)
cell.imageView?.image = image
}else{
cell.textLabel?.text = "try pull to pop view controller 😃"
}
cell.setNeedsLayout()
return cell
}
func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat{
var cellHeight : CGFloat = navigationHeight
if indexPath.row == 0{
let image:UIImage! = UIImage(named: imageName!)
let imageHeight = image.size.height*screenWidth/image.size.width
cellHeight = imageHeight
}
return cellHeight
}
func tableView(tableView: UITableView!, didSelectRowAtIndexPath indexPath: NSIndexPath!){
tappedAction?()
}
func scrollViewWillBeginDecelerating(scrollView : UIScrollView){
if scrollView.contentOffset.y < navigationHeight{
pullAction?(offset: scrollView.contentOffset)
}
}
}
|
[
-1
] |
256a7512ca87bdd831f0a75d49422b6532dc5df3
|
ee2432a799fb339736b431e4931db8871e1ddf9f
|
/autodoorctrl/Shared/Haptic.swift
|
98c9e2518acedf72916e9c0818cbda1b5846d515
|
[
"MIT"
] |
permissive
|
AutomaticDoorControl/AutoDoorCtrl-iOS
|
37c2d6e3a8b780b3a93e2e40cdf821a9e8fe545d
|
156b5a806620bf5f2dff513ddecf260af1e902e7
|
refs/heads/master
| 2021-07-25T08:50:31.219404 | 2020-04-28T22:28:26 | 2020-04-28T22:28:26 | 147,875,574 | 2 | 1 |
MIT
| 2020-04-28T22:28:27 | 2018-09-07T21:16:33 |
Swift
|
UTF-8
|
Swift
| false | false | 636 |
swift
|
//
// Haptic.swift
// autodoorctrl
//
// Created by Jing Wei Li on 2/12/19.
// Copyright © 2019 Jing Wei Li. All rights reserved.
//
import Foundation
import UIKit
class Haptic {
static let current = Haptic()
private let lightHaptic: UISelectionFeedbackGenerator
private let hardHaptic: UIImpactFeedbackGenerator
init() {
lightHaptic = UISelectionFeedbackGenerator()
hardHaptic = UIImpactFeedbackGenerator(style: .medium)
}
func generateLightHaptic() {
lightHaptic.selectionChanged()
}
func generateHardHaptic() {
hardHaptic.impactOccurred()
}
}
|
[
-1
] |
c3bd214bba3a32c3bbd27364b0059d6c7e79ab30
|
c72e8338da6bdcd735de7dc0d50f1fc6517e9491
|
/ClassesAndStructs/Shape.swift
|
f33240a889c788185678b96ed3fe723733cf0927
|
[] |
no_license
|
bpascazio/ClassesAndStructs
|
dc0a470602a1c19a21f7fc53759923d562b8bc26
|
b9d0eb4d8ff12d274fcf95850ddb590f686b704e
|
refs/heads/master
| 2021-01-18T23:51:36.284157 | 2015-12-03T02:29:26 | 2015-12-03T02:29:26 | 47,302,058 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 2,013 |
swift
|
//
// Shape.swift
// ClassesAndStructs
//
// Created by Bob Pascazio on 12/2/15.
// Copyright © 2015 NYCDA. All rights reserved.
//
import UIKit
class Shape: UIView {
var small = false
var medium = false
var large = false
override init(frame: CGRect) {
super.init(frame: frame)
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func recalculateFrame() {
let currentFrame = frame
if small {
print("small")
} else if medium {
let newFrame = CGRect(x: currentFrame.origin.x, y: currentFrame.origin.y, width: currentFrame.width*2, height: currentFrame.height*2)
self.frame = newFrame
print("medium")
} else if large {
let newFrame = CGRect(x: currentFrame.origin.x, y: currentFrame.origin.y, width: currentFrame.width*4, height: currentFrame.height*4)
self.frame = newFrame
print("large")
}
}
func makeMedium() {
medium = true
recalculateFrame()
}
func makeLarge() {
large = true
recalculateFrame()
}
func centerIn(frameToCenterIn:CGRect) {
// do something here
let xv = frameToCenterIn.width / 2 - self.frame.width/2
let yv = frameToCenterIn.height / 2 - self.frame.height/2
let widthv = self.frame.width
let heightv = self.frame.height
let newFrame = CGRect(x: xv, y: yv, width: widthv, height: heightv)
self.frame = newFrame
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
override func drawRect(rect: CGRect) {
// Drawing code
}
*/
}
|
[
-1
] |
5173e2a4024d92dd426bdb8b426e9b22fb25c230
|
393af01a4036ce4b0871ac98a4aa6a5b2be0758c
|
/Color Magic/ColorPickerVC.swift
|
56b992299d3a0f1656ae2352c18a32461dfb34f5
|
[] |
no_license
|
onecause30/color-Magic
|
bbdead1c50438d0ddb3a002e72303b605a801765
|
f3c333c47813b8682e6857056e5524efb4c82582
|
refs/heads/master
| 2020-03-26T07:47:35.038939 | 2018-08-15T05:26:49 | 2018-08-15T05:26:49 | 144,671,037 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 642 |
swift
|
//
// ColorPickerVC.swift
// Color Magic
//
// Created by Anthony Hall on 8/13/18.
// Copyright © 2018 Anthony Hall. All rights reserved.
//
import UIKit
class ColorPickerVC: UIViewController {
var delegate: ColorTransferDelegate? = nil
override func viewDidLoad() {
super.viewDidLoad()
}
@IBAction func colorBtnWasPresses(sender: UIButton) {
print(sender.titleLabel?.text!)
delegate?.userDidChoose(color: sender.backgroundColor!, withName: (sender.titleLabel?.text!)!)
self.navigationController?.popViewController(animated: true)
}
}
|
[
-1
] |
f76f75bd39b58bc97390cffadc7104ca280dce80
|
45bab3616ae927a7bd5548e66fc0b718b21ad491
|
/高仿斗鱼TV/高仿斗鱼TV/Classes/Main/MainViewController.swift
|
27e6e4f9a0410cfe25776d267bb5ee9900cfa129
|
[] |
no_license
|
shiyonghui/DouYuTV
|
f6801a088552b89fae363884724087bf78ca866c
|
9cda8360f6c65bbc6b435867c7cfc944f9a87891
|
refs/heads/master
| 2020-06-13T11:18:05.261337 | 2017-01-02T12:42:29 | 2017-01-02T12:42:29 | 75,386,885 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 759 |
swift
|
//
// MainViewController.swift
// 高仿斗鱼TV
//
// Created by 施永辉 on 16/12/3.
// Copyright © 2016年 style_施. All rights reserved.
//
import UIKit
class MainViewController: UITabBarController {
override func viewDidLoad() {
super.viewDidLoad()
addChildVc(storyName: "Home")
addChildVc(storyName: "Live")
addChildVc(storyName: "Follow")
addChildVc(storyName: "Profile")
}
//连接StoryBoard
private func addChildVc(storyName: String) {
//1.通过storyboard获取控制器
let childVc = UIStoryboard(name: storyName, bundle: nil).instantiateInitialViewController()
//2.将childVc作为子控制器
addChildViewController(childVc!)
}
}
|
[
-1
] |
f6a6df3231389fd97ca1d5fcd4d14375e9a9930a
|
6212cdeb927de3db5a930d1bc4900a9db56ea563
|
/Therapy/Wish places/View/WishPlace.swift
|
de15767e41709b0da194b439435899f6a2a6a8b2
|
[] |
no_license
|
ivansway/Therapy
|
51ed336dbb50ea6f41481e7733b9ad22f4da7be8
|
09bad35978908a19a4e45ada923582461ae25a32
|
refs/heads/master
| 2022-11-27T05:12:47.624111 | 2020-08-10T13:38:18 | 2020-08-10T13:38:18 | 272,282,258 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 156 |
swift
|
//
// WishPlace.swift
// Therapy
//
// Created by Ivan Myrza on 24/07/2020.
// Copyright © 2020 Ivan Myrza. All rights reserved.
//
import Foundation
|
[
-1
] |
55df92d073a2184ad4c612c0bb19723c597d38d1
|
6b63014c21d47a296675e81ffc517025257868c9
|
/CollectionView/Protocols.swift
|
97d4e1e954b036705ece7f933104071bb12ec4f3
|
[
"MIT"
] |
permissive
|
xjbeta/CollectionView
|
9a4b8b2958ab6c216e0b6335a3a06ceaa2e667ba
|
6c442c23e63f6fd4c4febf88450c1ea39fb9f7dc
|
refs/heads/master
| 2020-03-31T13:26:30.109806 | 2018-09-27T23:19:37 | 2018-09-27T23:19:37 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 25,709 |
swift
|
//
// Protocols.swift
// CollectionView
//
// Created by Wesley Byrne on 9/1/16.
// Copyright © 2016 Noun Project. All rights reserved.
//
import Foundation
/**
The CollectionViewDataSource is responsible for providing the data and views required by a collection view
# Overview
At a minimum, all data source objects must implement:
- `numberOfSections(in:)`
- `collectionView(_:numberOfItemsInSection:)`
- `collectionView(_:cellForItemAt:)`.
These methods are responsible for returning the number of items in the collection view along with the items themselves.
*/
@objc public protocol CollectionViewDataSource {
// MARK: - Getting Item and Section Metrics
/*-------------------------------------------------------------------------------*/
/**
Asks your data source for the number of sections in the collectin view
- Parameter collectionView: The collection view requesting this information.
- Returns: The number of sections in collectionView.
*/
func numberOfSections(in collectionView: CollectionView) -> Int
/**
Asks your data source object for the number of items in the specified section.
- Parameter collectionView: The collection view requesting this information.
- Parameter section: An index number identifying a section in collectionView. This index value is 0-based.
- Returns: The number of items in the specified section
*/
func collectionView(_ collectionView: CollectionView, numberOfItemsInSection section: Int) -> Int
// MARK: - Getting Views for Items
/*-------------------------------------------------------------------------------*/
/**
Asks your data source object for the cell that corresponds to the specified item in the collection view.
- Parameter collectionView: The collection view requesting this information.
- Parameter indexPath: The index path that specifies the location of the item.
- Returns: A configured cell object. You must not return nil from this method.
# Discussion
Your implementation of this method is responsible for creating, configuring, and returning the appropriate cell for the given item. You do this by calling the `dequeueReusableCell(withReuseIdentifier:for:)` method of the collection view and passing the reuse identifier that corresponds to the cell type you want. That method always returns a valid cell object. Upon receiving the cell, you should set any properties that correspond to the data of the corresponding item, perform any additional needed configuration, and return the cell.
You do not need to set the location of the cell inside the collection view’s bounds. The collection view sets the location of each cell automatically using the layout attributes provided by its layout object.
*/
func collectionView(_ collectionView: CollectionView, cellForItemAt indexPath: IndexPath) -> CollectionViewCell
/**
Asks your data source object to provide a supplementary view to display in the collection view.
- Parameter collectionView: The collection view requesting this information.
- Parameter kind: The kind of supplementary view to provide. The value of this string is defined by the layout object that supports the supplementary view.
- Parameter indexPath: The index path that specifies the location of the new supplementary view.
- Returns: A configured supplementary view object. You must not return nil from this method.
# Discussion
Your implementation of this method is responsible for creating, configuring, and returning the appropriate supplementary view that is being requested. You do this by calling the `dequeueReusableSupplementaryView(ofKind:withReuseIdentifier:for:)` method of the collection view and passing the information that corresponds to the view you want. That method always returns a valid view object. Upon receiving the view, you should set any properties that correspond to the data you want to display, perform any additional needed configuration, and return the view.
You do not need to set the location of the supplementary view inside the collection view’s bounds. The collection view sets the location of each view using the layout attributes provided by its layout object.
*/
@objc optional func collectionView(_ collectionView: CollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> CollectionReusableView
// MARK: - Dragging Items
/*-------------------------------------------------------------------------------*/
/**
Asks your data source for a pasteboard writing for the item at the specified index path
- Parameter collectionView: The collection view requesting this information.
- Parameter indexPath: The index path of the item to represent with the pasteboard writer
- Returns: The pasteboard writer object to use for managing the item data. Return nil to prevent the collection view from dragging the item.
*/
@objc optional func collectionView(_ collectionView: CollectionView, pasteboardWriterForItemAt indexPath: IndexPath) -> NSPasteboardWriting?
/**
Asks the data source for the drag contents for the item at the specified index path
- Parameter collectionView: The collection view requesting this information.
- Parameter indexPath: The index path of the item to represent
- Returns: An NSImage to display when dragging the item
- Note: If nil is returned, a snapshot of the cell will be used. To disable dragging for an item return false for shouldStartDragging or remove the index path during validation
*/
@objc optional func collectionView(_ collectionView: CollectionView, dragContentsForItemAt indexPath: IndexPath) -> NSImage?
/**
Asks the data source to validate the drag rect for an item to be dragged, allowing for adjustment.
- Parameter collectionView: The collection view requesting this information.
- Parameter indexPath: The index path of the item being dragged
- Parameter rect: The current rect of the item
*/
@objc optional func collectionView(_ collectionView: CollectionView, dragRectForItemAt indexPath: IndexPath, withStartingRect rect: UnsafeMutablePointer<CGRect>)
}
/**
The CollectionViewDelegate protocol defines methods that allow you to manage the status, selection, highlighting, and scrolling of items in a collection view and to perform actions on those items. The methods of this protocol are all optional.
*/
@objc public protocol CollectionViewDelegate {
// MARK: - Reloading Data
/*-------------------------------------------------------------------------------*/
/**
Notifies the delegate that the collection view will reload it's layout
It can be assumed that the data has been reloaded
- Parameter collectionView: The collection view is reloading it's layout
- Note: Calculating layout properties that can be cached can be done here and later returned in associated the layout delegate methods.
*/
@objc optional func collectionViewWillReloadLayout(_ collectionView: CollectionView)
/**
Notifies the delegate that the collection view finished reloading it's layout
It can be assumed that the data has been reloaded and is up to date
- Parameter collectionView: The collection view
*/
@objc optional func collectionViewDidReloadLayout(_ collectionView: CollectionView)
// MARK: - First Responder
/*-------------------------------------------------------------------------------*/
/**
Notifies the delegate that the collection view has changed status as first responder
- Parameter collectionView: The collection view changing status
- Parameter firstResponder: True if the collection view is first responder
*/
@objc optional func collectionView(_ collectionView: CollectionView, didChangeFirstResponderStatus firstResponder: Bool)
// MARK: - Mouse Tracking
/*-------------------------------------------------------------------------------*/
/**
Notifies the delegate that the mouse has moved into the frame of a section.
- Parameter collectionView: The collection view notifying you of the event
- Parameter indexPath: the index path of the section
- Note: trackSectionHover must be set to true on the collection view
*/
@objc optional func collectionView(_ collectionView: CollectionView, mouseMovedToSection indexPath: IndexPath?)
/**
Notifies the delegate that the mouse was clicked down in the specified index path
- Parameter collectionView: The collection view recieving the click
- Parameter indexPath: The index path of the item at the click location, or nil
- Parameter event: The click event
*/
@objc optional func collectionView(_ collectionView: CollectionView, mouseDownInItemAt indexPath: IndexPath?, with event: NSEvent)
/**
Notifies the delegate that the mouse was released in the specified index path
- Parameter collectionView: The collection view receiving the click
- Parameter indexPath: The index path of the item at the click location, or nil
- Parameter event: The click even
*/
@objc optional func collectionView(_ collectionView: CollectionView,
mouseUpInItemAt indexPath: IndexPath?,
with event: NSEvent)
// MARK: - Highlighting
/*-------------------------------------------------------------------------------*/
/**
Asks the delegate if the item at the specified index path should highlight
- Parameter collectionView: The asking collection view
- Parameter indexPath: The index path of the item to highlight
- Returns: True if the item should highlight
*/
@objc optional func collectionView(_ collectionView: CollectionView, shouldHighlightItemAt indexPath: IndexPath) -> Bool
// MARK: - Selections
/*-------------------------------------------------------------------------------*/
// Single index path selection delegate methods are deprecated. Please use Set<IndexPath> versions.
@available(*, deprecated, message: "Please use collectionView(_:, shouldDeselectItemsAt:)")
@objc optional func collectionView(_ collectionView: CollectionView, shouldDeselectItemAt indexPath: IndexPath) -> Bool
@available(*, deprecated, message: "Please use collectionView(_:, didDeselectItemsAt:)")
@objc optional func collectionView(_ collectionView: CollectionView, didDeselectItemAt indexPath: IndexPath)
@available(*, deprecated, message: "Please use collectionView(_:, shouldSelectItemsAt:)")
@objc optional func collectionView(_ collectionView: CollectionView, shouldSelectItemAt indexPath: IndexPath, with event: NSEvent?) -> Bool
@available(*, deprecated, message: "Please use collectionView(_:, didSelectItemsAt:)")
@objc optional func collectionView(_ collectionView: CollectionView, didSelectItemAt indexPath: IndexPath)
/**
Asks the delegate to approve the pending selection of items.
- Parameter collectionView: The collection view making the request.
- Parameter indexPath: The set of NSIndexPath objects corresponding to the items selected by the user.
- Parameter event: The event that cause the selection
- Returns: The set of NSIndexPath objects corresponding to the items that you want to be selected. If you do not want any items selected, return an empty set.
Use this method to approve or modify the items that the user tries to select. During interactive selection, the collection view calls this method whenever the user selects new items. Your implementation of the method can return the proposed set of index paths as-is or modify the set before returning it. You might modify the set to disallow the selection of specific items or specific combinations of items.
If you do not implement this method, the collection view selects the items specified by the indexPaths parameter.
*/
@objc optional func collectionView(_ collectionView: CollectionView, shouldSelectItemsAt indexPaths: Set<IndexPath>) -> Set<IndexPath>
/**
Notifies the delegate object that one or more items were selected.
- Parameter collectionView: The collection view notifying you of the selection change.
- Parameter indexPath: The set of NSIndexPath objects corresponding to the items that are now selected.
After the user successfully selects one or more items, the collection view calls this method to let you know that the selection has been made. Use this method to respond to the selection change and to make any necessary adjustments to your content or the collection view.
- Note: The provided index paths do not inlcude index paths selected prior to this event.
*/
@objc optional func collectionView(_ collectionView: CollectionView, didSelectItemsAt indexPaths: Set<IndexPath>)
/**
Asks the delegate object to approve the pending deselection of items.
- Parameter collectionView: The collection view making the request.
- Parameter indexPath: The set of NSIndexPath objects corresponding to the items deselected by the user.
- Returns: The set of NSIndexPath objects corresponding to the items that you want to be selected. If you do not want any items selected return an empty set.
Use this method to approve or modify the items that the user tries to deselect. During interactive selection, the collection view calls this method whenever the user deselects items. Your implementation of the method can return the proposed set of index paths as-is or modify the set before returning it. You might modify the set to disallow the deselection of specific items.
*/
@objc optional func collectionView(_ collectionView: CollectionView, shouldDeselectItemsAt indexPaths: Set<IndexPath>) -> Set<IndexPath>
/**
Notifies the delegate object that one or more items were deselected.
- Parameter collectionView: The collection view notifying you of the selection change.
- Parameter indexPath: The set of NSIndexPath objects corresponding to the items that were deselected.
After the user successfully deselects one or more items, the collection view calls this method to let you know that the items are no longer selected. Use this method to respond to the selection change and to make any necessary adjustments to your content or the collection view.
*/
@objc optional func collectionView(_ collectionView: CollectionView, didDeselectItemsAt indexPaths: Set<IndexPath>)
/**
Not implemented
- Parameter collectionView: <#collectionView description#>
- Parameter pressure: <#pressure description#>
- Parameter indexPath: <#indexPath description#>
*/
@available(*, unavailable, message: "Trackpad pressure is not yet implemented")
@objc optional func collectionView(_ collectionView: CollectionView, didChangePressure pressure: CGFloat, forItemAt indexPath: IndexPath)
/**
Notifies the delegate that an item was double clicked
- Parameter collectionView: The collection view containing the clicked item
- Parameter indexPath: The index path of the clicked item
- Parameter event: The click event that double clicked the item
*/
@objc optional func collectionView(_ collectionView: CollectionView, didDoubleClickItemAt indexPath: IndexPath?, with event: NSEvent)
/**
Notifies the delegate that an item was right clicked
- Parameter collectionView: The collection view containing the clicked item
- Parameter indexPath: The index path of the clicked item
- Parameter event: The click event
*/
@objc optional func collectionView(_ collectionView: CollectionView, didRightClickItemAt indexPath: IndexPath?, with event: NSEvent)
// MARK: - View Display
/*-------------------------------------------------------------------------------*/
@objc optional func collectionView(_ collectionView: CollectionView, willDisplayCell cell: CollectionViewCell, forItemAt indexPath: IndexPath)
/**
Notifies the delegate that a supplementary view will bw displayed
- Parameter collectionView: The collection view containing the supplementary view
- Parameter elementKind: The element kind of the view
- Parameter indexPath: The index path of the view
*/
@objc optional func collectionView(_ collectionView: CollectionView, willDisplaySupplementaryView view: CollectionReusableView, ofElementKind elementKind: String, at indexPath: IndexPath)
/**
Notifies the delegate that a cell was removed from view
- Parameter collectionView: The collection view containing the cell
- Parameter cell: The cell that was removed
- Parameter indexPath: The index path of the removed cell
*/
@objc optional func collectionView(_ collectionView: CollectionView, didEndDisplayingCell cell: CollectionViewCell, forItemAt indexPath: IndexPath)
/**
Notifies the delegate that a supplementary view was removed from view
- Parameter collectionView: The collection view containing the supplementary view
- Parameter view: The view that was removed
- Parameter elementKind: The kind of the removed element
- Parameter indexPath: The index path of the removed view
*/
@objc optional func collectionView(_ collectionView: CollectionView, didEndDisplayingSupplementaryView view: CollectionReusableView, ofElementKind elementKind: String, at indexPath: IndexPath)
// MARK: - Ancoring
/*-------------------------------------------------------------------------------*/
/**
Asks the delegate for an index path to anchor when resizing
- Parameter collectionView: The collection view
- Returns: The index path to anchor to when resizing
Defaults to an index path for one of the first visible items
*/
@objc optional func collectionViewLayoutAnchor(_ collectionView: CollectionView) -> IndexPath?
// MARK: - Resizing
/*-------------------------------------------------------------------------------*/
/**
Notifies the delegate that the collection view did begin resizing
- Parameter collectionView: The collection view
*/
@objc optional func collectionViewDidEndLiveResize(_ collectionView: CollectionView)
// MARK: - Scrolling
/*-------------------------------------------------------------------------------*/
/**
Asks the delegate if the collection view should scroll to an item
- Parameter collectionView: The collection view
- Parameter indexPath: The index path that may be scrolled to
- Returns: True if the collection view should perform the scroll
*/
@objc optional func collectionView(_ collectionView: CollectionView, shouldScrollToItemAt indexPath: IndexPath) -> Bool
/**
Notifies the delegate that the collection view did complete a scrolling action
- Parameter collectionView: The collection view that performed a scrolling animation
- Parameter indexPath: The index path that was scrolled to
*/
@objc optional func collectionView(_ collectionView: CollectionView, didScrollToItemAt indexPath: IndexPath)
/**
Notifies the delegate that the collection view was scrolled
- Parameter collectionView: The collection view that was scrolled
Because this is called continuously as the scroll position is changed, beware of performance.
*/
@objc optional func collectionViewDidScroll(_ collectionView: CollectionView)
/**
Notifies the delegate that the collection view will begin scrolling
- Parameter collectionView: The collection view that will begin scrolling
- Parameter aniated: If the scroll is triggered by user input, this will be false
*/
@objc optional func collectionViewWillBeginScrolling(_ collectionView: CollectionView, animated: Bool)
/**
Notifies the delegate that the collection view did end scrolling
- Parameter collectionView: The collection view that was scrolled
- Parameter animated: True if the scroll was animated (false for user driven scrolling)
*/
@objc optional func collectionViewDidEndScrolling(_ collectionView: CollectionView, animated: Bool)
}
@available(*, unavailable, renamed: "CollectionViewDragDelegate")
public protocol CollectionViewInteractionDelegate: CollectionViewDelegate { }
/**
The CollectionViewDragDelegate forwards system drag functions to the delegate in the context of a Collection View.
*/
@objc public protocol CollectionViewDragDelegate: CollectionViewDelegate {
// MARK: - Dragging Source
/*-------------------------------------------------------------------------------*/
/**
Asks the delegate if a dragging session should be started
- Parameter collectionView: The collection view
- Parameter indexPath: The indexpath at the location of the drag
- Parameter event: The mouse event
- Returns: True if a dragging session should begin
*/
@objc optional func collectionView(_ collectionView: CollectionView, shouldBeginDraggingAt indexPath: IndexPath, with event: NSEvent) -> Bool
/**
Asks the delegate to validate the selected items for drag.
- Parameter collectionView: The collection view that began the drag
- Parameter indexPaths: The selected index paths when the drag began
- Returns: The index paths that should be included in the drag.
This provides an opputunity to exclude some of the selected index paths from being dragged
*/
@objc optional func collectionView(_ collectionView: CollectionView, validateIndexPathsForDrag indexPaths: [IndexPath]) -> [IndexPath]
/**
Notifies the delegate that a dragging session will begin
- Parameter collectionView: The collection view
- Parameter session: The dragging session
- Parameter point: The location of the drag
If collectionView(:shouldBeginDraggingAt:with) returns false this will not be called
*/
@objc optional func collectionView(_ collectionView: CollectionView, draggingSession session: NSDraggingSession, willBeginAt point: NSPoint)
/**
Notifies the delegate that a dragging session ended
- Parameter collectionView: The collection view
- Parameter session: The drag session
- Parameter screenPoint: The screen point at which the drag ended
- Parameter operation: The dragging operation at the time the drag ended
*/
@objc optional func collectionView(_ collectionView: CollectionView, draggingSession session: NSDraggingSession, didEndAt screenPoint: NSPoint, with operation: NSDragOperation, draggedIndexPaths: [IndexPath])
/**
Notifies the delegate that a dragging session moved
- Parameter collectionView: The collection view
- Parameter session: The drag session
- Parameter point: The location of the drag
*/
@objc optional func collectionView(_ collectionView: CollectionView, draggingSession session: NSDraggingSession, didMoveTo point: NSPoint)
// MARK: - Dragging Destination
/*-------------------------------------------------------------------------------*/
/**
Asks the delegate for an operation for the drag at its current state when it enters the collection view
- Parameter collectionView: The collection view
- Parameter dragInfo: The drag info
- Returns: A drag operation indicating how the drag should be handled
*/
@objc optional func collectionView(_ collectionView: CollectionView, dragEntered dragInfo: NSDraggingInfo) -> NSDragOperation
/**
Asks the delegate for an operation for the drag at its current state as it updates
- Parameter collectionView: The collection view
- Parameter dragInfo: The drag info
- Returns: A drag operation indicating how the drag should be handled
*/
@objc optional func collectionView(_ collectionView: CollectionView, dragUpdated dragInfo: NSDraggingInfo) -> NSDragOperation
/**
Notifies the delegate that a drag exited the collection view as a dragging destination
- Parameter collectionView: The collection view
- Parameter dragInfo: The drag info
*/
@objc optional func collectionView(_ collectionView: CollectionView, dragExited dragInfo: NSDraggingInfo?)
/**
Notifies the delegate that a drag ended in the collection view as a dragging destination
- Parameter collectionView: The collection view
- Parameter dragInfo: The drag info
*/
@objc optional func collectionView(_ collectionView: CollectionView, dragEnded dragInfo: NSDraggingInfo?)
/**
Asks the delegate to handle the drop in the collection view
- Parameter collectionView: The collection view (dragging destination) the drag ended in
- Parameter dragInfo: The drag info
- Returns: True if the drag is completed. False to cancel the drag
*/
@objc optional func collectionView(_ collectionView: CollectionView, performDragOperation dragInfo: NSDraggingInfo) -> Bool
}
|
[
-1
] |
36faa1db485c18243e936989342aa00616b307a7
|
e0ee194f2e7df7689870bd6e39ea89a429af0148
|
/ForgotTheMilk/Models/ReminderEntry.swift
|
986fb8e7bdd13e5c472e85a54db6a703ec94b6cc
|
[] |
no_license
|
iamGus/ForgotTheMilk
|
1b26e93354fc246651a092c392ae5d6a4d641556
|
612f8869564f5f1d0e774e522895bdfbea691ed0
|
refs/heads/master
| 2021-08-24T02:33:51.964524 | 2017-12-07T17:30:41 | 2017-12-07T17:30:41 | 112,307,360 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 4,492 |
swift
|
//
// Reminder.swift
// ForgotTheMilk
//
// Created by Angus Muller on 28/11/2017.
// Copyright © 2017 Angus Muller. All rights reserved.
//
import CoreData
import UIKit
import CoreLocation
enum Recurring: Int {
case recurring
case onceonly
}
public class Reminder: NSManagedObject {
@NSManaged public var isActive: Bool
@NSManaged public var location: NSData
@NSManaged public var notes: NSString?
@NSManaged public var timeStamp: NSDate
@NSManaged public var title: NSString
@NSManaged public var placeMark: NSString
@NSManaged public var recurringAmount: Int16
@NSManaged public var notify: Int16
public override func awakeFromInsert() {
super.awakeFromInsert()
self.timeStamp = NSDate() // Set date for when entry created.
self.recurringAmount = 0
self.notify = 0
}
}
extension Reminder {
/// String name on Reminder class
static var entityName: String {
return String(describing: Reminder.self)
}
/// For section sorting, Active or past reminder heading
@objc var section: String? {
return isActive ? "Active Reminders" : "Past Reminders"
}
/// Sort all reminders by dateStamp
@nonobjc public class func fetchRequest() -> NSFetchRequest<Reminder> {
let request = NSFetchRequest<Reminder>(entityName: entityName)
let sortDescriptor = NSSortDescriptor(key: "isActive", ascending: false)
let sortDescriptor2 = NSSortDescriptor(key: "timeStamp", ascending: false)
request.sortDescriptors = [sortDescriptor, sortDescriptor2]
return request
}
/// Use this method to create a new Reminder
class func insertNewReminder(in context: NSManagedObjectContext, title: String, location: CLLocation, notes: String?, placemark: String, recurring: Recurring, notifyOn: NotifyOn) -> Reminder? {
guard let reminder = NSEntityDescription.insertNewObject(forEntityName: Reminder.entityName, into: context) as? Reminder else { return nil }
// store CLLocation
let archivedLocation = NSKeyedArchiver.archivedData(withRootObject: location)
reminder.setValue(archivedLocation, forKey: "location")
reminder.title = title as NSString
reminder.placeMark = placemark as NSString
reminder.recurringStatus = recurring
reminder.notifyOnStatus = notifyOn
if let notes = notes {
reminder.notes = notes as NSString
}
return reminder
}
class func updateReminder(currentReminder: Reminder, title: String, location: CLLocation, notes: String?, placemark: String, recurring: Recurring, notifyOn: NotifyOn) -> Reminder {
let reminder = currentReminder
reminder.title = title as NSString
reminder.placeMark = placemark as NSString
reminder.recurringStatus = recurring
reminder.notifyOnStatus = notifyOn
// store CLLocation
let archivedLocation = NSKeyedArchiver.archivedData(withRootObject: location)
reminder.setValue(archivedLocation, forKey: "location")
if let notes = notes {
reminder.notes = notes as NSString
}
return reminder
}
}
// Make swift types of managed objects
extension Reminder {
var titleString: String {
return String(title)
}
var notesString: String? {
guard let notes = notes else { return nil }
return String(notes)
}
var placeMarkString: String {
return String(placeMark)
}
var timeStampDate: Date {
return timeStamp as Date
}
/// Retrieve location
var retreiveLocation: CLLocation {
let data = NSKeyedUnarchiver.unarchiveObject(with: self.location as Data) as! CLLocation
return data
}
/// Allow Recurring enum to work with recurringAmount int property
var recurringStatus: Recurring {
get {
return Recurring(rawValue: Int(self.recurringAmount))!
}
set {
self.recurringAmount = Int16(newValue.rawValue)
}
}
/// Allow NotifyOn enum to work with notify int property
var notifyOnStatus: NotifyOn {
get {
return NotifyOn(rawValue: Int(self.notify))!
}
set {
self.notify = Int16(newValue.rawValue)
}
}
}
|
[
-1
] |
131db24cc9c3ce99d8cd5ecdd593eae4136cc40b
|
1a1883b1794cced153ff3f7653cc9c6f2eb3bacd
|
/Swift5_StressAPP/Controller/DiarDetailViewController.swift
|
345b30edf421297a4cb9856f683c23d8d4d6283d
|
[] |
no_license
|
KosekiTakashi/StressAPP
|
9a5bf3451c74aaba366e2214ae40aa8c8bc7d1e0
|
7b4c0dedb54232ffb45fc0b83a606327f1847d50
|
refs/heads/master
| 2020-08-06T05:50:16.688245 | 2020-03-26T13:08:15 | 2020-03-26T13:08:15 | 212,858,614 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 1,190 |
swift
|
//
// DiarViewController.swift
// Swift5_StressAPP
//
// Created by 小関隆司 on 2019/11/14.
// Copyright © 2019 kosekitakashi. All rights reserved.
//
import UIKit
class DiarDetailViewController: UIViewController {
@IBOutlet weak var titleLabel: UILabel!
@IBOutlet weak var stressCountLabel: UILabel!
@IBOutlet weak var listLabel: UILabel!
@IBOutlet weak var resultLabel: UILabel!
@IBOutlet weak var evaluationLabel: UILabel!
var titleName = String()
var stresscount:Int = 0
var selectedList = String()
var result = String()
var evaluation:Int = 0
var diary:Diary!{
didSet{
titleName = diary.titleName
stresscount = diary.stressCount
selectedList = diary.selectedList
result = diary.result
evaluation = diary.evaluation
}
}
override func viewDidLoad() {
super.viewDidLoad()
titleLabel.text = titleName
stressCountLabel.text = "\(stresscount)"
listLabel.text = selectedList
resultLabel.text = result
evaluationLabel.text = "\(evaluation)"
}
}
|
[
-1
] |
9e69e5701756c5f7f31333b1b8e57376ddf7ea7b
|
88056b7396ae3fa96c114d7d2cfe8a888f7126e2
|
/RibsTutorial/RibsTutorial/RIBs/LoggedOut/LoginPageRIB/LoginPageViewController.swift
|
a3bcaf938105c3ccd515d84802187dcc9c8ebc57
|
[] |
no_license
|
jun7680/RIBsTutorial
|
924ebcb9ca0911ccd906de23681cb7bc0909d3a2
|
899f143d1261427f824f2b82bc6568d138721ebb
|
refs/heads/main
| 2023-06-30T00:23:56.621345 | 2021-08-04T07:00:00 | 2021-08-04T07:00:00 | 388,351,448 | 0 | 0 | null | 2021-08-02T03:30:01 | 2021-07-22T06:23:44 |
Swift
|
UTF-8
|
Swift
| false | false | 3,805 |
swift
|
//
// LoginPageViewController.swift
// RibsTutorial
//
// Created by injun on 2021/08/02.
//
import RIBs
import RxSwift
import UIKit
import SnapKit
protocol LoginPagePresentableListener: AnyObject {
func previous()
func goToMainView()
}
final class LoginPageViewController: UIViewController, LoginPagePresentable, LoginPageViewControllable {
weak var listener: LoginPagePresentableListener?
private let disposeBag = DisposeBag()
private let idTextField = UITextField().then {
$0.keyboardType = .emailAddress
$0.borderStyle = .line
}
private let pwTextField = UITextField().then {
$0.isSecureTextEntry = true
$0.borderStyle = .line
}
private let nextButton = UIButton().then {
$0.backgroundColor = .black
$0.setTitle("로그인", for: .normal)
$0.setTitleColor(.white, for: .normal)
$0.layer.cornerRadius = 4
}
private let previousButton = UIButton().then {
$0.backgroundColor = .blue
$0.setTitle("뒤로가기", for: .normal)
$0.setTitleColor(.white, for: .normal)
$0.layer.cornerRadius = 4
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
navigationController?.isNavigationBarHidden = false
}
override func viewDidLoad() {
super.viewDidLoad()
setUI()
}
private func setUI() {
view.backgroundColor = .white
clearNavgationBarBackground()
view.addSubview(idTextField)
view.addSubview(pwTextField)
view.addSubview(nextButton)
view.addSubview(previousButton)
setConstraints()
bindUI()
}
private func setConstraints() {
let padding: CGFloat = 12
let horizontalPadding = 20
let eidtViewTopPadding = 100
let buttonTopPadding = 43
let editViewHeight = 78
let buttonHeight = 56
idTextField.snp.makeConstraints {
$0.top.equalTo(view.safeAreaLayoutGuide).offset(eidtViewTopPadding)
$0.leading.trailing.equalToSuperview().inset(horizontalPadding)
$0.height.equalTo(buttonHeight)
}
pwTextField.snp.makeConstraints {
$0.top.equalTo(idTextField.snp.bottom).offset(horizontalPadding)
$0.leading.trailing.equalToSuperview().inset(20)
$0.height.equalTo(buttonHeight)
}
nextButton.snp.makeConstraints {
$0.top.equalTo(pwTextField.snp.bottom).offset(buttonTopPadding)
$0.leading.trailing.equalToSuperview().inset(20)
$0.height.equalTo(buttonHeight)
}
previousButton.snp.makeConstraints {
$0.top.equalTo(nextButton.snp.bottom).offset(buttonTopPadding)
$0.leading.trailing.equalToSuperview().inset(20)
$0.height.equalTo(buttonHeight)
}
}
private func clearNavgationBarBackground() {
navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
navigationController?.navigationBar.shadowImage = UIImage()
navigationController?.navigationBar.backgroundColor = .clear
navigationItem.hidesBackButton = true
}
private func bindUI() {
previousButton.rx.tap
.asDriver()
.drive(with: self) { owner, _ in
print("1")
owner.listener?.previous()
}.disposed(by: disposeBag)
nextButton.rx.tap
.asDriver()
.drive(with: self) { owner, _ in
print("goto main")
owner.listener?.goToMainView()
}.disposed(by: disposeBag)
}
}
|
[
-1
] |
58321f40872fba0773389f4bda9adfddb0650d08
|
c3186da54a81663a5c69523e28ecdf71dd562606
|
/Uber/Controller/MainViewController.swift
|
d5b0920e54dd1303939110ac7ae41299bad33113
|
[] |
no_license
|
abdellatif-abaamrane/UberApp
|
9e47e891137c2c62e06513c4709b8a6497011494
|
03bd7d6a67bd7df95628f79da63c6e8e605c7a97
|
refs/heads/master
| 2023-06-10T03:11:20.661458 | 2021-07-03T19:11:03 | 2021-07-03T19:11:03 | 382,574,738 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 25,776 |
swift
|
//
// MainViewController.swift
// Uber
//
// Created by macbook-pro on 21/05/2020.
//
import UIKit
import MapKit
import CoreLocation
import Firebase
enum ButtonState {
case slide
case clear
}
protocol MainViewControllerDelegate:AnyObject {
func displayItems(items:[MKMapItem])
}
class MainViewController: UIViewController {
var monitor = NewtworkChecker.shared
var registeration : ListenerRegistration?
var tripRegisteration : ListenerRegistration?
let locationHandler = LocationHandler.shared
weak var delegate : MainViewControllerDelegate?
var topConstraint : NSLayoutConstraint!
var heightConstraintTableView : NSLayoutConstraint!
var bottomConstraintActionView : NSLayoutConstraint!
var actionView : ActionView!
var locationTableView = LocationTableView()
var inputActivationView = LocationInputActivationView(image: UIImage(named: "uber"))
var inputLocationView = LocationInputView()
lazy var trackingButton : MKUserTrackingButton = {
let mapUserTrackingButton = MKUserTrackingButton(mapView: self.mapView)
mapUserTrackingButton.tintColor = .blackUber
mapUserTrackingButton.translatesAutoresizingMaskIntoConstraints = false
return mapUserTrackingButton
}()
lazy var searchingButton : UIButton = {
let button = UIButton(type: .system)
button.tintColor = .white
button.alpha = 0
button.addTarget(self, action: #selector(handleSearchDrivers), for: .touchUpInside)
let configuration = UIImage.SymbolConfiguration(font: .systemFont(ofSize: 60))
let image = UIImage(systemName: "magnifyingglass")
image?.withConfiguration(configuration)
button.setImage(image, for: .normal)
button.backgroundColor = .blackUber
button.layer.cornerRadius = 40/2
button.translatesAutoresizingMaskIntoConstraints = false
return button
}()
lazy var slideButton : UIButton = {
let slideButton = UIButton(type: .system)
slideButton.addTarget(self, action: #selector(handleSlideButton), for: .touchUpInside)
slideButton.setImage(#imageLiteral(resourceName: "baseline_menu_black_36dp").withRenderingMode(.alwaysOriginal), for: .normal)
slideButton.translatesAutoresizingMaskIntoConstraints = false
return slideButton
}()
var slideButtonState = ButtonState.slide
var user : User! {
didSet {
guard user != nil else { return }
inputLocationView.user = user
}
}
var trip : Trip?
lazy var mapView : MKMapView = {
let map = MKMapView()
map.register(MKMarkerAnnotationView.self, forAnnotationViewWithReuseIdentifier: MKMapViewDefaultAnnotationViewReuseIdentifier)
map.translatesAutoresizingMaskIntoConstraints = false
return map
}()
override func viewDidLoad() {
super.viewDidLoad()
checkAuthenticationAndConfigueUI()
}
func setupMapView(){
locationTableView.locationDelegate = self
mapView.showsUserLocation = true
mapView.delegate = self
mapView.showsCompass = false
mapView.userTrackingMode = .followWithHeading
locationHandler.mapView = mapView
inputActivationView.inputActivationDelegate = self
inputLocationView.delegate = self
}
func checkAuthenticationAndConfigueUI() {
DispatchQueue.main.async {
if AUTH.currentUser == nil {
let rootViewController = LoginViewController()
let nav = UINavigationController(rootViewController: rootViewController)
nav.navigationBar.barStyle = .black
nav.navigationBar.isHidden = true
nav.modalPresentationStyle = .fullScreen
self.present(nav, animated: false, completion: nil)
} else {
self.fetchUser()
self.configueUI()
}
}
}
func fetchUser() {
UserService.shared.fetchUser { [weak self] result in
guard let self = self else { return }
switch result {
case .success(let user):
self.user = user
self.locationHandler.userOption = user.userOption
if user.userOption == .driver {
self.fetchTrip()
self.searchingButton.alpha = 0
self.inputActivationView.alpha = 0
} else {
UIView.animate(withDuration: 2) {
self.searchingButton.alpha = 1
self.inputActivationView.alpha = 1
}
}
case .failure(let error):
print(error.localizedDescription)
}
}
}
func fetchTrip() {
guard user.userOption == .driver else { return }
registeration = TripService.shared.observeRequestedTrip { result in
switch result {
case .success(let trip):
guard self.trip == nil else { return }
self.trip = trip
self.listenTrip(tripID: trip.tripID)
let pickupController = PickupController(trip: trip)
pickupController.modalPresentationStyle = .fullScreen
self.present(pickupController, animated: true) {
self.locationHandler.stopUpdatingLocation()
}
case .failure(let error):
print(error.localizedDescription)
}
}
}
func configueUI() {
view.addSubview(mapView)
view.addSubview(inputActivationView)
view.addSubview(locationTableView)
view.addSubview(inputLocationView)
view.addSubview(slideButton)
view.addSubview(trackingButton)
view.addSubview(searchingButton)
inputLocationView.translatesAutoresizingMaskIntoConstraints = false
topConstraint = inputLocationView.topAnchor.constraint(equalTo: view.topAnchor,constant: -300)
heightConstraintTableView = locationTableView.heightAnchor.constraint(equalToConstant: 0)
NSLayoutConstraint.activate([
searchingButton.widthAnchor.constraint(equalToConstant: 40),
searchingButton.heightAnchor.constraint(equalTo: searchingButton.widthAnchor),
searchingButton.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor, constant: -10),
searchingButton.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -10),
slideButton.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor),
slideButton.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor, constant: 10),
trackingButton.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 4),
trackingButton.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor, constant: -10),
slideButton.heightAnchor.constraint(equalToConstant: 50),
slideButton.widthAnchor.constraint(equalTo: slideButton.heightAnchor),
trackingButton.heightAnchor.constraint(equalToConstant: 40),
trackingButton.widthAnchor.constraint(equalTo: trackingButton.heightAnchor),
mapView.topAnchor.constraint(equalTo: view.topAnchor),
mapView.bottomAnchor.constraint(equalTo: view.bottomAnchor),
mapView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
mapView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
locationTableView.leadingAnchor.constraint(equalTo: mapView.leadingAnchor),
locationTableView.trailingAnchor.constraint(equalTo: mapView.trailingAnchor),
locationTableView.bottomAnchor.constraint(equalTo: mapView.bottomAnchor),
heightConstraintTableView,
topConstraint,
inputLocationView.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor),
inputLocationView.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor),
])
delegate = locationTableView
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
setupMapView()
}
@objc func handleSearchDrivers() {
fetchDrivers()
}
func fetchDrivers() {
guard let user = self.user,
user.userOption == .rider else { return }
self.locationHandler.fetchDrivers(from: 10000) { result in
switch result {
case .success(let driverType):
DispatchQueue.main.async {
switch driverType {
case .enter(driver: let driver):
let annotation = DriverRiderAnnotation(user: driver)
self.mapView.addAnnotation(annotation)
case .exit(driver: let driver):
let driverAnnotations = self.mapView.annotations.compactMap({ $0 as? DriverRiderAnnotation }).filter { $0.user.uid == driver.uid }
self.mapView.removeAnnotations(driverAnnotations)
case .move(driver: let driver):
let newAnnotation = DriverRiderAnnotation(user: driver)
if let driverAnnotation = self.mapView.annotations.compactMap({ $0 as? DriverRiderAnnotation }).filter({ $0.user.uid == driver.uid }).first {
UIView.animate(withDuration: 1.5) {
driverAnnotation.coordinate = newAnnotation.coordinate
}
}
}
}
case .failure(let error):
print(error.localizedDescription)
}
}
}
deinit {
registeration?.remove()
}
func dismissTableLocation(_ completionHandler: (()-> Void)?) {
UIView.animate(withDuration: 0.4) {
self.heightConstraintTableView.constant = 0
self.view.layoutIfNeeded()
} completion: { _ in
UIView.animate(withDuration: 0.4) {
self.topConstraint.constant -= 300
self.view.layoutIfNeeded()
} completion: { _ in
completionHandler?()
}
}
}
func presentTableLocation() {
UIView.animate(withDuration: 0.4) {
self.inputActivationView.alpha = 0
self.slideButton.alpha = 0
self.trackingButton.alpha = 0
self.searchingButton.alpha = 0
} completion: { _ in
UIView.animate(withDuration: 0.4) {
self.topConstraint.constant = 0
self.view.layoutIfNeeded()
} completion: { _ in
UIView.animate(withDuration: 0.4) {
self.heightConstraintTableView.constant = self.view.bounds.height+20-self.inputLocationView.bounds.height
self.view.layoutIfNeeded()
} completion: { _ in
self.locationHandler.stopUpdatingLocation()
}
}
}
}
}
extension MainViewController: LocationInputActivationViewDelegate {
func handleLocationInputTapped(_ locationInput: LocationInputActivationView) {
presentTableLocation()
}
}
extension MainViewController: LocationInputViewDelegate {
func handleSearchLocation(location: String?, locationInputView: LocationInputView) {
guard let location = location else { return }
//let request = MKLocalPointsOfInterestRequest(coordinateRegion: mapView.region)
let request = MKLocalSearch.Request()
request.naturalLanguageQuery = location
request.region = mapView.region
request.resultTypes = [.address, .pointOfInterest]
let search = MKLocalSearch(request: request)
search.start { response, error in
if let error = error {
print(error.localizedDescription)
return
}
guard let response = response else { return }
self.delegate?.displayItems(items: response.mapItems.filter({ $0.name != "" && $0.placemark.title != "" }))
}
}
func handleBackButtonTapped(locationInputView: LocationInputView) {
dismissTableLocation {
self.defaultState()
// UIView.animate(withDuration: 0.4) {
// self.slideButton.alpha = 1
// self.inputActivationView.alpha = 1
// self.trackingButton.alpha = 1
// self.searchingButton.alpha = 1
// } completion: { _ in
// self.locationHandler.startUpdatingLocation()
// }
}
}
@objc func handleSlideButton() {
switch slideButtonState {
case .slide:
break
case .clear:
self.slideButtonState = .slide
defaultState()
}
}
func defaultState() {
trip = nil
guard let user = user else { return }
switch user.userOption {
case .rider:
self.handleActionView(show: false, actionViewConfiguration: nil)
UIView.animate(withDuration: 0.4) {
self.mapView.removeOverlays(self.mapView.overlays)
self.mapView.removeAnnotations(self.mapView.annotations.filter({ !($0 is MKUserLocation) }))
self.mapView.setUserTrackingMode(.follow, animated: true)
self.slideButton.setImage(#imageLiteral(resourceName: "baseline_menu_black_36dp").withRenderingMode(.alwaysOriginal), for: .normal)
self.inputActivationView.alpha = 1
self.trackingButton.alpha = 1
self.searchingButton.alpha = 1
self.slideButton.alpha = 1
} completion: { _ in
self.locationHandler.startUpdatingLocation()
self.mapView.setUserTrackingMode(.follow, animated: true)
}
case .driver:
self.handleActionView(show: false, actionViewConfiguration: nil)
UIView.animate(withDuration: 0.4) {
self.mapView.removeOverlays(self.mapView.overlays)
self.mapView.removeAnnotations(self.mapView.annotations.filter({ !($0 is MKUserLocation) }))
self.mapView.setUserTrackingMode(.follow, animated: true)
self.slideButton.setImage(#imageLiteral(resourceName: "baseline_menu_black_36dp").withRenderingMode(.alwaysOriginal), for: .normal)
} completion: { _ in
self.locationHandler.startUpdatingLocation()
self.mapView.setUserTrackingMode(.follow, animated: true)
}
}
}
func handleAcceptTrip() {
guard let trip = trip,
let user = user,
trip.state == .accepted else { return }
self.locationHandler.startUpdatingLocation()
if user.userOption == .driver {
let placemark = MKPlacemark(coordinate: trip.source)
let mapItem = MKMapItem(placemark: placemark)
let detination = mapItem
setupDirection(destination: detination, .automobile, user: trip.rider)
handleActionView(user: trip.rider,
destination: detination,
show: true, actionViewConfiguration: .tripAccepted)
} else {
if let location = trip.driver.location {
let destination = MKMapItem(placemark: MKPlacemark(coordinate: CLLocationCoordinate2D(latitude: location.latitude, longitude: location.longitude)))
self.mapView.removeOverlays(self.mapView.overlays)
self.mapView.removeAnnotations(self.mapView.annotations.filter({ !($0 is MKUserLocation) }))
setupDirection(destination: destination, .automobile, user: trip.driver)
}
let placemark = MKPlacemark(coordinate: trip.destination)
let mapItem = MKMapItem(placemark: placemark)
handleActionView(user: trip.driver,
destination: mapItem,
show: true, actionViewConfiguration: .tripCanceled)
}
}
}
extension MainViewController: LocationTableViewDelegate {
func didChooseLocation(mapItem: MKMapItem) {
dismissTableLocation {
self.handleActionView(user: self.user, destination: mapItem, show: true, actionViewConfiguration: .requestRide)
self.setupDirection(destination: mapItem, .automobile, user: nil)
self.slideButtonState = .clear
UIView.animate(withDuration: 0.4) {
self.slideButton.setImage(#imageLiteral(resourceName: "baseline_arrow_back_black_36dp-1").withRenderingMode(.alwaysOriginal), for: .normal)
self.slideButton.alpha = 1
} completion: { _ in
}
}
}
func handleActionView(user: User? = nil, destination: MKMapItem? = nil, show : Bool, actionViewConfiguration: ActionViewConfiguration?) {
if show {
guard view.subviews.first(where: { $0 is ActionView }) == nil,
let user = user,
let destination = destination,
let actionViewConfiguration = actionViewConfiguration else { return }
let actionView = ActionView(user: user, destination: destination, configuration: actionViewConfiguration)
self.actionView = actionView
actionView.delegate = self
view.addSubview(actionView)
let bottom = actionView.bottomAnchor.constraint(equalTo: view.bottomAnchor,constant: 400)
self.bottomConstraintActionView = bottom
NSLayoutConstraint.activate([
bottom,
actionView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
actionView.trailingAnchor.constraint(equalTo: view.trailingAnchor)
//locationTableView.heightAnchor.constraint(equalToConstant: )
])
view.layoutIfNeeded()
UIView.animate(withDuration: 0.4) {
bottom.constant = 0
self.view.layoutIfNeeded()
}
} else {
guard let actionView = view.subviews.first(where: { $0 is ActionView }) as? ActionView else { return }
UIView.animate(withDuration: 0.4) {
self.bottomConstraintActionView.constant = 400
self.view.layoutIfNeeded()
} completion: { _ in
actionView.removeFromSuperview()
}
}
}
func setupDirection(destination:MKMapItem , _ type :MKDirectionsTransportType, user: User?) {
locationHandler.startUpdatingLocation()
let request = MKDirections.Request()
let placeMark = MKPlacemark(coordinate: mapView.userLocation.coordinate)
request.source = MKMapItem(placemark: placeMark)
request.destination = destination
request.transportType = type
request.requestsAlternateRoutes = true
let directions = MKDirections(request: request)
directions.calculate { (response, error) in
if let routes = response?.routes {
let fastRoute = routes.min { $0.expectedTravelTime < $1.expectedTravelTime }!
DispatchQueue.main.async {
let polyline = fastRoute.polyline
polyline.title = "fastRoute"
self.mapView.addOverlay(polyline)
if let user = user {
let pointAnnotation = DriverRiderAnnotation(user: user)
self.mapView.addAnnotation(pointAnnotation)
} else {
let pointAnnotation = MKPointAnnotation()
pointAnnotation.coordinate = destination.placemark.coordinate
self.mapView.addAnnotation(pointAnnotation)
}
self.mapView.zoomToFit(annotations: self.mapView.annotations, polyline: polyline, bottomPading: self.actionView.bounds.height+40)
}
}
}
}
}
extension MainViewController: MKMapViewDelegate {
func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
if annotation is MKUserLocation {
guard let currentUser = user else { return nil }
let annotationView = UserAnnotationView(user: currentUser,annotation: annotation, reuseIdentifier: nil)
return annotationView
}
if let annotation = annotation as? DriverRiderAnnotation {
let annotationView = DriverRiderAnnotationView(user: annotation.user, annotation: annotation, reuseIdentifier: nil)
return annotationView
}
if let annotation = annotation as? MKPointAnnotation {
let annotationView = MKPinAnnotationView(annotation: annotation, reuseIdentifier: nil)
annotationView.animatesDrop = true
annotationView.pinTintColor = .black
return annotationView
}
return nil
}
func mapView(_ mapView: MKMapView, rendererFor overlay: MKOverlay) -> MKOverlayRenderer {
if overlay.title == "fastRoute",
let polyline = overlay as? MKPolyline {
let render = MKGradientPolylineRenderer(polyline: polyline)
render.setColors([.blueCyan,.blackUber], locations: [0,1])
//createPath(render: render, polyline: polyline)
return render
}
return MKOverlayRenderer()
}
func createPath(render: MKOverlayPathRenderer ,polyline:MKPolyline) {
let path = CGMutablePath()
let buffer = UnsafeMutableBufferPointer(start: polyline.points(), count: polyline.pointCount)
let points = Array(buffer).map { render.point(for: $0) }
DispatchQueue.global().async {
path.catmullRomInterpolatedPoints(points: points, closed: false, alpha: 0.3)
render.strokeColor = .blueCyan
render.lineWidth = 10
render.lineJoin = .round
render.lineCap = .round
render.path = path
}
}
}
extension MainViewController: ActionViewDelegate {
func getDirectionTrip(actionView: ActionView, detination: CLLocationCoordinate2D) {
setupDirections(to: MKMapItem(placemark: MKPlacemark(coordinate: detination)), .automobile)
}
func setupDirections(to destination:MKMapItem , _ type :MKDirectionsTransportType) {
locationHandler.startUpdatingLocation()
let request = MKDirections.Request()
let placeMark = MKPlacemark(coordinate: mapView.userLocation.coordinate)
request.source = MKMapItem(placemark: placeMark)
request.destination = destination
request.transportType = type
request.requestsAlternateRoutes = true
let directions = MKDirections(request: request)
directions.calculate { (response, error) in
if let routes = response?.routes {
let fastRoute = routes.min { $0.expectedTravelTime < $1.expectedTravelTime }!
DispatchQueue.main.async {
fastRoute.steps.forEach { step in
print(step.distance)
print(step.instructions)
print(step.notice)
}
}
}
}
}
func cancelTrip(actionView: ActionView) {
guard user.userOption == .rider,
let trip = trip else { return }
TripService.shared.updateTrip(tripID: trip.tripID, state: .canceled) { error in
if let error = error {
print(error.localizedDescription)
return
}
}
}
func uploadTrip(actionView: ActionView, detination: CLLocationCoordinate2D) {
guard user.userOption == .rider else { return }
shouldPresentLoadingView(true,message: "Finding you ride now...")
handleActionView(show: false, actionViewConfiguration: nil)
UserService.shared.uploadTrip(sourcePoint: mapView.userLocation.coordinate,
destinationPoint: detination) { tripID ,error in
if let error = error {
print(error.localizedDescription)
return
}
guard let tripID = tripID else { return }
self.listenTrip(tripID: tripID)
}
}
func listenTrip(tripID: String) {
tripRegisteration = TripService.shared.listenTrip(tripID: tripID) { result in
switch result {
case .success(let trip):
self.trip = trip
if trip.state == .accepted {
if self.user.userOption == .rider,
self.view.subviews.first(where: { $0 is UIVisualEffectView }) != nil {
self.shouldPresentLoadingView(false)
}
self.handleAcceptTrip()
}
if trip.state == .canceled {
self.defaultState()
}
case .failure(let error):
print(error.localizedDescription)
}
}
}
}
|
[
-1
] |
4a3d623392392cd2e69a16932a20a2675e48f5cb
|
083f05baf4941cd038d9a5c2096d9cd44802fc00
|
/sample/samplewatch Extension/InterfaceController.swift
|
fffe5ef1c476ce06b3a85b0e998278cd2cf92352
|
[
"MIT"
] |
permissive
|
gamma/convertappicon
|
84eabcd061f968a7db5f59d6995076bd5b776b7f
|
30c6399ec8e47103582e1e6fa8a82e477b3e3f51
|
refs/heads/master
| 2022-12-18T22:34:38.196277 | 2020-09-13T17:11:27 | 2020-09-13T17:11:27 | 294,945,756 | 0 | 0 |
MIT
| 2020-09-12T13:07:42 | 2020-09-12T13:07:41 | null |
UTF-8
|
Swift
| false | false | 722 |
swift
|
//
// InterfaceController.swift
// samplewatch Extension
//
// Created by kreait on 05.04.18.
// Copyright © 2018 kreait. All rights reserved.
//
import WatchKit
import Foundation
class InterfaceController: WKInterfaceController {
override func awake(withContext context: Any?) {
super.awake(withContext: context)
// 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()
}
}
|
[
284834,
286342,
298955,
278672,
287729,
196690,
205972,
238649,
324765
] |
07e0ba215ab6390163cb715170053fc9d6283b97
|
42aa70e65b26dc9e57e5094a1ccb7bc5e8342809
|
/Liefradeal/ViewControllers/PayLaterViewController/Cell/PayLaterTableViewCell.swift
|
1ef74c8c3dc4bae0661275306d91c49c12e8519c
|
[] |
no_license
|
arunkumar7669/Liefradeal
|
90dfb0cc5ba45ca5889ca5c56a515a1dac8fba37
|
56f27f71ca0269f328338322c1544adc8b35c064
|
refs/heads/master
| 2022-12-07T06:55:02.812506 | 2020-09-01T07:47:25 | 2020-09-01T07:47:25 | 291,938,851 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 1,598 |
swift
|
//
// PayLaterTableViewCell.swift
// HarpersKabab
//
// Created by Arun Kumar Rathore on 23/07/20.
// Copyright © 2020 arunkumar. All rights reserved.
//
import UIKit
protocol PayNowDelegate : class {
func buttonPayNowAction(_ indexPath : IndexPath)
func buttonContinueOrderClicked(_ indexPath : IndexPath)
}
class PayLaterTableViewCell: UITableViewCell {
@IBOutlet weak var buttonPayNow: UIButton!
@IBOutlet weak var labelDate: UILabel!
@IBOutlet weak var labelAmount: UILabel!
@IBOutlet weak var labelOrderId: UILabel!
@IBOutlet weak var buttonContinueOrder: UIButton!
weak var delegate : PayNowDelegate?
var indexPath = IndexPath()
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
self.buttonPayNow.backgroundColor = Colors.colorWithHexString(Colors.GREEN_COLOR)
self.buttonContinueOrder.backgroundColor = Colors.colorWithHexString(Colors.GREEN_COLOR)
UtilityMethods.addBorderAndShadow(self.buttonPayNow, 5.0)
UtilityMethods.addBorderAndShadow(self.buttonContinueOrder, 5.0)
}
@IBAction func buttonPayNowClicked(_ sender: UIButton) {
self.delegate?.buttonPayNowAction(self.indexPath)
}
@IBAction func buttonContinueOrderAction(_ sender: UIButton) {
self.delegate?.buttonContinueOrderClicked(self.indexPath)
}
}
|
[
-1
] |
348963db89bf9259914c553a0cf56c7a433b7018
|
dc572d58870de8830680e88f612436d32bee4cf9
|
/IGProfilePhoto/Common/Extensions/Codable+Extensions.swift
|
e36e431d7227a10368a43b2870f539ea5eb5718a
|
[] |
no_license
|
iosvarun/instaProfileViewer
|
a448e918a9b3621244a820a16e54fdce386b89ed
|
9e63c2de94f940b02e3a506bc7f30ea626775b9a
|
refs/heads/master
| 2023-04-07T04:33:45.703195 | 2021-04-14T16:13:19 | 2021-04-14T16:13:19 | 357,965,749 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 451 |
swift
|
//
// Codable+Extensions.swift
// IGProfilePhoto
//
// Created by Varun Kumar on 13/04/21.
//
import Foundation
extension Encodable {
func encode(with encoder: JSONEncoder = JSONEncoder()) throws -> Data {
return try encoder.encode(self)
}
}
extension Decodable {
static func decode(with decoder: JSONDecoder = JSONDecoder(), from data: Data) throws -> Self {
return try decoder.decode(Self.self, from: data)
}
}
|
[
-1
] |
655baf7c91bc80f27b01ca4ca0583c581d2d0a43
|
be36df6f6c3741cb2cdb908bd905e22adfcf6360
|
/My Finance Controller/CCGlobal.swift
|
e20ba7f6a87bc7c0617e2ca3b109a7c89973c5bc
|
[] |
no_license
|
americo677/My-Finance-Controller
|
f2eb79a8abb9fa8ba37c2cce21e54cd9e97e9ea5
|
713ab0cb5e19e1e0331868a639feb550867410ca
|
refs/heads/master
| 2021-05-24T15:52:13.408710 | 2017-01-17T19:15:56 | 2017-01-17T19:15:56 | 253,641,560 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 820 |
swift
|
//
// CCGlobals.swift
// My Finance Controller
//
// Created by Américo Cantillo on 19/08/16.
// Copyright © 2016 Américo Cantillo Gutiérrez. All rights reserved.
//
import Foundation
import UIKit
// Custom Class for Global Values
open class CCGlobal {
let MAX_EXECUTIONS_FOR_LITE_VERSION = 30
let MAX_BUDGETS_LITE_VERSION = 4
let MAX_SECTIONS_FOR_BUDGETS_LITE_VERSION = 3
let MAX_RECEIPTS_FOR_BUDGETS_LITE_VERSION = 18
let MAX_ROW_HEIGHT: CGFloat = 70 //63 // 63 //93
let MAX_ROW_HEIGHT_DETAIL: CGFloat = 58
let MAX_SECTION_ROW_HEIGHT_DETAIL: CGFloat = 55
let FONT_NAME_TITLE_NAVIGATION_BAR = "Verdana"
let FONT_NAME_TABLEVIEW_SECTION = "Verdana"
let APP_TITLE = "My Finance Controller"
//let FONT_NAME_TITLE_NAVIGATION_BAR = "Georgia"
}
|
[
-1
] |
e5bbb273ffabadaa5ccd103fee4e3cf55e1cca7f
|
89edfe1f76db4aba9ce57a0ac4ec472125b609f0
|
/Postal/ViewController.swift
|
df654fd8d63daae37f0d150a6c661d86ad500567
|
[] |
no_license
|
sergioljq/Postal
|
e7f30fa317005fcd4671664a3d3e8121c4e8e629
|
86df0882f9fc6639ab12c7cb2ef4e64a30003f43
|
refs/heads/master
| 2020-05-26T02:18:49.761810 | 2014-11-28T20:29:14 | 2014-11-28T20:29:14 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 1,576 |
swift
|
//
// ViewController.swift
// Postal
//
// Created by Sergio Jordan Queipo on 27/11/14.
// Copyright (c) 2014 Sergio Jordan Queipo. All rights reserved.
//
// Aprendiendo a programar en Swift
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var messageLabel: UILabel!
@IBOutlet weak var nameLabel: UILabel!
@IBOutlet weak var enterNameTextField: UITextField!
@IBOutlet weak var enterMessageTextfield: UITextField!
@IBOutlet weak var mailButton: UIButton!
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.
}
@IBAction func sendMailButtonPressed(sender: UIButton) {
//esto determina el comportamiento y acciones cuando se hace clic en el botón de enviar
messageLabel.hidden = false
messageLabel.text = enterMessageTextfield.text
messageLabel.textColor = UIColor.blueColor()
enterMessageTextfield.text = ""
enterMessageTextfield.resignFirstResponder()
nameLabel.hidden = false
nameLabel.text = enterNameTextField.text
nameLabel.textColor = UIColor.greenColor()
enterNameTextField.text = ""
enterNameTextField.resignFirstResponder()
mailButton.setTitle("Mail enviado", forState: UIControlState.Normal)
}
}
|
[
-1
] |
36b4f96223a012e0846023138f4d08de53837a08
|
01d1d83ef79596be9c2f3dcb930ce6ef371d51f3
|
/FlickrViewer/Services/FlickrService/FlickrService.swift
|
0020b68edc8514c3b454013e5ffe97faf7e13f5d
|
[
"MIT"
] |
permissive
|
motorbit/FlickrViewer
|
beafd5f2e23e1c74e44a431ffe705d1c9a284a76
|
64806c68e3dbb56b61c51a816ffe79a28beb6bfa
|
refs/heads/master
| 2020-04-22T16:35:03.176571 | 2019-02-21T22:41:32 | 2019-02-21T22:41:32 | 170,512,820 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 2,430 |
swift
|
//
// FlickrService.swift
// FlickrViewer
//
// Created by Anton Makarov on 2/13/19.
// Copyright © 2019 Anton Makarov. All rights reserved.
//
import Foundation
final class FlickrService: FlickerServiceProtocol {
static let shared = FlickrService()
private init() {}
private let extrasSet: Set<Extras> = [.uploadDate, .takenDate, .owner,
.thumb, .large, .origin, .medium]
func getRecent(_ page: Int, size: Int, completion: ((Result<RecentResponse>) -> Void)?) {
let extras = extrasSet.map { $0.rawValue }.joined(separator: ",")
guard let request = FlickrRecentRequest(page: page, size: size, extras: extras).makeRequest() else { return }
execute(request, completion: completion)
}
func search(_ text: String, page: Int, size: Int, completion: ((Result<RecentResponse>) -> Void)?) {
let extras = extrasSet.map { $0.rawValue }.joined(separator: ",")
guard let request = FlickrSerchRequest(page: page, size: size, extras: extras, text: text)
.makeRequest() else { return }
execute(request, completion: completion)
}
private func execute(_ request: URLRequest, completion: ((Result<RecentResponse>) -> Void)?) {
let config = URLSessionConfiguration.default
let session = URLSession(configuration: config)
let task = session.dataTask(with: request) { (responseData, response, error) in
if let error = error {
completion?(.failure(error))
} else if let jsonData = responseData {
do {
let recents = try JSONDecoder().decode(RecentResponse.self, from: jsonData)
completion?(.success(recents))
} catch {
completion?(.failure(error))
}
} else {
let error = NSError(domain: "", code: 0, userInfo: [NSLocalizedDescriptionKey : "Data was not retrieved from request"]) as Error
completion?(.failure(error))
}
}
task.resume()
}
enum Extras: String {
case uploadDate = "date_upload"
case takenDate = "date_taken"
case owner = "owner_name"
case thumb = "url_t"
case large = "url_l"
case origin = "url_o"
case medium = "url_c"
}
}
|
[
-1
] |
5e72cd7df552d094e285eaed733d09fbe63709e6
|
a1d3155762894b4d64f77a8948cbca77d0b937eb
|
/Constants.swift
|
2a5f43f7adf5b57f3467d321fa16ed332e488adf
|
[] |
no_license
|
igorbvaz/Pokedex
|
7359d99251491c2ce2ba2cf9bdb28825846a416c
|
02907a712a14227be0aba69397258640d747d86a
|
refs/heads/master
| 2020-01-23T21:40:17.217769 | 2016-12-01T16:28:03 | 2016-12-01T16:28:07 | 74,690,303 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 262 |
swift
|
//
// Constants.swift
// Pokedex
//
// Created by Igor Vaz on 30/11/16.
// Copyright © 2016 Igor Vaz. All rights reserved.
//
import Foundation
let URL_BASE = "http://pokeapi.co"
let URL_POKEMON = "/api/v1/pokemon/"
typealias DownloadComplete = () -> ()
|
[
291250
] |
05e5ea138871f3e94ecffa0a1fc2b066f2b1f2f3
|
38b539982a9b8a501ddc87a9078f80764dc9b2b0
|
/hack_challenge/Library.swift
|
4ee42f8434479713ba8d435109070730938701e4
|
[] |
no_license
|
mathewscullin/Nooks
|
d409eeff1cbd33575ef2de4d26d9b35b9e81ffd8
|
3ba549127dc002383d0d47e24b0d598ac72d6145
|
refs/heads/master
| 2020-04-08T01:34:53.702194 | 2019-01-07T17:29:32 | 2019-01-07T17:29:32 | 158,900,865 | 0 | 1 | null | null | null | null |
UTF-8
|
Swift
| false | false | 1,585 |
swift
|
//
// Library.swift
// hack_challenge
//
// Created by Mathew Scullin on 11/20/18.
// Copyright © 2018 Mathew Scullin. All rights reserved.
//
import Foundation
struct Location: Codable {
var coordinates : [Double]
var campus : String
}
struct Nook : Codable {
var roomName : String
var loudnessLevel : String
}
struct Services : Codable{
var electronic : [String]
var resources : [String]
}
struct Cafe : Codable {
var name : String
var time : String
var brb : Bool
}
struct Information : Codable {
var nooks : [Nook]
var services : Services
var cafe : Cafe
}
class Library: Codable {
var name : String
var image_url : String
var times: [String]
var information: Information
var isOpen : Bool = false
var isClosing : Bool = false
var location: Location
var isFavorite: Bool = false
init(name: String, image_url : String, times : [String], information: Information, location : Location) {
self.name = name
self.image_url = image_url
self.times = times
self.information = information
self.location = location
isFavorite = false
}
enum CodingKeys: String, CodingKey {
case name , image_url , times, information , location
}
func calculateStatus() {
self.isOpen = getIsOpen(time: times[0])
self.isClosing = getIsClosing(time: times[0])
}
}
struct LibraryResponse: Codable {
var libraries: [Library]
}
struct finalLibraryResponse: Codable {
var data: LibraryResponse
}
|
[
-1
] |
2b21c5a035f028ad19e20c776b1135daaedef162
|
c8c37109d5ffc4f345f840d79bacd9a077b06307
|
/On the Map/MapViewController.swift
|
10fb90bd0bf99d462ebf361263c12dcd0bfdeb7b
|
[] |
no_license
|
alperenc/On-the-Map
|
8193237f668f299770b13b6e8b92a6dde1bab63a
|
6c20c4dfca1d61313dc6c72267fee556985b4818
|
refs/heads/master
| 2021-01-10T14:29:53.871600 | 2017-02-28T15:20:07 | 2017-02-28T15:20:07 | 50,800,410 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 4,449 |
swift
|
//
// MapViewController.swift
// On the Map
//
// Created by Alp Eren Can on 19/10/15.
// Copyright © 2015 Alp Eren Can. All rights reserved.
//
import UIKit
import MapKit
class MapViewController: UIViewController, MKMapViewDelegate {
// MARK: Properties
@IBOutlet weak var mapView: MKMapView!
let studentLocations = StudentLocations.sharedInstance()
var annotations = [MKPointAnnotation]()
var activityIndicator: UIActivityIndicatorView?
// MARK: Life Cycle
override func viewDidLoad() {
super.viewDidLoad()
mapView.delegate = self
activityIndicator = UIActivityIndicatorView(activityIndicatorStyle: .gray)
activityIndicator?.hidesWhenStopped = true
activityIndicator?.center = view.center
mapView.addSubview(activityIndicator!)
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
fetchStudentLocations(refresh: false)
}
// MARK: Actions
@IBAction func logout(_ sender: UIBarButtonItem) {
activityIndicator?.startAnimating()
UdacityClient.sharedInstance().logout { (success) -> Void in
DispatchQueue.main.async { () -> Void in
self.activityIndicator?.stopAnimating()
if success {
self.dismiss(animated: true, completion: nil)
} else {
print("Logout failed.")
}
}
}
}
@IBAction func refresh(_ sender: UIBarButtonItem) {
fetchStudentLocations(refresh: true)
}
// MARK: MapViewController
func fetchStudentLocations(refresh: Bool) {
if studentLocations.locations.count == 0 || refresh {
activityIndicator?.startAnimating()
mapView.removeAnnotations(annotations)
annotations.removeAll()
studentLocations.getStudentLocations() { (success, error) -> Void in
DispatchQueue.main.async { () -> Void in
self.activityIndicator?.stopAnimating()
if success {
self.createAnnotations(self.studentLocations.locations)
} else {
self.alertUser(title: "Download failed!", message: (error?.localizedDescription)!)
}
}
}
} else {
createAnnotations(studentLocations.locations)
}
}
func createAnnotations(_ locations: [StudentInformation]) {
for info in locations {
let annotation = MKPointAnnotation()
annotation.coordinate = CLLocationCoordinate2D(latitude: info.latitude, longitude: info.longitude)
annotation.title = "\(info.firstName) \(info.lastName)"
annotation.subtitle = "\(info.mediaURL)"
annotations.append(annotation)
}
mapView.addAnnotations(annotations)
}
// MARK: Map View Delegate
func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
let reuseId = "studentInfo"
var pinView = mapView.dequeueReusableAnnotationView(withIdentifier: reuseId) as? MKPinAnnotationView
if pinView == nil {
pinView = MKPinAnnotationView(annotation: annotation, reuseIdentifier: reuseId)
pinView!.canShowCallout = true
pinView!.pinTintColor = UIColor.customOrangeColor()
pinView!.rightCalloutAccessoryView = UIButton(type: .detailDisclosure)
}
else {
pinView!.annotation = annotation
}
return pinView
}
// This delegate method is implemented to respond to taps. It opens the system browser
// to the URL specified in the annotationViews subtitle property.
func mapView(_ mapView: MKMapView, annotationView view: MKAnnotationView, calloutAccessoryControlTapped control: UIControl) {
if control == view.rightCalloutAccessoryView {
let app = UIApplication.shared
if let toOpen = view.annotation?.subtitle! {
app.openURL(URL(string: toOpen)!)
}
}
}
}
|
[
-1
] |
7a0d80e08b09bffdf41c14db40988d72ab0b8f60
|
4859b31bc5e418c7ba77f0952fe2a0068682c97d
|
/Photorama/FlickrAPI.swift
|
d4c1c3b209370028f4bdefde551facbe6168f1cf
|
[] |
no_license
|
bohdansasko/Photorama
|
71f1ee45091bd630b237f3f579b4cb5a218e9bdb
|
103bc7a638811717b6571c82ffb066e528ff404a
|
refs/heads/master
| 2020-05-22T04:44:40.419189 | 2019-05-25T20:53:05 | 2019-05-25T20:53:05 | 186,221,706 | 1 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 3,645 |
swift
|
//
// FlickrAPI.swift
// Photorama
//
// Created by Bogdan Sasko on 5/12/19.
// Copyright © 2019 Vinso. All rights reserved.
//
import Foundation
import CoreData
enum FlickrError: Error {
case invalidJSONData
}
enum Method: String {
case interestingPhotos = "flickr.interestingness.getList"
case recentPhotos = "flickr.photos.getRecent"
}
extension DateFormatter {
static let flick: DateFormatter = {
let formatter = DateFormatter()
formatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
return formatter
}()
}
struct FlickrAPI {
static var interestingPhotosURL: URL {
return flickrURL(method: .interestingPhotos,
parameters: ["extras": "url_s,date_taken"])
}
private static let kBaseURLString = "https://api.flickr.com/services/rest"
private static let kApiKey = "a6d819499131071f158fd740860a5a88"
private static func flickrURL(method: Method,
parameters: [String: String]?) -> URL {
var components = URLComponents(string: kBaseURLString)!
var queryItems = [URLQueryItem]()
let baseParams = [
"method": method.rawValue,
"format": "json",
"nojsoncallback": "1",
"api_key": kApiKey
]
for (key, value) in baseParams {
let item = URLQueryItem(name: key, value: value)
queryItems.append(item)
}
guard let additionalParams = parameters else {
return components.url!
}
for (key, value) in additionalParams {
let item = URLQueryItem(name: key, value: value)
queryItems.append(item)
}
components.queryItems = queryItems
print(components)
return components.url!
}
static func photos(fromJSON data: Data, into context: NSManagedObjectContext) -> PhotosResult {
do {
let decoder = JSONDecoder()
decoder.dateDecodingStrategy = .formatted(DateFormatter.flick)
let photos = try decoder.decode(Photos.self, from: data)
if photos.photos.isEmpty {
return .failure(FlickrError.invalidJSONData)
}
photos.photos.forEach({ _photo in
if self.isPhotoInDB(context: context, _photo) {
return
}
print("save photo \(_photo.photoID)")
var photo: MOPhoto!
context.performAndWait {
photo = MOPhoto(context: context)
photo.title = _photo.title
photo.photoID = _photo.photoID
photo.remoteURL = _photo.remoteURL as NSURL
photo.dateTaken = _photo.dateTaken as NSDate
}
})
return .success(photos.photos)
} catch {
return .failure(error)
}
}
private static func isPhotoInDB(context: NSManagedObjectContext, _ photo: Photo) -> Bool {
let fetchRequest: NSFetchRequest<MOPhoto> = MOPhoto.fetchRequest()
let predicate = NSPredicate(format: "\(#keyPath(MOPhoto.photoID)) == \(photo.photoID)", argumentArray: nil)
fetchRequest.predicate = predicate
var fetchedPhotos: [MOPhoto]?
context.performAndWait {
fetchedPhotos = try? context.fetch(fetchRequest)
}
if let _ = fetchedPhotos?.first {
return true
}
return false
}
}
|
[
-1
] |
3d2d28d60ea78df23d9769b2270617e432bff06b
|
051aa6b553bf0aa4d1e7bbf3aa25a6c64ac15095
|
/zhuishushenqi/RightSide/Category/Models/AllChapterAPI.swift
|
3956cffe881acee5630bb8565469aa78713afa39
|
[
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] |
permissive
|
xutongle/zhuishushenqi
|
7f96f8ff364235363949c0121e7aa8ee29ceb025
|
30570553d8b4dceb3eb268726518e7887a286dd1
|
refs/heads/master
| 2021-01-18T19:00:41.019275 | 2017-03-19T14:05:39 | 2017-03-19T14:05:39 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 508 |
swift
|
//
// AllChapterAPI.swift
// zhuishushenqi
//
// Created by Nory Chao on 16/10/11.
// Copyright © 2016年 XYC. All rights reserved.
//
import UIKit
class AllChapterAPI: XYCBaseRequest {
var id:NSString = ""
override func requestUrl() -> String {
return "/ctoc/\(id)"
}
override func requestMethod() -> XYCRequestMethod? {
return XYCRequestMethod.get
}
override func requestArgument() -> NSDictionary? {
return ["view":"chapters"]
}
}
|
[
-1
] |
9bb16b14cf159e4e27b3d49acced258bc65f1f20
|
034a3272a4015393882db686030c5a6e1570f7e0
|
/Knuckles/Model/Box.swift
|
25405dea8c32cecd64be1959eb9bfc280ed82a65
|
[] |
no_license
|
mathhislife/Knuckles
|
f20d366a149a858f9a129b3ba6bc49f116fff592
|
62ac2ec3bd8e940551c0eb919ecebba743780801
|
refs/heads/master
| 2020-03-18T15:23:08.872482 | 2018-05-25T00:26:34 | 2018-05-25T00:26:34 | 134,783,071 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 1,442 |
swift
|
//
// Box.swift
// Knuckles
//
// Created by Simon Kostenko on 22.05.2018.
// Copyright © 2018 Simon Kostenko. All rights reserved.
//
import Foundation
class Box {
let rows: Int
let columns: Int
private var knuckles: [Knuckle?]
var size: Int {
return rows * columns
}
var emptyCellCoordinate: (row: Int, column: Int) {
let index = knuckles.index { $0 == nil }!
return (index / rows, index % rows)
}
var emptyCellIndex: Int {
return knuckles.index { $0 == nil }!
}
init(rows: Int, columns: Int, knuckles: [Knuckle?]) {
self.rows = rows
self.columns = columns
self.knuckles = knuckles
}
subscript(index: Int) -> Knuckle? {
get {
return knuckles[index]
}
set {
knuckles[index] = newValue
}
}
}
extension MutableCollection {
/// Shuffles the contents of this collection.
mutating func shuffle() {
let c = count
guard c > 1 else { return }
for (firstUnshuffled, unshuffledCount) in zip(indices, stride(from: c, to: 1, by: -1)) {
// Change `Int` in the next line to `IndexDistance` in < Swift 4.1
let d: Int = numericCast(arc4random_uniform(numericCast(unshuffledCount)))
let i = index(firstUnshuffled, offsetBy: d)
swapAt(firstUnshuffled, i)
}
}
}
|
[
-1
] |
ad7f0292fca05afa313926f61d717e4563d8107c
|
b0ce0827660893179ea61b9885c54440d1de5e71
|
/RoadQ/RoadQ/Queue.swift
|
8a6e43be0294394aca188a548657538261819b9d
|
[] |
no_license
|
Ashif22khan/RoadQ
|
bbe086632646f694df155469242e086e8ad1fc85
|
3b939a8a26728ef59245e54bcf53f74deb6982d4
|
refs/heads/master
| 2021-09-01T00:15:24.238050 | 2017-12-23T18:42:33 | 2017-12-23T18:42:33 | 111,198,558 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 1,119 |
swift
|
//
// Queue.swift
// MotionHump
//
// Created by Ashif Khan on 24/07/16.
// Copyright © 2016 Local. All rights reserved.
//
import Foundation
public struct Queue<T> {
private var array = [T]()
//private let accessQueue = dispatch_queue_create("SynchronizedQueueAccess", DISPATCH_QUEUE_SERIAL)
private var _cap:Int
public var capacity:Int{
set{
_cap = newValue
}
get{
return _cap
}
}
public var count: Int {
return array.count
}
public var isEmpty: Bool {
return array.isEmpty
}
public mutating func enqueue(element: T) {
array.append(element)
if array.count > _cap {
let _ = self.dequeue()
}
}
public mutating func dequeue() -> T? {
if isEmpty {
return nil
} else {
return array.removeFirst()
}
}
public init(cap:Int){
self._cap = cap;
}
public func peek() -> T? {
return array.first
}
public func arrayFromQueue() -> [T] {
return array
}
}
|
[
-1
] |
11b281c37bd1baac2aaca5611b25fc2d572c4fc0
|
8e52e31609b7ca2a1eac83d143024ac128c8b5d3
|
/picApp/TestViewController.swift
|
bf9d5ab6990293cfa8d1c47aa3cea8b9e9ef2681
|
[] |
no_license
|
jefersondm/picApp
|
50c0fd4ddeb2b3e6722bf255446cfc7d1930db26
|
2331a658191d5c3f0bdd0097e83ac8f8796acf0a
|
refs/heads/master
| 2021-01-20T20:37:03.594812 | 2016-06-22T01:09:48 | 2016-06-22T01:09:48 | 61,678,051 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 885 |
swift
|
//
// TestViewController.swift
// picApp
//
// Created by Jeferson Montanha on 12/05/16.
// Copyright © 2016 Jeferson Montanha. All rights reserved.
//
import UIKit
class TestViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
|
[
278016,
279041,
278018,
278020,
278021,
279046,
308242,
281107,
217109,
300057,
296489,
284208,
281142,
300089,
238653,
286786,
129604,
228932,
292428,
292429,
292431,
292432,
228945,
203858,
280146,
212573,
309347,
309349,
309351,
309353,
286314,
296042,
277612,
311913,
164974,
284275,
277108,
284277,
284279,
284285,
292478,
284289,
284298,
278675,
349332,
284315,
284317,
282275,
284323,
313007,
284336,
276150,
280760,
296638,
277696,
280770,
285378,
280772,
280775,
284361,
230604,
298189,
302286,
230608,
317137,
290004,
284373,
290006,
189655,
302295,
298202,
278749,
280797,
298206,
363743,
290020,
301284,
277224,
280808,
199402,
280810,
289524,
120054,
226038,
280826,
276736,
280832,
311045,
312586,
302865,
278298,
329499,
287004,
281373,
281380,
233767,
283433,
278845,
279360,
296272,
279380,
289112,
279386,
188253,
292701,
311645,
227688,
228201,
280434,
277364,
207738,
290175,
183173,
233869,
304015,
306577,
226196,
188313,
284570,
283034,
284574,
284577,
289187,
289190,
289191,
305577,
291755,
289196,
370093,
279982,
286126,
297903,
305582,
291759,
282548,
293816,
127418,
293308,
278973,
291774,
10179,
286158,
280015,
286162,
301012,
191453,
280030,
279011,
289771,
278015,
282095,
302580,
236022,
288251,
287231
] |
8b76bc091a850bcf84a7511be14f421c45df4aca
|
f42a26027a2cf9dedc1ddfb420962f79abcf5593
|
/ToDoList/ToDoList/ToDoTableTableViewController.swift
|
74a394c5c6399c89f7ebcb4d2c9754c878c4b95c
|
[] |
no_license
|
laraerik/KWK-Lessons
|
d5fca576c2da0a074dcc5986b6317b8ae14744bf
|
1bb41748b6ab0c27bb56cee14cb985e9e4fc8b5b
|
refs/heads/master
| 2022-11-23T07:08:42.674071 | 2020-07-27T23:50:55 | 2020-07-27T23:50:55 | 281,718,920 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 1,729 |
swift
|
//
// ToDoTableTableViewController.swift
// ToDoList
//
// Created by gwc on 7/27/20.
// Copyright © 2020 gwc. All rights reserved.
//
import UIKit
class ToDoTableTableViewController: UITableViewController {
var listOfToDo : [ToDoClass] = []
func createToDo() -> [ToDoClass]{
let swiftToDo = ToDoClass()
swiftToDo.description = "Learn Swift"
swiftToDo.important = true
let dogToDo = ToDoClass()
dogToDo.description = "Walk the Dog"
return[swiftToDo, dogToDo]
}
override func viewDidLoad() {
super.viewDidLoad()
listOfToDo = createToDo()
}
// MARK: - Table view data source
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// #warning Incomplete implementation, return the number of rows
return 2
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "reuseIdentifier", for: indexPath)
let eachToDo = listOfToDo[indexPath.row]
if eachToDo.important {
cell.textLabel?.text = "❗️" + eachToDo.description
} else {
cell.textLabel?.text = eachToDo.description
}
return cell
}
/*
// 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
] |
55673c6196109bd2dd02a3dc15402b0004674110
|
4e6f16287bf0127ede556457419a7c66f9b1c389
|
/PointCloudCapture/Model/PointNode.swift
|
dffacce8322600a62f5bed948986eea7c5a135bf
|
[] |
no_license
|
haruishi43/PointCloudCapture
|
7db2b9c2aa636918f3d7d2d272c20a4d06787f5e
|
19d2e18d3da8165cef70d4acaca11d6d3bad09fd
|
refs/heads/master
| 2022-07-15T04:16:40.583150 | 2018-10-10T03:55:37 | 2018-10-10T03:55:37 | 152,357,651 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 822 |
swift
|
//
// PointNode.swift
// PointCloudCapture
//
// Created by Haruya Ishikawa on 2018/03/20.
// Copyright © 2018 Haruya Ishikawa. All rights reserved.
//
import Foundation
import SceneKit
class PointNode: SCNNode {
convenience init(origin: SCNVector3) {
self.init()
self.position = origin
createGeometry()
}
/// Create Geometry for the node
private func createGeometry() {
let r: CGFloat = 0.005
let sphere = SCNSphere(radius: r)
let material = SCNMaterial()
material.diffuse.contents = UIColor.purple
sphere.name = "point"
sphere.firstMaterial = material
sphere.segmentCount = 4
self.geometry = sphere
}
private func updateGeometry() {
}
}
|
[
-1
] |
a91eab4ce8db05cbdfcc8972394ce833e2c73a52
|
12879a63a2118879f0a15eb7bb93367d3d838804
|
/Example/JJPDFViewer/AppDelegate.swift
|
611103e9a6503db82b1d7494575a9bc2185723f3
|
[
"MIT"
] |
permissive
|
chinaljw/JJPDFViewer
|
45982bf83a1b821ad7a83d87179df26af100d7d6
|
e7fe4b9beb3903c0d573c32df7a9ba86918c7b38
|
refs/heads/master
| 2023-02-05T23:55:40.231702 | 2020-12-23T06:19:49 | 2020-12-23T06:19:49 | 323,044,894 | 5 | 1 | null | null | null | null |
UTF-8
|
Swift
| false | false | 2,172 |
swift
|
//
// AppDelegate.swift
// JJPDFViewer
//
// Created by chinaljw on 12/08/2020.
// Copyright (c) 2020 chinaljw. 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 throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
|
[
229380,
229383,
229385,
278539,
229388,
294924,
278542,
229391,
327695,
278545,
229394,
278548,
229397,
229399,
229402,
278556,
229405,
278559,
229408,
278564,
294950,
229415,
229417,
327722,
237613,
229422,
360496,
229426,
237618,
229428,
286774,
319544,
204856,
229432,
286776,
286778,
352318,
286791,
237640,
278605,
286797,
311375,
237646,
163920,
196692,
319573,
311383,
278623,
319590,
311400,
278635,
303212,
278639,
131192,
278648,
237693,
327814,
131209,
303241,
417930,
311436,
303244,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
131264,
286916,
286922,
286924,
286926,
319694,
286928,
131281,
278743,
278747,
295133,
155872,
319716,
278760,
237807,
303345,
286962,
131314,
229622,
327930,
278781,
278783,
278785,
237826,
319751,
278792,
286987,
319757,
311569,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
287032,
155966,
278849,
319809,
319810,
319814,
311623,
319818,
311628,
229709,
319822,
287054,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
319879,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
278980,
98756,
278983,
319945,
278986,
319947,
278990,
278994,
311767,
279003,
279006,
188895,
172512,
279010,
287202,
279015,
172520,
319978,
279020,
172526,
279023,
311791,
172529,
279027,
319989,
164343,
180727,
279035,
311804,
287230,
279040,
303617,
287234,
279045,
287238,
172550,
303623,
320007,
172552,
279051,
172558,
279055,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
279082,
311850,
279084,
172591,
172598,
279095,
172607,
172609,
172612,
377413,
172614,
172618,
303690,
33357,
287309,
279124,
172634,
262752,
172644,
311911,
189034,
295533,
189039,
189040,
172655,
172656,
352880,
189044,
172660,
295538,
287349,
287355,
287360,
295553,
287365,
295557,
311942,
303751,
352905,
279178,
287371,
311946,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
287390,
295583,
303773,
172705,
287394,
164509,
303780,
172702,
287398,
172707,
287400,
279208,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
279231,
328384,
287423,
287427,
312006,
107208,
107212,
172748,
287436,
172751,
287440,
295633,
172755,
303827,
279255,
172760,
287450,
303835,
279258,
189149,
303838,
213724,
279267,
312035,
295654,
279272,
312048,
230128,
312050,
230131,
205564,
303871,
230146,
328453,
295685,
230154,
33548,
312077,
295695,
295701,
369433,
230169,
295707,
328476,
295710,
230175,
303914,
279340,
205613,
279353,
230202,
312124,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
279390,
230241,
279394,
303976,
336744,
303985,
328563,
303987,
279413,
303991,
303997,
295806,
295808,
304005,
295813,
304007,
320391,
213895,
304009,
304011,
230284,
304013,
213902,
279438,
189325,
189329,
295822,
189331,
304019,
279445,
58262,
304023,
295825,
279452,
234648,
410526,
279461,
279462,
304042,
213931,
304055,
230327,
287675,
197564,
304063,
238528,
304065,
189378,
213954,
156612,
295873,
213963,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
312321,
295945,
295949,
197645,
230413,
320528,
140312,
295961,
238620,
197663,
304164,
189479,
304170,
238641,
312374,
238652,
238655,
230465,
238658,
296004,
132165,
336964,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
361576,
296040,
205931,
296044,
164973,
205934,
279661,
312432,
279669,
337018,
189562,
279679,
279683,
222340,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
165038,
238766,
230576,
238770,
304311,
230592,
279750,
312518,
230600,
230607,
148690,
320727,
279769,
304348,
279777,
304354,
296163,
320740,
279781,
304360,
320748,
279788,
279790,
304370,
296189,
320771,
312585,
296202,
296205,
230674,
320786,
230677,
296213,
296215,
320792,
230681,
230679,
214294,
304416,
230689,
173350,
312622,
296243,
312630,
222522,
222525,
296253,
296255,
312639,
230718,
296259,
378181,
296262,
230727,
296264,
238919,
320840,
296267,
296271,
222545,
230739,
312663,
337244,
222556,
230752,
312676,
230760,
173418,
410987,
230763,
230768,
296305,
312692,
230773,
304505,
181626,
304506,
279929,
181631,
312711,
312712,
296331,
288140,
230800,
288144,
304533,
337306,
288154,
288160,
173472,
288162,
288164,
279975,
304555,
370092,
279983,
173488,
288176,
279985,
312755,
296373,
312759,
337335,
288185,
279991,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
288210,
370130,
288212,
280021,
288214,
222676,
239064,
288217,
288218,
280027,
288220,
329177,
239070,
288224,
288226,
370146,
280036,
288229,
280038,
288230,
288232,
280034,
288234,
320998,
288236,
288238,
288240,
288242,
296435,
288244,
288250,
148990,
321022,
206336,
402942,
296446,
296450,
230916,
230919,
214535,
370187,
304651,
304653,
402969,
230940,
222752,
108066,
296486,
296488,
157229,
230961,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
280152,
288344,
239194,
280158,
403039,
370272,
181854,
239202,
370279,
312938,
280183,
280185,
280188,
280191,
280194,
116354,
280208,
280211,
288408,
280218,
280222,
419489,
190118,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
419522,
313027,
280260,
419525,
280264,
206536,
206539,
206541,
206543,
280276,
313044,
321239,
280283,
18140,
313052,
288478,
313055,
321252,
313066,
280302,
288494,
280304,
313073,
419570,
288499,
321266,
288502,
280314,
288510,
124671,
67330,
280324,
198405,
288519,
280331,
198416,
280337,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
296767,
288576,
345921,
280388,
337732,
304968,
280393,
194130,
280402,
173907,
313176,
280419,
321381,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280464,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
280487,
313258,
321458,
296883,
124853,
214966,
10170,
296890,
288700,
296894,
280515,
190403,
296900,
337862,
165831,
280521,
231379,
296921,
354265,
354270,
239586,
313320,
354281,
231404,
124913,
165876,
321528,
313340,
239612,
288764,
239617,
313347,
288773,
313358,
305176,
321560,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
378941,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
280671,
149599,
149601,
321634,
223327,
149603,
329830,
280681,
313451,
223341,
280687,
215154,
280691,
313458,
313464,
329850,
321659,
280702,
288895,
321670,
215175,
141446,
288909,
141455,
141459,
280725,
313498,
100520,
288936,
280747,
288940,
280755,
288947,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
321740,
313548,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
157930,
280811,
280817,
125171,
157940,
280819,
182517,
280823,
280825,
280827,
280830,
280831,
280833,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
280888,
280891,
289087,
280897,
280900,
239944,
305480,
280906,
239947,
305485,
305489,
379218,
280919,
248153,
215387,
354653,
313700,
313705,
280937,
190832,
280946,
223606,
313720,
280956,
239997,
280959,
313731,
240011,
199051,
289166,
240017,
297363,
190868,
297365,
240021,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
305594,
289210,
281024,
289218,
289221,
289227,
436684,
281045,
281047,
215526,
166378,
305647,
281075,
174580,
281084,
240124,
305662,
305664,
240129,
305666,
305668,
223749,
330244,
281095,
223752,
338440,
150025,
240132,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
281135,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
281179,
199262,
338528,
338532,
281190,
199273,
281196,
158317,
19053,
313973,
297594,
281210,
158347,
264845,
182926,
133776,
182929,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
199364,
297671,
158409,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322314,
322318,
281361,
281372,
322341,
215850,
281388,
207661,
289593,
281401,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
281442,
174955,
224110,
207733,
207737,
183172,
158596,
338823,
322440,
314249,
240519,
183184,
240535,
289687,
224151,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
420829,
281567,
289762,
322534,
297961,
183277,
281581,
322550,
134142,
322563,
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,
308418,
216436,
306549,
298358,
314743,
306552,
306555,
314747,
298365,
290171,
290174,
224641,
281987,
314756,
298372,
281990,
224647,
265604,
298377,
314763,
142733,
298381,
314768,
224657,
306581,
314773,
314779,
314785,
282025,
314793,
282027,
241068,
241070,
241072,
282034,
241077,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
290291,
282101,
241142,
191992,
290298,
151036,
290302,
282111,
290305,
175621,
192008,
323084,
257550,
282127,
290321,
282130,
323090,
282133,
290325,
241175,
290328,
282137,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
28219,
282186,
224849,
282195,
282199,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
282255,
282261,
175770,
298651,
323229,
282269,
298655,
323231,
61092,
282277,
306856,
282295,
282300,
323260,
323266,
282310,
323273,
282319,
306897,
241362,
282328,
306904,
298714,
52959,
282337,
216801,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
241450,
282410,
306988,
306991,
315184,
323376,
315190,
241464,
159545,
282425,
298811,
307009,
413506,
241475,
307012,
298822,
148946,
315211,
282446,
307027,
315221,
282454,
315223,
241496,
323414,
241498,
307035,
307040,
282465,
110433,
241509,
110438,
298860,
110445,
282478,
282481,
110450,
315251,
315249,
315253,
315255,
339838,
282499,
315267,
315269,
241544,
282505,
241546,
241548,
298896,
282514,
298898,
241556,
298901,
44948,
282520,
241560,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
36779,
241581,
282542,
241583,
323504,
241586,
282547,
241588,
290739,
241590,
241592,
241598,
290751,
241600,
241605,
151495,
241610,
298975,
241632,
298984,
241640,
241643,
298988,
241646,
241649,
241652,
323574,
290807,
241661,
299006,
282623,
315396,
241669,
315397,
282632,
282639,
290835,
282645,
241693,
282654,
241701,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
307278,
192596,
176213,
307287,
315482,
315483,
217179,
192605,
233567,
200801,
299105,
217188,
299109,
307303,
315495,
356457,
307307,
45163,
315502,
192624,
307314,
323700,
299126,
233591,
299136,
307329,
307338,
233613,
241813,
307352,
299164,
184479,
299167,
184481,
315557,
184486,
307370,
307372,
184492,
307374,
307376,
323763,
176311,
299191,
307385,
307386,
258235,
307388,
176316,
307390,
184503,
299200,
184512,
307394,
307396,
299204,
184518,
307399,
323784,
307409,
307411,
176343,
299225,
233701,
307432,
184572,
282881,
184579,
282893,
291089,
282906,
291104,
233766,
282931,
307508,
315701,
307510,
332086,
151864,
307512,
176435,
307515,
168245,
282942,
307518,
151874,
282947,
323917,
110926,
282957,
233808,
323921,
315733,
323926,
233815,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299388,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
315801,
291226,
242075,
283033,
291231,
61855,
283042,
291238,
291241,
194657,
127403,
127405,
127407,
291247,
299440,
299444,
127413,
283062,
291254,
194660,
127417,
291260,
283069,
127421,
127424,
299457,
127429,
127431,
176592,
315856,
315860,
176597,
283095,
127447,
299481,
176605,
242143,
291299,
340454,
242152,
291305,
127466,
176620,
127474,
291314,
291317,
135672,
233979,
291323,
127485,
291330,
283142,
127497,
233994,
135689,
291341,
233998,
127506,
234003,
234006,
127511,
152087,
283161,
242202,
234010,
135707,
135710,
242206,
242208,
291361,
242220,
291378,
152118,
234038,
234041,
315961,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
291456,
135808,
373383,
299655,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
225948,
135839,
299680,
225954,
135844,
299684,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
225998,
299726,
226002,
119509,
226005,
226008,
242396,
299740,
201444,
299750,
283368,
234219,
283372,
381677,
185074,
226037,
283382,
316151,
234231,
234236,
226045,
242431,
234239,
209665,
234242,
299778,
242436,
226053,
234246,
226056,
234248,
291593,
242443,
234252,
242445,
234254,
291601,
242450,
234258,
242452,
234261,
348950,
201496,
234264,
234266,
291608,
283421,
234269,
234272,
234274,
152355,
234278,
299814,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
283452,
160572,
234302,
234307,
242499,
234309,
316233,
234313,
316235,
234316,
283468,
242511,
234319,
234321,
234324,
201557,
185173,
234329,
234333,
308063,
234336,
234338,
349027,
242530,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
226171,
234364,
291711,
234368,
234370,
201603,
291714,
234373,
316294,
226182,
234375,
308105,
226185,
234379,
291716,
234384,
234388,
234390,
226200,
234393,
209818,
308123,
324504,
324508,
234396,
234398,
291742,
234401,
291747,
291748,
234405,
291750,
234407,
324520,
324518,
234410,
291754,
226220,
291756,
324522,
324527,
291760,
234417,
201650,
324531,
234414,
234422,
226230,
324536,
275384,
234428,
291773,
234431,
242623,
324544,
324546,
234434,
324548,
226245,
234437,
234439,
226239,
234443,
291788,
193486,
234446,
193488,
234449,
275406,
316370,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234475,
234478,
316400,
234481,
316403,
234484,
234485,
324599,
234487,
234490,
234493,
234496,
316416,
234501,
308231,
234504,
234507,
234510,
234515,
300054,
234519,
316439,
234520,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
144430,
234543,
234546,
275508,
234549,
300085,
300088,
234556,
234558,
316479,
234561,
308291,
316483,
234563,
234568,
234570,
316491,
300108,
234572,
234574,
300115,
234580,
234581,
242777,
234585,
275545,
234590,
234593,
234595,
300133,
234597,
234601,
300139,
234605,
160879,
234607,
275569,
234610,
300148,
234614,
398455,
144506,
234618,
275579,
234620,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
226453,
308373,
234647,
275608,
275606,
234650,
308379,
324757,
283805,
234653,
300189,
119967,
324766,
324768,
234657,
242852,
283813,
234661,
177318,
234664,
300197,
275626,
234667,
316596,
308414,
300223,
234687,
316610,
300226,
283844,
300229,
308420,
308422,
226500,
234692,
283850,
300234,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
300267,
161003,
300270,
300272,
120053,
300278,
316663,
275703,
300284,
275710,
300287,
300289,
292097,
161027,
300292,
300294,
275719,
177419,
300299,
283917,
242957,
300301,
177424,
349451,
275725,
349464,
415009,
283939,
259367,
283951,
292143,
300344,
226617,
243003,
283963,
226628,
283973,
300357,
177482,
283983,
316758,
357722,
316766,
316768,
292192,
218464,
292197,
316774,
243046,
218473,
284010,
324978,
136562,
275834,
333178,
275836,
275840,
316803,
316806,
226696,
316811,
226699,
316814,
226703,
300433,
234899,
226709,
357783,
316824,
316826,
144796,
300448,
144807,
144810,
144812,
284076,
144814,
144820,
284084,
284087,
292279,
144826,
144828,
144830,
144832,
284099,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
218597,
292329,
300523,
259565,
259567,
308720,
300527,
226802,
316917,
308727,
292343,
300537,
316933,
316947,
308757,
308762,
284191,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
284213,
194101,
284215,
316983,
194103,
284218,
226877,
284223,
284226,
284228,
292421,
226886,
284231,
128584,
243268,
284234,
366155,
317004,
276043,
284238,
226895,
284241,
292433,
284243,
276052,
284245,
300628,
284247,
317015,
235097,
243290,
284251,
276053,
284253,
300638,
284255,
284249,
243293,
284258,
292452,
292454,
284263,
177766,
284265,
292458,
284267,
292461,
284272,
284274,
276086,
284278,
292470,
292473,
284283,
276093,
284286,
276095,
284288,
292481,
284290,
325250,
284292,
292485,
276098,
292479,
284297,
317066,
284299,
317068,
276109,
284301,
284303,
284306,
276114,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
276137,
284329,
317098,
284331,
284333,
284335,
276144,
284337,
284339,
300726,
284343,
284346,
284350,
358080,
276160,
284354,
358083,
276166,
284358,
358089,
284362,
276170,
276175,
284368,
276177,
284370,
358098,
284372,
317138,
284377,
276187,
284379,
284381,
284384,
284386,
358114,
358116,
276197,
317158,
358119,
284392,
325353,
284394,
358122,
284397,
276206,
284399,
358126,
358128,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
284418,
317187,
358146,
317189,
317191,
284428,
300816,
300819,
317207,
284440,
186139,
300828,
300830,
276255,
325408,
300832,
300834,
284449,
317221,
227109,
358183,
186151,
276268,
300845,
194351,
243504,
300850,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
300872,
153417,
292681,
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,
317332,
399252,
350106,
284572,
276386,
284579,
276388,
358312,
284585,
317353,
276395,
292776,
292784,
276402,
358326,
161718,
276410,
276411,
358330,
276418,
276425,
301009,
301011,
301013,
292823,
301015,
301017,
358360,
292828,
276446,
153568,
276448,
276452,
276455,
292839,
350186,
292843,
276460,
276464,
178161,
276466,
227314,
276472,
325624,
350200,
317435,
276476,
276479,
276482,
350210,
276485,
317446,
178181,
276490,
350218,
292876,
350222,
317456,
276496,
317458,
243733,
317468,
243740,
317472,
325666,
243751,
292904,
276528,
178224,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
276544,
284739,
243779,
292934,
243785,
276553,
350293,
350295,
309337,
194649,
227418,
194654,
227423,
350302,
178273,
227426,
309346,
309348,
350308,
227430,
276583,
309350,
350313,
309352,
301163,
350316,
309354,
276590,
292968,
227440,
350321,
284786,
276595,
301167,
350325,
350328,
292985,
301178,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
276638,
350366,
284837,
153765,
350375,
350379,
350381,
350383,
129200,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
309450,
301258,
276685,
309455,
276689,
309462,
301272,
276699,
309468,
194780,
309471,
301283,
317672,
317674,
325867,
243948,
194801,
227571,
309491,
309494,
243960,
227583,
276735,
227587,
276739,
211204,
276742,
227593,
227596,
325910,
309530,
342298,
276766,
211232,
317729,
276775,
211241,
325937,
276789,
325943,
211260,
260421,
276809,
285002,
276811,
235853,
276816,
235858,
276829,
276833,
391523,
276836,
276843,
293227,
276848,
293232,
186744,
211324,
227709,
285061,
366983,
317833,
178572,
285070,
285077,
178583,
227738,
317853,
276896,
317858,
342434,
285093,
317864,
285098,
276907,
235955,
276917,
293304,
293307,
293314,
309707,
293325,
129486,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
227810,
293346,
276964,
293352,
236013,
293364,
301562,
293370,
317951,
309764,
301575,
121352,
236043,
317963,
342541,
55822,
113167,
317971,
309779,
309781,
277011,
55837,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
285236,
23094,
277054,
244288,
219714,
129603,
318020,
301636,
301639,
301643,
277071,
285265,
399955,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
309871,
121458,
277106,
170618,
170619,
309885,
309888,
277122,
227975,
285320,
277128,
301706,
318092,
326285,
334476,
318094,
277136,
277139,
227992,
318108,
285340,
318110,
227998,
137889,
383658,
285357,
318128,
277170,
342707,
154292,
277173,
318132,
293555,
285368,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
342745,
137946,
342747,
113378,
203491,
228069,
277223,
342760,
56041,
285417,
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,
277368,
15224,
236408,
416639,
416640,
113538,
310147,
416648,
39817,
187274,
277385,
301972,
424853,
277405,
277411,
310179,
293798,
293802,
236460,
277426,
276579,
293811,
293817,
293820,
203715,
326603,
342994,
276586,
293849,
293861,
228327,
228328,
228330,
318442,
228332,
326638,
277486,
351217,
318450,
293876,
293877,
285686,
302073,
285690,
244731,
121850,
293882,
302075,
293887,
277504,
277507,
277511,
277519,
293908,
293917,
293939,
318516,
277561,
277564,
310336,
7232,
293956,
277573,
228422,
310344,
277577,
293960,
277583,
203857,
310355,
293971,
310359,
236632,
277594,
138332,
277598,
285792,
203872,
277601,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
285817,
367737,
302205,
285821,
392326,
285831,
253064,
302218,
285835,
294026,
384148,
162964,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
302241,
285862,
277671,
302248,
64682,
277678,
294063,
294065,
302258,
277687,
294072,
318651,
294076,
277695,
318657,
244930,
302275,
130244,
302277,
228550,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
302296,
384222,
310498,
285927,
318698,
302315,
195822,
228592,
294132,
138485,
204023,
228601,
204026,
228606,
204031,
64768,
310531,
285958,
228617,
138505,
318742,
204067,
277798,
130345,
277801,
113964,
285997,
384302,
285999,
277804,
113969,
277807,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
417086,
277822,
286016,
302403,
294211,
384328,
277832,
277836,
146765,
326991,
277839,
277842,
277847,
277850,
179547,
277853,
146784,
277857,
302436,
277860,
294246,
327015,
310632,
327017,
351594,
277864,
277869,
277872,
351607,
310648,
277880,
310651,
277884,
277888,
310657,
310659,
351619,
294276,
327046,
277892,
253320,
310665,
318858,
277894,
277898,
277903,
310672,
351633,
277905,
277908,
277917,
310689,
277921,
130468,
228776,
277928,
277932,
310703,
277937,
310710,
130486,
310712,
277944,
310715,
277947,
302526,
228799,
277950,
277953,
64966,
245191,
163272,
302534,
310727,
277959,
277963,
302541,
277966,
302543,
310737,
277971,
286169,
228825,
163290,
277978,
310749,
277981,
277984,
310755,
277989,
277991,
187880,
277995,
310764,
286188,
278000,
228851,
310772,
278003,
278006,
40440,
212472,
278009,
40443,
286203,
310780,
40448,
228864,
286214,
228871,
302603,
65038,
302614,
286233,
302617,
302621,
187936,
146977,
286240,
187939,
40484,
294435,
40486,
286246,
286248,
40488,
278057,
40491,
245288,
294439,
294440,
310831,
294443,
294445,
40499,
212538,
40507,
40511,
40513,
228933,
40521,
286283,
40525,
40527,
400976,
212560,
228944,
40533,
147032,
40537,
40539,
278109,
40541,
40544,
40548,
40550,
286312,
286313,
40552,
40554,
310892,
40557,
40560,
188022,
122488,
294521,
343679,
310925,
286354,
278163,
302740,
122517,
278168,
179870,
327333,
229030,
212648,
278188,
302764,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
302793,
294601,
343757,
212690,
278227,
286420,
319187,
229076,
286425,
319194,
278235,
229086,
278238,
286432,
294625,
294634,
302838,
319226,
286460,
171774,
278274,
302852,
278277,
302854,
311048,
294664,
352008,
319243,
311053,
302862,
319251,
302872,
294682,
278306,
188199,
294701,
278320,
319280,
319290,
229192,
302925,
188247,
188252,
237409,
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,
278516,
311283,
278519,
237562
] |
2b139d4cf9abb96e1517a620eb8909f5f1638969
|
7b2ebcb132cf710e7b56fe850bc4c37d3f8399be
|
/ScienceJournal/PDFExport/PDFExportController.swift
|
8c865f3d7121102b0ae9ce3552ddff92db74798e
|
[
"Apache-2.0"
] |
permissive
|
sebromero/Arduino-Science-Journal-iOS
|
491727f5289472e91cc02ae147bc850a8448e992
|
abb2c47abee1a9607d6a5b8111826a04772a2170
|
refs/heads/main
| 2023-02-27T07:43:30.409034 | 2020-11-10T10:50:37 | 2020-11-10T10:50:37 | 311,975,843 | 0 | 0 |
Apache-2.0
| 2020-11-11T13:16:32 | 2020-11-11T13:16:32 | null |
UTF-8
|
Swift
| false | false | 7,718 |
swift
|
/*
* Copyright 2019 Google LLC. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import UIKit
import SnapKit
protocol PDFExportable {
var scrollView: UIScrollView { get }
}
// Takes a scroll viewable experiment view controller and exports its scroll view view hierarchy
// into a PDF along with a custom header.
final class PDFExportController: UIViewController {
// Specifies info for use in drawing the PDF export header.
struct HeaderInfo {
let title: String
let subtitle: String
let image: UIImage?
}
enum CompletionState {
case success(URL)
case error([Error])
case cancel(CancellationSource)
}
enum CancellationSource {
case user
case backgrounded
var analyticsLabel: String {
switch self {
case .user: return "User cancelled"
case .backgrounded: return "Backgrounded app"
}
}
}
private enum Metrics {
static let captureWidth: CGFloat = 500
static let progressUpdateInterval: TimeInterval = 0.1
}
typealias ContentViewController = UIViewController & PDFExportable
typealias CompletionHandler = (CompletionState) -> Void
var completionHandler: CompletionHandler?
private let analyticsReporter: AnalyticsReporter
private let overlayViewController: PDFExportOverlayViewController
private var progressTimer: Timer?
private var pdfExportOperation: PDFExportOperation?
/// The URL the PDF will be written to.
private var pdfURL = FileManager.default.temporaryDirectory
.appendingPathComponent("Experiment.pdf")
private let contentViewController: ContentViewController
private let operationQueue = GSJOperationQueue()
// MARK: - Public
init(contentViewController: ContentViewController, analyticsReporter: AnalyticsReporter) {
self.contentViewController = contentViewController
self.analyticsReporter = analyticsReporter
self.overlayViewController =
PDFExportOverlayViewController(analyticsReporter: analyticsReporter)
super.init(nibName: nil, bundle: nil)
overlayViewController.delegate = self
// If the user backgrounds the app while exporting, cancel the export since this requires
// crawling the UI and can be corrupted or broken by backgrounding in some cases.
NotificationCenter.default.addObserver(self,
selector: #selector(cancelBeforeBackgrounding),
name: UIApplication.willResignActiveNotification,
object: nil)
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) is not supported")
}
deinit {
NotificationCenter.default.removeObserver(self)
}
override public func viewDidLoad() {
super.viewDidLoad()
analyticsReporter.track(.pdfExportStarted)
setupContentViewController()
setupOverlayViewController()
}
override var preferredStatusBarStyle: UIStatusBarStyle {
return .lightContent
}
/// Start the PDF export. Call after controller has been presented. If no destinationURL is
/// provided, a suitable default will be used and returned in the completion handler.
func exportPDF(with headerInfo: HeaderInfo, to destinationURL: URL? = nil) {
if let destinationURL = destinationURL {
pdfURL = destinationURL
}
let pdfExportOperation = PDFExportOperation(contentViewController: contentViewController,
pdfHeaderInfo: headerInfo,
destinationURL: pdfURL)
pdfExportOperation.addObserver(BlockObserver(startHandler: operationStartHandler,
spawnHandler: nil,
finishHandler: operationFinishHandler))
self.pdfExportOperation = pdfExportOperation
operationQueue.addOperation(pdfExportOperation)
}
private func setupContentViewController() {
// Intentionally omitting addChild and didMove(toParent:) calls so as to prevent the
// contentViewController's navigation set-up from interfering with this controller's nav items.
view.addSubview(contentViewController.view)
contentViewController.view.translatesAutoresizingMaskIntoConstraints = true
contentViewController.view.autoresizingMask = []
var frameForCapturing = view.frame
frameForCapturing.size.width = Metrics.captureWidth
contentViewController.view.frame = frameForCapturing
}
private func setupOverlayViewController() {
overlayViewController.view.backgroundColor = .white
addChild(overlayViewController)
view.addSubview(overlayViewController.view)
overlayViewController.didMove(toParent: self)
overlayViewController.view.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
}
private func completion(state: CompletionState) {
DispatchQueue.main.async {
self.progressTimer?.invalidate()
self.progressTimer = nil
self.overlayViewController.progressView.progress = 1
}
pdfExportOperation = nil
func dismissWithCompletion(_ state: CompletionState) {
self.dismiss(animated: true, completion: {
self.completionHandler?(state)
})
}
switch state {
case .success:
analyticsReporter.track(.pdfExportCompleted)
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
// Give the UI a moment to update progress to 100%, which _feels_ better.
dismissWithCompletion(state)
}
case .cancel(let cancellationSource):
analyticsReporter.track(.pdfExportCancelled(reason: cancellationSource.analyticsLabel))
dismissWithCompletion(state)
case .error:
analyticsReporter.track(.pdfExportError)
dismissWithCompletion(state)
}
}
private func reportSuccess() {
completion(state: .success(pdfURL))
}
@objc private func cancelBeforeBackgrounding() {
operationQueue.cancelAllOperations()
completion(state: .cancel(.backgrounded))
}
private func cancelAndReport() {
operationQueue.cancelAllOperations()
completion(state: .cancel(.user))
}
private func reportErrors(_ errors: [Error]) {
completion(state: .error(errors))
}
private func operationStartHandler(operation: GSJOperation) {
DispatchQueue.main.async {
self.overlayViewController.progressView.indicatorMode = .determinate
self.progressTimer = Timer.scheduledTimer(withTimeInterval: Metrics.progressUpdateInterval,
repeats: true,
block: { (_) in
guard let pdfExportOperation = self.pdfExportOperation else { return }
self.overlayViewController.progressView.progress = Float(pdfExportOperation.progress)
})
}
}
private func operationFinishHandler(operation: GSJOperation, errors: [Error]) {
if errors.isEmpty {
reportSuccess()
} else {
reportErrors(errors)
}
}
}
// MARK: - PDFExportOverlayViewControllerDelegate
extension PDFExportController: PDFExportOverlayViewControllerDelegate {
func pdfExportShouldCancel() {
cancelAndReport()
}
}
|
[
-1
] |
092f68ebebae1a06f1a79a2f1d0fb53f25d843b8
|
00a29de5a32071fabb1442eca589878dcd952bce
|
/collectionViewGrid/collectionViewGrid/CollectionViewDataSource.swift
|
342bb9ca1b3f13aee4df786d2d0c0ad1d6c9913d
|
[] |
no_license
|
marinacompsci/hacking_with_swift_uikit
|
ac7ff4ca46cab0840d5c655c8ee91fe5a8df5ace
|
13d08ae984d5032e71790683bc0f293343d1c77d
|
refs/heads/master
| 2023-02-07T00:12:56.333896 | 2020-12-28T21:03:22 | 2020-12-28T21:03:22 | 301,793,033 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 814 |
swift
|
//
// CollectionViewDataSource.swift
// collectionViewGrid
//
// Created by Marina Beatriz Santana de Aguiar on 04.07.20.
// Copyright © 2020 Marina Beatriz Santana de Aguiar. All rights reserved.
//
import UIKit
class CollectionViewDataSource: NSObject, UICollectionViewDataSource {
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return 2
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: CollectionViewCell.reuseIdentfier, for: indexPath) as! CollectionViewCell
return cell
}
func numberOfSections(in collectionView: UICollectionView) -> Int {
10
}
}
|
[
-1
] |
57fe37ab10e56dd9a4c9c2bfad7b29379190a1fb
|
3d144a23e67c839a4df1c073c6a2c842508f16b2
|
/validation-test/compiler_crashers_fixed/01354-getselftypeforcontainer.swift
|
a96e69400ed12a9664c5489a24173e209fcc5665
|
[
"Apache-2.0",
"Swift-exception"
] |
permissive
|
apple/swift
|
c2724e388959f6623cf6e4ad6dc1cdd875fd0592
|
98ada1b200a43d090311b72eb45fe8ecebc97f81
|
refs/heads/main
| 2023-08-16T10:48:25.985330 | 2023-08-16T09:00:42 | 2023-08-16T09:00:42 | 44,838,949 | 78,897 | 15,074 |
Apache-2.0
| 2023-09-14T21:19:23 | 2015-10-23T21:15:07 |
C++
|
UTF-8
|
Swift
| false | false | 664 |
swift
|
// This source file is part of the Swift.org open source project
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
// RUN: not %target-swift-frontend %s -typecheck
class c : a {
if true as a<T>) -> S.d: T>? = A.b = c(self.startIndex, U, let c {
}
public subscript () -> : A) {
}
protocol a {
protocol A {
func b..Type) + seq: C> T : U) {
self.advance(n: Array<T>(("
typealias f : b = b.startIndex, f<Y> {
class a"
}
typealias A {
|
[
96642,
78723,
77187,
93575,
79369,
95241,
92939,
96009,
93325,
93713,
95762,
96401,
80404,
77207,
91671,
94361,
75546,
92187,
79132,
92189,
78878,
93850,
77600,
93853,
94113,
95779,
76452,
79397,
93095,
75566,
93615,
92850,
91699,
77364,
95669,
80055,
77755,
96572,
96317,
92352,
94150,
95430,
80331,
95565,
95693,
79824,
96539,
95571,
78037,
96471,
79449,
96601,
91867,
93020,
80223,
75360,
77924,
78440,
92904,
79466,
94441,
91885,
75630,
79342,
92013,
94062,
96111,
76533,
92021,
95095,
95480,
76794,
94203,
93695
] |
2cb37eb6df6310d2f94330c2c0ce151c984fff1e
|
ac8ba0306dc6269944ce69e66382dde8f77a8723
|
/Samples/miniirc/Helpers.swift
|
d515f7b6dc863d537ab78b243609a2e16625476f
|
[
"MIT"
] |
permissive
|
NozeIO/Noze.io
|
6766adc41c5fc7dd5b3802099f867e92b3887aec
|
983cedfbe97cd592c4a2f59c69604bb1433895b3
|
refs/heads/master
| 2023-07-05T05:27:49.570480 | 2021-11-09T13:28:49 | 2021-11-09T13:28:49 | 60,307,958 | 341 | 17 | null | 2019-11-25T09:54:36 | 2016-06-03T01:09:13 |
Swift
|
UTF-8
|
Swift
| false | false | 597 |
swift
|
// Noze.io: miniirc
// MARK: - String Helpers
extension Collection where Iterator.Element : Equatable {
func index(of v: Self.Iterator.Element, from: Self.Index) -> Index? {
var idx = from
while idx != endIndex {
if self[idx] == v {
return idx
}
idx = self.index(after: idx)
}
return nil
}
}
extension String {
func split(_ c: Character) -> [ String ] {
#if swift(>=3.2)
return self.split(separator: c).map { String($0) }
#else
return self.characters.split(separator: c).map { String($0) }
#endif
}
}
|
[
-1
] |
edb5d7d9c071351d085860d78b47d9539f458226
|
243b898a0685fc1c4073fa49c9e738e6da36917e
|
/CalculadoraUITests/CalculadoraUITests.swift
|
ab74418c88d5b7d644333acb4ae8e574a0c45b19
|
[] |
no_license
|
joseatrejos/iOSCalculadoraPropinas
|
58a46c231bcc576b641b3f2101f3f548a8e97125
|
636d09853417f7a8fcdb58d441c2404c34e70692
|
refs/heads/master
| 2020-07-02T13:27:15.070565 | 2019-08-12T21:47:10 | 2019-08-12T21:47:10 | 201,536,491 | 1 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 1,247 |
swift
|
//
// CalculadoraUITests.swift
// CalculadoraUITests
//
// Created by Alumno on 07/08/19.
// Copyright © 2019 Alumno. All rights reserved.
//
import XCTest
class CalculadoraUITests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
// In UI tests it is usually best to stop immediately when a failure occurs.
continueAfterFailure = false
// UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
XCUIApplication().launch()
// In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
}
|
[
333827,
243720,
282634,
313356,
155665,
305173,
237599,
241695,
292901,
223269,
229414,
354342,
315433,
354346,
325675,
278571,
315431,
124974,
282671,
102446,
229425,
102441,
243763,
313388,
241717,
321589,
180279,
229431,
215095,
319543,
213051,
288829,
325695,
286787,
288835,
307269,
237638,
313415,
239689,
233548,
311373,
315468,
278607,
333902,
311377,
354386,
196687,
329812,
315477,
223317,
285362,
354394,
200795,
323678,
315488,
321632,
315489,
45154,
280676,
313446,
227432,
215144,
307306,
194667,
233578,
278637,
288878,
319599,
278642,
284789,
131190,
284790,
288890,
292987,
215165,
131199,
227459,
194692,
235661,
278669,
241809,
323730,
278676,
311447,
153752,
327834,
284827,
278684,
329884,
299166,
278690,
311459,
215204,
233635,
284840,
299176,
278698,
284843,
184489,
278703,
323761,
184498,
278707,
125108,
278713,
180409,
295099,
258233,
299197,
280761,
280767,
223418,
227517,
299202,
139459,
309443,
176325,
131270,
301255,
227525,
299208,
280779,
233678,
282832,
227536,
321744,
301270,
229591,
301271,
280792,
311520,
325857,
334049,
280803,
182503,
319719,
307431,
338151,
295147,
317676,
286957,
125166,
125170,
313595,
125180,
184574,
125184,
309504,
217352,
125192,
125197,
194832,
227601,
325904,
125200,
125204,
319764,
278805,
334104,
315674,
282908,
311582,
299294,
125215,
282912,
233761,
278817,
211239,
282920,
125225,
317738,
311596,
321839,
315698,
98611,
125236,
332084,
307514,
278843,
282938,
168251,
287040,
319812,
332100,
280903,
227655,
319816,
323914,
201037,
282959,
229716,
289109,
168280,
379224,
323934,
332128,
391521,
239973,
381286,
313703,
285031,
416103,
280938,
242027,
242028,
321901,
354671,
278895,
287089,
199030,
227702,
315768,
315769,
291194,
223611,
248188,
139641,
313726,
311679,
211327,
291200,
291193,
240003,
158087,
313736,
227721,
242059,
311692,
285074,
227730,
240020,
190870,
315798,
190872,
291225,
317851,
293275,
285083,
242079,
227743,
289185,
293281,
283039,
305572,
285089,
300490,
156069,
301482,
311723,
289195,
377265,
338359,
299449,
311739,
319931,
293309,
278974,
311744,
317889,
291266,
278979,
326083,
278988,
289229,
281038,
326093,
281039,
278992,
283088,
283089,
279000,
176602,
242138,
285152,
279009,
291297,
369121,
195044,
160224,
279014,
242150,
319976,
279017,
188899,
311787,
281071,
319986,
236020,
279030,
311800,
279033,
317949,
283138,
279042,
233987,
287237,
377352,
322057,
309770,
342537,
279053,
283154,
303634,
182802,
279061,
303635,
188954,
279066,
322077,
291359,
227881,
293420,
236080,
283185,
279092,
234037,
23093,
244279,
244280,
338491,
234044,
301635,
309831,
55880,
322119,
377419,
303693,
281165,
301647,
281170,
326229,
309847,
189016,
115287,
332379,
111197,
295518,
287327,
242274,
244326,
279143,
279150,
281200,
287345,
313970,
287348,
301688,
244345,
189054,
287359,
297600,
303743,
291455,
301702,
164487,
311944,
334473,
279176,
316044,
311948,
184974,
311950,
316048,
311953,
316050,
287379,
326288,
227991,
295575,
289435,
303772,
205469,
221853,
285348,
314020,
279207,
295591,
295598,
279215,
285360,
318127,
299698,
248494,
287412,
166581,
293552,
154295,
164532,
342705,
303802,
314043,
287418,
66243,
291529,
287434,
225996,
363212,
287438,
242385,
303826,
279253,
158424,
230105,
299737,
322269,
342757,
295653,
289511,
230120,
330473,
234216,
285419,
330476,
289517,
279278,
312046,
170735,
215790,
125683,
230133,
199415,
234233,
242428,
279293,
205566,
322302,
289534,
299777,
291584,
228099,
285443,
291591,
295688,
322312,
285450,
264971,
312076,
326413,
322320,
285457,
295698,
166677,
291605,
283418,
285467,
326428,
221980,
281378,
234276,
283431,
262952,
262953,
279337,
293673,
289580,
262957,
318247,
164655,
301872,
242481,
234290,
303921,
318251,
285493,
230198,
328495,
285496,
301883,
201534,
281407,
289599,
295745,
222017,
342846,
293702,
318279,
283466,
281426,
279379,
295769,
201562,
244569,
281434,
322396,
230238,
230239,
301919,
279393,
293729,
275294,
349025,
281444,
279398,
303973,
351078,
177002,
308075,
242540,
310132,
295797,
201590,
207735,
228214,
295799,
279418,
269179,
177018,
308093,
314240,
291713,
158594,
240517,
287623,
228232,
299912,
279434,
320394,
316299,
416649,
252812,
308111,
189327,
308113,
234382,
293780,
310166,
289691,
209820,
277404,
240543,
283551,
310177,
289699,
189349,
289704,
279465,
293801,
326571,
304050,
177074,
326580,
289720,
326586,
289723,
189373,
213956,
281541,
19398,
345030,
213961,
279499,
56270,
191445,
183254,
304086,
183258,
234469,
314343,
304104,
324587,
183276,
289773,
320492,
203758,
320495,
234476,
287730,
277493,
240631,
320504,
312313,
214009,
312315,
312317,
328701,
328705,
234499,
293894,
320520,
230411,
320526,
330766,
234513,
238611,
140311,
293911,
316441,
197658,
238617,
132140,
113710,
189487,
281647,
322609,
312372,
203829,
238646,
300087,
238650,
320571,
21567,
308288,
336962,
160834,
314437,
349254,
238663,
300109,
207954,
234578,
296023,
205911,
314458,
156763,
277600,
281698,
281699,
285795,
214116,
230500,
322664,
228457,
279659,
318571,
234606,
300145,
238706,
279666,
312435,
187508,
230514,
300147,
302202,
285819,
314493,
285823,
150656,
234626,
279686,
222344,
285833,
285834,
318602,
228492,
337037,
234635,
177297,
162962,
187539,
326803,
308375,
324761,
285850,
296091,
119965,
302239,
300192,
234655,
339106,
306339,
234662,
300200,
249003,
238764,
322733,
208044,
3243,
302251,
279729,
294069,
300215,
294075,
64699,
228541,
283841,
283846,
312519,
283849,
148687,
290001,
189651,
316628,
279766,
189656,
279775,
304352,
298209,
304353,
310496,
279780,
228587,
279789,
290030,
302319,
251124,
316661,
283894,
234741,
208123,
292092,
279803,
228608,
320769,
234756,
322826,
242955,
177420,
312588,
318732,
126229,
318746,
245018,
320795,
320802,
130342,
304422,
130344,
292145,
298290,
312628,
300342,
159033,
333114,
222523,
333115,
286012,
279872,
181568,
279874,
300355,
294210,
216387,
286019,
193858,
300354,
304457,
230730,
372039,
294220,
296269,
222542,
234830,
238928,
224591,
296274,
314708,
318804,
283990,
314711,
357720,
300378,
300379,
294236,
234330,
316764,
314721,
292194,
230757,
281958,
314727,
134504,
306541,
327023,
296304,
234864,
312688,
316786,
314740,
230772,
327030,
284015,
314742,
314745,
310650,
290170,
224637,
306558,
290176,
243073,
179586,
306561,
314752,
294278,
314759,
296328,
296330,
298378,
368012,
318860,
314765,
304523,
292242,
112019,
306580,
279955,
224662,
234902,
282008,
314776,
314771,
318876,
282013,
290206,
148899,
314788,
298406,
282023,
314790,
245160,
333224,
241067,
279979,
314797,
279980,
286128,
279988,
173492,
284086,
286133,
284090,
302523,
228796,
310714,
54719,
302530,
280003,
228804,
310725,
306630,
292291,
300488,
415170,
370122,
310731,
306634,
280011,
302539,
310735,
339403,
329168,
222674,
327122,
280020,
329170,
234957,
312785,
280025,
310747,
239069,
144862,
286176,
187877,
320997,
310758,
280042,
280043,
191980,
329198,
337391,
300526,
282097,
308722,
296434,
306678,
40439,
288248,
191991,
286201,
300539,
288252,
312830,
290304,
286208,
245249,
228868,
292359,
218632,
323079,
302602,
230922,
323083,
294413,
304655,
323088,
329231,
282132,
230933,
302613,
282135,
316951,
374297,
302620,
313338,
282147,
222754,
306730,
245291,
312879,
230960,
288305,
239159,
290359,
323132,
235069,
157246,
288319,
288322,
280131,
349764,
310853,
282182,
124486,
288328,
194118,
286281,
292426,
333389,
224848,
224852,
290391,
128600,
306777,
196184,
235096,
239192,
212574,
345697,
204386,
300643,
300645,
282214,
312937,
224874,
243306,
204394,
312941,
206447,
310896,
294517,
314997,
288377,
290425,
325246,
333438,
235136,
280193,
282244,
239238,
288391,
282248,
286344,
323208,
179853,
286351,
188049,
229011,
239251,
280217,
323226,
179868,
229021,
302751,
282272,
198304,
282279,
298664,
212649,
298666,
317102,
286387,
300725,
337590,
286392,
300729,
302778,
306875,
280252,
280253,
282302,
296636,
286400,
323265,
323262,
280259,
321217,
282309,
321220,
333508,
239305,
280266,
306891,
296649,
212684,
302798,
9935,
241360,
282321,
313042,
286419,
241366,
280279,
282330,
18139,
280285,
294621,
282336,
321250,
294629,
153318,
333543,
181992,
12009,
337638,
282347,
288492,
282349,
323315,
67316,
34547,
286457,
284410,
288508,
200444,
282366,
286463,
319232,
278273,
288515,
280326,
282375,
323335,
284425,
300810,
116491,
282379,
280333,
216844,
300812,
284430,
161553,
124691,
284436,
278292,
116502,
118549,
282390,
278294,
325403,
321308,
321309,
282399,
241440,
282401,
325411,
315172,
186149,
186148,
241447,
333609,
286507,
294699,
284460,
280367,
300849,
282418,
280373,
282424,
280377,
321338,
319289,
282428,
280381,
345918,
413500,
241471,
280386,
280391,
153416,
315209,
325449,
159563,
280396,
307024,
317268,
237397,
307030,
18263,
241494,
188250,
284508,
300893,
307038,
237411,
284515,
276326,
282471,
296807,
292713,
282476,
292719,
296815,
313200,
325491,
313204,
333687,
317305,
124795,
317308,
339840,
315265,
280451,
327556,
188293,
243590,
282503,
67464,
305032,
325514,
315272,
315275,
243592,
184207,
311183,
124816,
279218,
282517,
294806,
214936,
294808,
337816,
239515,
214943,
298912,
319393,
333727,
294820,
333734,
219046,
284584,
294824,
298921,
313257,
292783,
126896,
200628,
300983,
343993,
288698,
98240,
294849,
214978,
280517,
280518,
214983,
282572,
282573,
153553,
24531,
231382,
329696,
323554,
292835,
6116,
190437,
292838,
294887,
317416,
313322,
278507,
298987,
311277,
296942,
329707,
124912,
327666,
278515,
325620,
239610
] |
953ee101b51df6a8def3993f2cba7eea0cb18e7e
|
3f479c66ba76278ce540dfdf10f7bb6fa3ee506c
|
/EventNotifier.playground/Contents.swift
|
9c2a3c6494ddb3b889dc4ad3d1910a4d00d3e4cc
|
[] |
no_license
|
razelkayamdev/EventNotifier
|
97872fe76687327ac1b5b5660cd84dad8aa946c9
|
6cc6329d844ed087f9efd8122551c76031932015
|
refs/heads/master
| 2022-11-14T16:49:27.148917 | 2020-07-07T05:29:31 | 2020-07-07T05:29:31 | 277,724,920 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 2,017 |
swift
|
import Foundation
/// `EventNotifier` lets you easily create a "event notifier" for a given protocol or class.
public final class EventNotifier<T> {
/// The listeners hash table.
private let listeners = NSHashTable<AnyObject>.weakObjects()
/// Use the property to check if no listeners are contained there.
///
/// - Returns: `true` if there are no listeners at all, `false` if there is at least one.
public var isEmpty: Bool {
return listeners.allObjects.count == 0
}
/// Use this method to add a listener.
///
/// - Parameter listener: The listener to be added.
public func addListener(_ listener: T) {
listeners.add(listener as AnyObject)
}
/// Use this method to remove a previously-added listener.
///
/// - Parameter listener: The listener to be removed.
public func removeListener(_ listener: T) {
listeners.remove(listener as AnyObject)
}
/// Use this method to invoke a closure on each listener.
///
/// - Parameter invocation: The closure to be invoked on each listener.
public func invoke(_ invocation: (T) -> Void) {
for listener in listeners.allObjects {
invocation(listener as! T) // swiftlint:disable:this force_cast
}
}
/// Use this method to determine if the multicast listener contains a given listener.
///
/// - Parameter listener: The given listener to check if it's contained
/// - Returns: `true` if the listener is found or `false` otherwise
public func containsListener(_ listener: T) -> Bool {
return listeners.contains(listener as AnyObject)
}
}
// WORKING EXAMPLE
protocol Foo {
func bar()
}
struct Example: Foo {
func bar() {
print("bar")
}
}
let notifier = EventNotifier<Foo>()
let example = Example()
notifier.addListener(example)
notifier.invoke { (obj) in
obj.bar()
}
print(notifier.isEmpty)
|
[
-1
] |
4a3795efe9ae1cbe6788e99ce45ac3f8ce3a1ef0
|
53c0984ae80b1684b251fd183d0235865301d8b8
|
/BLE-ScannerTests/RSSI_AngleCalculation_Tests.swift
|
7deb2d7717a75d2429d0b0640e53d2a1896dddfb
|
[
"CC-BY-3.0"
] |
permissive
|
ocakgun/BTLEmap
|
903b6af4e0c31a86e1bbe18dc46810f27a80f79d
|
c3c2c147ec244c9f7da19d7bcba7dea41ffcd509
|
refs/heads/master
| 2022-11-18T16:00:10.729339 | 2020-07-09T13:07:29 | 2020-07-09T13:07:29 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 4,439 |
swift
|
//
// RSSI_AngleCalculation_Tests.swift
// BLE-ScannerTests
//
// Created by Alex - SEEMOO on 09.04.20.
// Copyright © 2020 SEEMOO - TU Darmstadt. All rights reserved.
//
import BLETools
import XCTest
@testable import BLE_Scanner
class RSSI_AngleCalculation_Tests: XCTestCase {
var measurement1: [RSSIAngle] {
let fileURL = Bundle(for: self.classForCoder).url(
forResource: "rssi_measurement_1", withExtension: "csv")!
let csvString = String(data: try! Data(contentsOf: fileURL), encoding: .utf8)!
return RSSI_AngleCalculation_Tests.parseCSVToRSSIs(csvString)
}
var measurement2: [RSSIAngle] {
let fileURL = Bundle(for: self.classForCoder).url(
forResource: "rssi_measurement_2", withExtension: "csv")!
let csvString = String(data: try! Data(contentsOf: fileURL), encoding: .utf8)!
return RSSI_AngleCalculation_Tests.parseCSVToRSSIs(csvString)
}
var measurement3: [RSSIAngle] {
let fileURL = Bundle(for: self.classForCoder).url(
forResource: "rssi_measurement_3", withExtension: "csv")!
let csvString = String(data: try! Data(contentsOf: fileURL), encoding: .utf8)!
return RSSI_AngleCalculation_Tests.parseCSVToRSSIs(csvString)
}
var measurement4: [RSSIAngle] {
let fileURL = Bundle(for: self.classForCoder).url(
forResource: "rssi_measurement_4", withExtension: "csv")!
let csvString = String(data: try! Data(contentsOf: fileURL), encoding: .utf8)!
return RSSI_AngleCalculation_Tests.parseCSVToRSSIs(csvString)
}
static func parseCSVToRSSIs(_ csv: String) -> [RSSIAngle] {
var rssis = [RSSIAngle]()
csv.split(separator: "\n").dropFirst().enumerated().forEach { (idx, line) in
let entries = line.split(separator: ";").map({ $0.trimmingCharacters(in: .whitespaces) }
)
rssis.append(RSSIAngle(idx: idx, value: Float(entries[2])!, angle: Double(entries[1])!))
}
return rssis
}
func testAngleMeasurement1() {
let rssis = self.measurement1
print("Calculating angle with \(rssis.count) measurements")
let average = AngleCalculation.calculateAverageRSSI(with: rssis)
let angleNormal = AngleCalculation.calculateAngle(with: rssis, and: average)
let angleOpposite = AngleCalculation.calculateAngleOpposite(with: rssis, and: average)
// let actualAngle =
let angleRange = -.pi...Double.pi
XCTAssert(angleRange.contains(angleNormal))
XCTAssert(angleRange.contains(angleOpposite))
}
//Expected angle is known
func testMeasurement3() {
let expectedAngle = -0.4369782409475728
let rssis = self.measurement3
print("Calculating angle with \(rssis.count) measurements")
let average = AngleCalculation.calculateAverageRSSI(with: rssis)
let angleNormal = AngleCalculation.calculateAngle(with: rssis, and: average)
let angleOpposite = AngleCalculation.calculateAngleOpposite(with: rssis, and: average)
// let actualAngle =
let angleRange = -.pi...Double.pi
XCTAssert(angleRange.contains(angleNormal))
XCTAssert(angleRange.contains(angleOpposite))
//Detect which algorithm is better
XCTAssertEqual(angleOpposite, expectedAngle, accuracy: 5.0 * .pi / 180.0)
XCTAssertEqual(angleNormal, expectedAngle, accuracy: 5.0 * .pi / 180.0)
}
func testMeasurement4() {
let expectedAngle = 1.201191306175151
let rssis = self.measurement4
print("Calculating angle with \(rssis.count) measurements")
let average = AngleCalculation.calculateAverageRSSI(with: rssis)
let angleNormal = AngleCalculation.calculateAngle(with: rssis, and: average)
let angleOpposite = AngleCalculation.calculateAngleOpposite(with: rssis, and: average)
// let actualAngle =
let angleRange = -.pi...Double.pi
XCTAssert(angleRange.contains(angleNormal))
XCTAssert(angleRange.contains(angleOpposite))
//Detect which algorithm is better
XCTAssertEqual(angleOpposite, expectedAngle, accuracy: 5.0 * .pi / 180.0)
XCTAssertEqual(angleNormal, expectedAngle, accuracy: 5.0 * .pi / 180.0)
}
}
|
[
-1
] |
b69ba4c254210e02b2f23a25d56019a6a6478c94
|
ce159d57d7c5c7695b34b2ff3c7452d607403427
|
/Сustomer/SplashViewController.swift
|
cab595c6d5d70737b346007fb68b1dc8e40032c1
|
[] |
no_license
|
Rphaet0n/WishMaker
|
30b253d5b5ac84bba6075390004109b692818f48
|
e463d3f9c37fa774b1c7b27ff25e37ee2b57dbfa
|
refs/heads/master
| 2021-01-20T00:30:29.500785 | 2017-05-13T08:33:24 | 2017-05-13T08:33:24 | 89,145,726 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 1,139 |
swift
|
//
// SplashViewController.swift
// WishMaker
//
// Created by student on 10.05.17.
// Copyright © 2017 Company. All rights reserved.
//
import UIKit
class SplashViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
}
fileprivate func goToLogin () {
self.performSegue(withIdentifier: "toLogin", sender: self)
}
fileprivate func proceed() {
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
|
[
-1
] |
fb15e167486346a18b756502968f4ac760c3de94
|
4be80f1c845ed2d04b54b34a8ae1d84ac897b8ab
|
/LeanCafeTimerTests/LeanCafeTimerTests.swift
|
01a658d3b5090ab4a047234aaa31acf357204333
|
[] |
no_license
|
tjcardoso/LeanCafeTimer
|
60ea0bed7bfd46746cd55185ba7cfbc33060c6b3
|
766412a982dfbee7686bb52bcd0e923265da9ae9
|
refs/heads/master
| 2021-01-20T19:52:38.287322 | 2016-07-01T02:49:44 | 2016-07-01T02:49:44 | 61,063,214 | 0 | 0 | null | 2016-06-28T01:43:47 | 2016-06-13T19:18:16 |
Swift
|
UTF-8
|
Swift
| false | false | 994 |
swift
|
//
// LeanCafeTimerTests.swift
// LeanCafeTimerTests
//
// Created by Todd Cardoso on 2016-06-13.
// Copyright © 2016 TJC. All rights reserved.
//
import XCTest
@testable import LeanCafeTimer
class LeanCafeTimerTests: 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.
}
}
}
|
[
98333,
278558,
16419,
229413,
204840,
278570,
360491,
344107,
155694,
253999,
229424,
229430,
319542,
180280,
213052,
286788,
352326,
254027,
311372,
196691,
278615,
180311,
180312,
237663,
131178,
278634,
278638,
319598,
352368,
131189,
237689,
131198,
278655,
311435,
311438,
278670,
278677,
278685,
311458,
278691,
49316,
196773,
278699,
32941,
278704,
278708,
131256,
278714,
295098,
254170,
229597,
286958,
327929,
278797,
180493,
254226,
319763,
278810,
278816,
262450,
98610,
278842,
287041,
311621,
139589,
319813,
319821,
254286,
344401,
278869,
155990,
106847,
246127,
139640,
246136,
246137,
311681,
246178,
377264,
278961,
278965,
278970,
33211,
319930,
336317,
278978,
188871,
278989,
278993,
278999,
328152,
369116,
188894,
287198,
279008,
279013,
279018,
311786,
279022,
279029,
279032,
279039,
287241,
279050,
303631,
279057,
279062,
279065,
180771,
377386,
279094,
352829,
115270,
295519,
66150,
279144,
344680,
279146,
295536,
287346,
287352,
279164,
189057,
303746,
311941,
279177,
369289,
344715,
311949,
352917,
295576,
230040,
271000,
303771,
221852,
279206,
295590,
287404,
205487,
295599,
303793,
279217,
164533,
287417,
287422,
66242,
287439,
279252,
287452,
295652,
279269,
279280,
230134,
221948,
279294,
205568,
295682,
295697,
336671,
344865,
279336,
262954,
295724,
353069,
312108,
164656,
303920,
262962,
328499,
353078,
230199,
353079,
336702,
353094,
353095,
353109,
230234,
295776,
279392,
303972,
230248,
246641,
246648,
279417,
361337,
254850,
287622,
213894,
295824,
279456,
189348,
279464,
353195,
140204,
353197,
304051,
287677,
189374,
353216,
213960,
279498,
50143,
123881,
304110,
320494,
287731,
295927,
304122,
320507,
328700,
328706,
320516,
230410,
320527,
418837,
140310,
230423,
320536,
197657,
238623,
336929,
189474,
345132,
238639,
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,
279814,
312587,
328971,
173334,
320796,
304421,
279854,
345396,
116026,
222524,
279875,
304456,
230729,
222541,
296270,
238927,
296273,
222559,
230756,
230765,
296303,
279920,
312689,
296307,
116084,
181625,
378244,
230799,
296335,
9619,
279974,
279984,
173491,
279989,
296375,
296387,
296391,
296392,
361927,
280010,
370123,
148940,
280013,
312782,
222675,
329173,
353750,
280032,
280041,
296425,
361963,
321009,
280055,
288249,
230921,
329225,
296461,
149007,
304656,
329232,
230943,
230959,
288309,
288318,
280130,
124485,
288326,
288327,
280147,
239198,
222832,
247416,
337535,
239237,
288392,
239250,
345752,
255649,
198324,
296628,
321207,
296632,
280251,
280257,
321219,
280267,
9936,
9937,
280278,
280280,
18138,
67292,
321247,
313065,
280300,
239341,
419569,
313081,
124669,
288512,
288516,
280327,
280329,
321302,
116505,
321310,
247590,
280366,
296755,
280372,
321337,
280380,
345919,
280390,
280392,
345929,
304977,
18262,
280410,
370522,
345951,
362337,
345955,
296806,
288619,
288620,
280430,
296814,
362352,
313203,
124798,
182144,
305026,
67463,
329622,
124824,
214937,
214938,
247712,
354212,
124852,
288697,
214977,
280514,
280519,
247757,
231375,
280541,
329695,
337895,
247785,
296941,
362480,
313339,
313357,
182296,
305179,
313375,
354343,
354345,
223274,
124975,
346162,
124984,
288828,
288833,
288834,
280649,
354385,
223316,
280661,
223318,
329814,
338007,
288857,
354393,
280675,
280677,
329829,
313447,
288879,
223350,
280694,
288889,
215164,
313469,
215166,
280712,
215178,
141450,
346271,
239793,
125109,
182456,
280762,
223419,
379071,
338119,
280778,
321745,
280795,
280802,
338150,
321772,
125169,
338164,
157944,
125183,
125188,
313608,
125193,
125198,
125203,
125208,
305440,
125217,
125235,
280887,
125240,
280902,
182598,
289110,
305495,
272729,
379225,
321894,
280939,
313713,
354676,
280961,
362881,
248194,
395659,
395661,
240016,
190871,
289189,
289194,
108972,
281040,
281072,
223767,
289304,
223769,
182817,
338490,
322120,
281166,
281171,
354911,
436832,
191082,
313966,
281199,
330379,
133774,
330387,
330388,
117397,
289434,
338613,
166582,
314040,
158394,
199366,
363211,
289502,
363230,
338662,
346858,
330474,
289518,
199414,
35583,
363263,
322313,
322319,
166676,
207640,
289576,
289598,
281408,
420677,
281427,
281433,
330609,
207732,
158593,
240518,
289698,
289703,
289727,
363458,
19399,
52172,
183248,
338899,
248797,
207838,
314342,
52200,
289774,
183279,
314355,
240630,
314362,
134150,
322570,
330763,
281625,
281626,
175132,
248872,
322612,
207938,
314448,
281697,
314467,
281700,
322663,
207979,
363644,
150657,
248961,
330888,
339102,
330913,
306338,
249002,
281771,
208058,
339130,
322749,
290000,
363744,
298212,
290022,
330984,
298228,
216315,
208124,
363771,
388349,
322824,
126237,
339234,
199971,
298291,
224586,
372043,
314709,
224606,
314720,
142689,
281957,
281962,
134506,
314739,
290173,
306559,
298374,
314758,
281992,
142729,
314760,
388487,
314766,
306579,
282007,
290207,
314783,
314789,
282022,
282024,
241066,
380357,
306631,
306639,
191981,
306673,
306677,
191990,
290300,
290301,
282114,
306692,
306693,
323080,
192010,
323087,
282129,
282136,
282141,
282146,
306723,
290358,
282183,
290390,
306776,
282213,
323178,
314998,
175741,
192131,
224901,
282246,
282245,
290443,
323217,
282259,
282271,
282273,
282276,
298661,
323236,
290471,
282280,
298667,
282303,
282312,
306890,
282318,
241361,
241365,
298712,
216795,
298720,
282339,
12010,
282348,
282358,
175873,
323331,
323332,
216839,
249626,
282400,
241441,
339745,
257830,
159533,
282417,
282427,
282434,
307011,
315202,
282438,
323406,
307025,
413521,
216918,
307031,
282474,
282480,
241528,
241540,
282504,
315273,
315274,
110480,
184208,
282518,
282519,
44952,
118685,
298909,
298920,
282549,
290746,
298980,
282612,
290811,
282633,
241692,
307231,
102437,
233517,
159807,
315476,
307289,
200794,
315487,
45153,
307299,
307301,
315498,
299121,
233589,
233590,
241808,
323729,
233636,
299174,
233642,
323762,
299187,
184505,
299198,
299203,
282831,
356576,
176362,
233715,
184570,
168188,
299293,
233762,
217380,
282919,
151847,
332085,
332089,
315706,
282939,
307517,
241986,
332101,
323916,
348492,
250192,
323920,
348500,
323935,
242029,
291192,
225670,
291224,
283038,
61857,
61859,
381347,
340398,
299441,
61873,
283064,
61880,
291267,
127427,
127428,
283075,
324039,
373197,
176601,
242139,
160225,
242148,
291311,
233978,
291333,
340490,
283153,
291358,
283182,
283184,
234036,
315960,
70209,
348742,
70215,
348749,
111208,
291454,
184962,
348806,
152203,
184973,
299699,
299700,
225995,
225997,
242386,
226004,
226007,
226019,
299759,
299770,
234234,
299776,
242433,
234241,
291585,
209670,
226058,
234250,
234253,
291604,
234263,
283419,
234268,
234277,
283430,
234283,
152365,
234286,
234289,
242485,
234294,
234301,
234311,
234312,
299849,
283467,
234317,
201551,
234323,
234326,
234331,
242529,
349026,
234340,
234343,
275303,
177001,
234346,
201577,
308076,
242541,
234355,
209783,
234360,
209785,
234361,
177019,
234366,
234367,
291712,
234372,
226181,
226184,
308107,
308112,
234386,
234387,
234392,
209817,
324506,
324507,
234400,
234404,
324517,
283558,
234409,
275371,
234419,
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,
357486,
316526,
144496,
300146,
275571,
300151,
234616,
398457,
291959,
160891,
341115,
300158,
234622,
349316,
349318,
275591,
234632,
234638,
169104,
177296,
234642,
308372,
185493,
119962,
119963,
300187,
300188,
234656,
234659,
234663,
300201,
300202,
275625,
226481,
283840,
259268,
283847,
62665,
283852,
283853,
316627,
357595,
234733,
234742,
292091,
316669,
234755,
242954,
292107,
251153,
226608,
300343,
333117,
226624,
193859,
300359,
226632,
234827,
177484,
251213,
234831,
120148,
283991,
357719,
218462,
234850,
292195,
333160,
284014,
243056,
111993,
112017,
112018,
234898,
357786,
333220,
316842,
210358,
284089,
292283,
415171,
300487,
300489,
284107,
284116,
366037,
210390,
210391,
210393,
226781,
144867,
316902,
54765,
251378,
333300,
300535,
300536,
333303,
300542,
210433,
366083,
316946,
308756,
398869,
308764,
349726,
333343,
349741,
169518,
194110,
235070,
349763,
218696,
276040,
366154,
292425,
243274,
276045,
128587,
333388,
333393,
300630,
235095,
243292,
333408,
374372,
317032,
54893,
276085,
366203,
325245,
276120,
276126,
300714,
300728,
218819,
276173,
333517,
333520,
333521,
333523,
276195,
153319,
284401,
276210,
276219,
325371,
194303,
194304,
300811,
284429,
276238,
284431,
366360,
284442,
325404,
276253,
325410,
341796,
333610,
284459,
317232,
276282,
276283,
276287,
325439,
276294,
276298,
341836,
325457,
284507,
300894,
284512,
284514,
276327,
292712,
325484,
292720,
325492,
300918,
276344,
317304,
194429,
325503,
333701,
243591,
325515,
243597,
325518,
300963,
292771,
333735,
284587,
292782,
243637,
276408,
276421,
284619,
276430,
301008,
153554,
194515,
276444,
219101,
292836,
292837,
276454,
276459,
325619,
333817,
292858,
333828,
145435,
317467,
292902,
227370,
276534,
358456,
227417,
194656,
309345,
227428,
276582,
194666,
276589,
227439,
284788,
333940,
292992,
194691,
227460,
333955,
235662,
325776,
276627,
317587,
276632,
284826,
333991,
333992,
284841,
284842,
129203,
227513,
301251,
227524,
309444,
276682,
227548,
301279,
317664,
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,
227726,
178578,
178582,
293274,
285084,
317852,
285090,
375207,
293303,
276920,
276925,
293310,
317901,
326100,
285150,
227809,
358882,
342498,
227813,
195045,
276998,
342536,
186893,
342553,
375333,
293419,
244269,
236081,
23092,
277048,
309830,
301638,
55881,
244310,
277094,
277101,
277111,
301689,
277133,
227990,
342682,
285353,
285361,
342706,
293556,
342713,
285371,
285373,
154316,
203477,
96984,
318173,
285415,
342762,
277227,
154359,
162561,
285444,
285458,
285466,
326429,
326433,
318250,
318252,
285487,
301871,
285497,
162621,
293693,
162626,
277316,
318278,
277325,
293711,
301918,
293730,
351077,
342887,
400239,
277366,
228215,
277370,
269178,
359298,
277381,
113542,
228233,
228234,
56208,
293781,
277403,
318364,
310176,
310178,
293800,
236461,
293806,
130016,
64485,
277479,
203757,
277492,
293886,
277509,
277510,
146448,
277523,
277524,
310317,
252980,
359478,
302139,
277563,
359495,
285798,
228458,
15471,
187506,
285814,
285820,
187521,
285828,
302213,
285830,
253063,
302216,
228491,
228493,
285838,
162961,
326804,
302240,
343203,
253099,
367799,
277690,
64700,
228542,
343234,
367810,
244940,
228563,
195811,
228588,
253167,
302325,
204022,
228600,
228609,
245019,
277792,
130338,
130343,
277800,
113966,
351537,
286018,
113987,
15686,
294218,
318805,
294243,
163175,
327024,
327025,
327031,
179587,
368011,
318864,
318875,
310692,
286129,
228795,
302529,
302531,
163268,
163269,
310732,
302540,
64975,
327121,
212442,
228827,
286172,
310757,
187878,
343542,
343543,
286202,
286205,
302590,
228861,
294400,
228867,
253452,
65041,
146964,
204313,
286244,
245287,
278060,
245292,
286254,
56902,
228943,
286288,
196187,
147036,
343647,
286306,
310889,
138863,
188031,
294529,
286343,
229001,
310923,
188048,
229020,
302754,
245412,
40613,
40614,
40615,
229029,
278191,
286388,
286391,
319162,
286399,
302797,
212685,
212688,
245457,
302802,
286423,
278233,
278234,
294622,
278240,
229088,
212716,
212717,
286459,
278272,
319233,
311042,
278291,
278293,
294678,
278299,
286494,
294700,
360252,
188251,
245599,
237408,
302946,
253829,
40853,
294807,
294809,
294814,
319392,
294823,
294843,
98239,
237504,
163781,
344013,
212946,
24532,
294886,
253929,
327661,
278512,
311282
] |
3dc2bf4f195ed6649aaaa5a492b9804f25c55982
|
16e5e4b8ac1ee364de22b0c50d978a0af682d24c
|
/MVVM/Infrastructure/AFNetworking/AFAuth.swift
|
7fa05f5809b14070d6b1a5fbc459aa8c38bf05e7
|
[] |
no_license
|
ken4R/MVVM-Architecture
|
6046fcc3949faf01f6536e55712bb6b34ad8292d
|
7b4daefbf84b641ec168881547d5a03dc4ed867a
|
refs/heads/master
| 2020-09-07T07:56:31.871518 | 2019-11-09T20:25:18 | 2019-11-09T20:25:18 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 515 |
swift
|
//
// AFAuth.swift
// MVVM
//
// Created by Michal Ziobro on 17/09/2019.
// Copyright © 2019 Michal Ziobro. All rights reserved.
//
import Foundation
import Alamofire
class AFAuth {
public static let session : Session = {
let session = Session(interceptor: AuthRequestInterceptor())
return session
}()
@discardableResult
public static func request(_ urlRequest: URLRequestConvertible) -> DataRequest {
return AFAuth.session.request(urlRequest)
}
}
|
[
-1
] |
48f1af6d819884be690e0023b389c3f6a9115a79
|
9e81b52a668fadcf88632d504438f536355b7ac5
|
/BlendingCultureSwift/Classes/Models/Hand.swift
|
2b7666d648c8a68a820233113932388cdd2fff00
|
[] |
no_license
|
kosuge0820/BlendingCultureSwift
|
993c1b6985c2f9932eb2912cc4d5959db1b0fdef
|
34d9322a027defc9aa4031e3209c499fd33294fa
|
refs/heads/master
| 2021-07-07T09:24:33.149317 | 2016-11-24T13:14:05 | 2016-11-24T13:14:05 | 57,426,312 | 0 | 1 | null | null | null | null |
UTF-8
|
Swift
| false | false | 1,080 |
swift
|
import UIKit
struct Hand: DataType {
private var deck: Deck = Deck()
private var cards = [Card]()
init() {}
private init(deck: Deck, cards: [Card]) {
self.deck = deck
self.cards = cards
}
var numberOfItems: Int {
return cards.count
}
subscript(index: Int) -> Card {
return cards[index]
}
func addNewItem(at index: Int) -> Hand {
let hand = insertItem(card: deck.nextCard(), atIndex: index)
return hand
}
func deleteItem(at index: Int) -> Hand {
var mutableCards = cards
mutableCards.remove(at: index)
return Hand(deck: deck, cards: mutableCards)
}
func moveItem(from index: Int, toIndex: Int) -> Hand {
return deleteItem(at: index).insertItem(card: cards[index], atIndex: toIndex)
}
fileprivate func insertItem(card: Card, atIndex index: Int) -> Hand {
var mutableCards = cards
mutableCards.insert(card, at: index)
return Hand(deck: deck, cards: mutableCards)
}
}
|
[
-1
] |
e2340916f56bf9a9c9c4893a42360dbcc72bf38a
|
714856fccdbd05812cc3dcc912d4e68bb20ed579
|
/Profeey/PostSmallTableViewCell.swift
|
013b081ea5aff91e6c914009b737cab42ae806d6
|
[] |
no_license
|
antoniozdelican/profeey-ios
|
ce48417b42baa9aeb108167c7ac6d0b3ca1717bd
|
3a83e402a4e23da7f339ffeec440e8879864813e
|
refs/heads/master
| 2023-03-07T13:22:39.722644 | 2021-02-13T22:05:08 | 2021-02-13T22:05:08 | 63,194,448 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 1,573 |
swift
|
//
// PostSmallTableViewCell.swift
// Profeey
//
// Created by Antonio Zdelican on 07/08/16.
// Copyright © 2016 Profeey. All rights reserved.
//
import UIKit
protocol PostSmallTableViewCellDelegate: class {
func moreButtonTapped(_ cell: PostSmallTableViewCell)
}
class PostSmallTableViewCell: UITableViewCell {
@IBOutlet weak var postImageView: UIImageView!
@IBOutlet weak var titleLabel: UILabel!
@IBOutlet weak var categoryNameLabel: UILabel!
@IBOutlet weak var createdLabel: UILabel!
@IBOutlet weak var numberOfLikesLabel: UILabel!
@IBOutlet weak var numberOfLikesContainerView: UIView!
weak var postSmallTableViewCellDelegate: PostSmallTableViewCellDelegate?
override func awakeFromNib() {
super.awakeFromNib()
}
override func setSelected(_ selected: Bool, animated: Bool) {
let color = self.numberOfLikesContainerView.backgroundColor
super.setSelected(selected, animated: animated)
if(selected) {
self.numberOfLikesContainerView.backgroundColor = color
}
}
override func setHighlighted(_ highlighted: Bool, animated: Bool) {
let color = self.numberOfLikesContainerView.backgroundColor
super.setHighlighted(highlighted, animated: animated)
if(highlighted) {
self.numberOfLikesContainerView.backgroundColor = color
}
}
// MARK: IBActions
@IBAction func moreButtonTapped(_ sender: AnyObject) {
self.postSmallTableViewCellDelegate?.moreButtonTapped(self)
}
}
|
[
-1
] |
99517dac6987b3df2f72a8945fba84440a2651b0
|
2e9ba35251d5ee52e4c32a1785c525c18e8740e2
|
/DataStructuresAndAlgorithmsInSwift/DataStructuresAndAlgorithmsSwift.playground/Contents.swift
|
66594e59fa5b2f9964e332336f8e4c0bb79843e4
|
[] |
no_license
|
simdani/Algorithms
|
00fc274936b4f77852d212b4674ecbe5a512795f
|
051abf3c90c1da53545b6079d3bfcea9f4fcfc8a
|
refs/heads/master
| 2021-06-26T01:49:13.440966 | 2020-11-23T19:50:48 | 2020-11-23T19:50:48 | 179,636,253 | 1 | 0 | null | 2020-10-01T09:53:21 | 2019-04-05T07:21:13 |
Python
|
UTF-8
|
Swift
| false | false | 163 |
swift
|
import UIKit
var str = "Hello, playground"
print(StackChallenges.reverse([1, 2, 3, 4, 5]))
//print(StackChallenges.balanceTheParantheses(from: "(hello world"))
|
[
-1
] |
ece57e8d7bbdb53babf1672ecfdafe20263ea3ce
|
5d6639bcef82f00da35147ec58449f9f52831ee9
|
/Sources/App/Admin/Commands/RunSubmissionJob.swift
|
f9a7299c5b1730575b915e816781652e8b9e4294
|
[
"MIT"
] |
permissive
|
antonyharfield/grader
|
42f2f908c4e9b4222241367d0c212808319e62f3
|
d22d43b9e6cba30d2ba1d0bd992eb16e24c2b920
|
refs/heads/master
| 2021-07-04T02:50:24.457428 | 2021-05-27T04:44:31 | 2021-05-27T04:44:31 | 99,318,248 | 3 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 785 |
swift
|
import Vapor
import Console
final class RunSubmissionJob: Command {
public let id = "submission"
public let help = ["Perform the submission job for a given submission"]
public let console: ConsoleProtocol
public init(console: ConsoleProtocol) {
self.console = console
}
public func run(arguments: [String]) throws {
guard arguments.count == 1, let id = Int(arguments[0]) else {
console.print("Requires 1 argument (submission id)")
return
}
let job = SubmissionJob(submissionID: id)
try job.perform()
}
}
extension RunSubmissionJob: ConfigInitializable {
public convenience init(config: Config) throws {
self.init(console: try config.resolveConsole())
}
}
|
[
-1
] |
33768801ea19b77348ab835927b1b84cba1ee0ba
|
fb14f3e0069ab85d25498081c3c3ed58c6eead53
|
/ARAi/SceneView.swift
|
4a58bac4b502e49cdbe5df3d1f6674727de39625
|
[] |
no_license
|
AndreasInk/ARAi
|
b3145c12268c078771e4c6dae3a62fe9395bffa8
|
5d8e40e5d24c4eb50d67e5cef5c6179b7794eaf8
|
refs/heads/main
| 2023-07-03T14:35:14.283643 | 2021-08-03T13:23:46 | 2021-08-03T13:23:46 | 377,298,389 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 8,169 |
swift
|
//
// SceneView.swift
// ARAi
//
// Created by Andreas on 7/1/21.
//
import SwiftUI
import SceneKit
import SceneKit.ModelIO
struct SceneView: UIViewRepresentable {
@Binding var points: [POINT3D]
@Binding var gestureOn: Bool
var scene: SCNScene
var options: [Any]
@ObservedObject var thing: Thing
var view = SCNView()
func makeUIView(context: Context) -> SCNView {
// Instantiate the SCNView and setup the scene
view.scene = scene
view.pointOfView = scene.rootNode.childNode(withName: "camera", recursively: true)
view.allowsCameraControl = true
do {
let model = nodeFromResource(assetName: "pizza2", extensionName: "usdz")
let modelScene = try SCNScene(url: Bundle.main.url(forResource: "pizza2", withExtension: "usdz")!, options: nil)
// print(modelScene.rootNode.childNodes.last?.childNodes.last?.geometry)
model.position = SCNVector3Make(1, 1, 1)
model.geometry?.firstMaterial?.lightingModel = .physicallyBased
scene.rootNode.addChildNode(model)
if let filePath = Bundle.main.path(forResource: "pizza2",
ofType: "usdz") {
let refURL = URL(fileURLWithPath: filePath)
let mdlAsset = MDLAsset(url: refURL)
// scene.rootNode.childNodes.app = SCNScene(mdlAsset: mdlAsset)
let tvNode = scene.rootNode.childNode(withName: "g0", recursively: true)
let geometry = tvNode!.geometry!
for i in geometry.elements.indices {
// let element = geometry.element(at: i)
let vertices = vertices(node: tvNode!)
for vert in vertices {
let box = SCNBox(width: 0.002, height: 0.002, length: 0.002, chamferRadius: 0)
box.firstMaterial?.diffuse.contents = UIColor.black
box.firstMaterial?.isDoubleSided = true
let boxNode = SCNNode(geometry: box)
boxNode.position = SCNVector3(Float.random(in: -1000...1000), Float.random(in: -1000...1000), Float.random(in: -1000...1000))
model.addChildNode(boxNode)
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
SCNAction.move(to: SCNVector3(vert.x, vert.y, vert.z), duration: TimeInterval.random(in: 5...60))
}
//print(boxNode.position)
points.append(POINT3D(x: boxNode.position.x, y: boxNode.position.y, z: boxNode.position.z))
}
}
tvNode!.opacity = 1.0
} else {
print("invalid path!")
}
//points = loadPointCloud(modelFile:Bundle.main.url(forResource: "pizza2", withExtension: "usdz")!)!
// for point in points {
//
//
// }
} catch {
}
// Add gesture recognizer
let tapGesture = UIPanGestureRecognizer(target: context.coordinator, action: #selector(context.coordinator.handleTap(_:)))
if thing.export {
let tvNode = scene.rootNode.childNode(withName: "g0", recursively: true)
// for i in thing.nodes.indices {
// if tvNode!.geometry!.elements.contains((thing.nodes[i].geometry?.elements.last)!) {
// tvNode!.geometry!.removeMaterial(at: i)
//
//
// }
// }
let exportUrl = getDocumentsDirectory().appendingPathComponent("test.usdz")
if exportUrl.startAccessingSecurityScopedResource() {
let usdz = MDLAsset.canExportFileExtension("usdz")
if usdz {
do {
let modelScene = try SCNScene(url: Bundle.main.url(forResource: "pizza2", withExtension: "usdz")!, options: nil)
let mdlScene = MDLAsset(scnScene: modelScene)
print(mdlScene)
let path = FileManager.default.urls(for: .cachesDirectory,
in: .userDomainMask)[0]
.appendingPathComponent("test.usdz")
modelScene.write(to: getDocumentsDirectory().appendingPathComponent("test.usdz"),
options: nil,
delegate: nil,
progressHandler: nil)
do { exportUrl.stopAccessingSecurityScopedResource() }
} catch {
print(error)
}
} else {
print("No USDZ")
}
}
}
if !thing.gestureOn {
view.removeGestureRecognizer(tapGesture)
} else {
view.addGestureRecognizer(tapGesture)
}
return view
}
func getDocumentsDirectory() -> URL {
// find all possible documents directories for this user
let paths = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)
// just send back the first one, which ought to be the only one
return paths[0]
}
func updateUIView(_ view: SCNView, context: Context) {
}
func makeCoordinator() -> Coordinator {
Coordinator(view)
}
class Coordinator: NSObject {
private let view: SCNView
init(_ view: SCNView) {
self.view = view
super.init()
}
@objc func handleTap(_ gestureRecognize: UIGestureRecognizer) {
// check what nodes are tapped
let p = gestureRecognize.location(in: view)
let hitResults = view.hitTest(p, options: [:])
// check that we clicked on at least one object
if hitResults.count > 0 {
// retrieved the first clicked object
for result in hitResults.filter( { $0.node.name != "g0" }) {
result.node.removeFromParentNode()
// get material for selected geometry element
let material = result.node.geometry!.materials[(result.geometryIndex)]
// highlight it
SCNTransaction.begin()
SCNTransaction.animationDuration = 0.5
// on completion - unhighlight
SCNTransaction.completionBlock = {
SCNTransaction.begin()
SCNTransaction.animationDuration = 0.5
// material.emission.contents = UIColor.black
SCNTransaction.commit()
}
material.emission.contents = UIColor.green
SCNTransaction.commit()
}
}
}
}
func vertices(node:SCNNode) -> [SCNVector3] {
let vertexSources = node.geometry?.sources(for: SCNGeometrySource.Semantic.vertex)
if let vertexSource = vertexSources?.first {
let count = vertexSource.data.count / MemoryLayout<SCNVector3>.size
return vertexSource.data.withUnsafeBytes {
[SCNVector3](UnsafeBufferPointer<SCNVector3>(start: $0, count: count))
}
}
return []
}
}
class Thing: ObservableObject {
@Published var gestureOn: Bool = false
@Published var scene: SCNScene = SCNScene()
@Published var export: Bool = false
@Published var nodes: [SCNNode] = [SCNNode]()
}
|
[
-1
] |
246d57d7985e7b87b3a802af955103247c47a30c
|
7945143dae76ede9a24f2694c63ededd17c74ef3
|
/Peggle/Controllers/LevelDesignerController+LevelDelegate.swift
|
08391399edc522d60666e4b5c273f31b905b479e
|
[] |
no_license
|
EmmanuelEnjie/cs3217-problem-set-2
|
101d2a25ed6c4ce2d802ed192d750b06625ea894
|
bf98bafbfd930c5b157b647fe06d35273c10cade
|
refs/heads/master
| 2020-12-28T05:59:07.964569 | 2020-02-04T12:04:32 | 2020-02-04T12:04:32 | 238,204,189 | 0 | 0 | null | 2020-02-04T12:46:26 | 2020-02-04T12:46:25 | null |
UTF-8
|
Swift
| false | false | 1,867 |
swift
|
//
// LevelDesignerController+LevelDelegate.swift
// Peggle
//
// Created by Shawn Koh on 1/2/20.
// Copyright © 2020 Shawn Koh. All rights reserved.
//
import UIKit
extension LevelDesignerController: LevelDelegate {
func didAddPeg(_ peg: Peg) {
let image = peg.type == .objective ? Settings.objectivePegImage : Settings.normalPegImage
let pegControl = PegControl(center: peg.center, radius: peg.radius, image: image)
pegControl.addTarget(self, action: #selector(handlePegTap(pegControl:)), for: .touchUpInside)
let longPressGestureRecognizer = UILongPressGestureRecognizer(target: self,
action: #selector(handlePegLongPress(_:)))
let panGestureRecognizer = UIPanGestureRecognizer(target: self, action: #selector(handlePegPan(_:)))
pegControl.addGestureRecognizer(longPressGestureRecognizer)
pegControl.addGestureRecognizer(panGestureRecognizer)
canvasControl.addSubview(pegControl)
pegs[key: peg] = pegControl
}
func didReplacePeg(oldPeg: Peg, newPeg: Peg) {
let pegControl = pegs[key: oldPeg]
pegs[key: oldPeg] = nil
pegs[key: newPeg] = pegControl
pegControl?.center = newPeg.center
pegControl?.radius = newPeg.radius
pegControl?.image = newPeg.type == .objective ? Settings.objectivePegImage : Settings.normalPegImage
pegControl?.reload()
}
func didRemovePeg(_ peg: Peg) {
let pegControl = pegs[key: peg]
pegControl?.removeFromSuperview()
pegs[key: peg] = nil
}
func didRemoveAllPegs() {
pegs.values.forEach { pegControl in
pegControl.removeFromSuperview()
}
pegs = BiMap()
}
func didNameChange(_ name: String) {
levelNameLabel.text = name
}
}
|
[
-1
] |
23cfa516b952f9f9dda568a2b8a732a4f0c51dcb
|
740fad66d249b80669ea2404a38036e55ba1f277
|
/Additions/NSMenu-SBAdditions.swift
|
9c09a5d90984f3b91b00d4ed537b6d1de6a5f165
|
[
"BSD-2-Clause"
] |
permissive
|
diatoming/daybreak
|
7588ae1710416e5df15bddcded756616d4908229
|
14f1101aeee945c892b8ca7e1d5b8a0ec07523b0
|
refs/heads/master
| 2021-01-15T19:58:54.305335 | 2015-04-11T01:38:28 | 2015-04-11T01:38:28 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 2,945 |
swift
|
/*
NSMenu-SBAdditions.swift
Copyright (c) 2014, Alice Atlas
Copyright (c) 2010, Atsushi Jike
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
extension NSMenu {
var selectedItem: NSMenuItem? {
return (itemArray as! [NSMenuItem]).first { $0.state == NSOnState }
}
func selectItem(menuItem: NSMenuItem) {
for item in itemArray as! [NSMenuItem] {
item.state = (item === menuItem) ? NSOnState : NSOffState
}
}
func selectItem(#representedObject: AnyObject?) -> NSMenuItem? {
var selectedItem: NSMenuItem?
for item in itemArray as! [NSMenuItem] {
let repObject: AnyObject? = item.representedObject
let equal = repObject === representedObject
item.state = equal ? (selectedItem !! NSOffState ?? NSOnState) : NSOffState
if equal && selectedItem == nil {
selectedItem = item
}
}
return selectedItem
}
func deselectItem() {
for item in itemArray as! [NSMenuItem] {
item.state = NSOffState
}
}
func addItem(#title: String, target: AnyObject?, action: Selector, tag: Int) -> NSMenuItem {
let item = NSMenuItem()
item.title = title
item.target = target
item.action = action
item.tag = tag
addItem(item)
return item
}
func addItem(#title: String, representedObject: AnyObject?, target: AnyObject?, action: Selector) -> NSMenuItem {
let item = NSMenuItem()
item.title = title
item.target = target
item.action = action
item.representedObject = representedObject
addItem(item)
return item
}
}
|
[
-1
] |
d068834d5000ff175e5e439fabe388af2c869eed
|
cb2c8601858ddd153d5b2de3ac54b93f1f5c097f
|
/testSwiftyjson/AppDelegate.swift
|
6f45539970cadcb1092cf76ffdca6d8e70504cd7
|
[] |
no_license
|
malabdullah/Diwan-Alshatti-ios
|
a0098f09e10d1dfcaf6b7147fb084e2e1a8092f9
|
6846fba71a5630f455e39d03b1f7c9c7e808cd35
|
refs/heads/master
| 2020-04-02T05:10:03.817372 | 2016-06-10T06:07:38 | 2016-06-10T06:07:38 | 59,978,478 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 2,215 |
swift
|
//
// AppDelegate.swift
// testSwiftyjson
//
// Created by Mohammad Alabdullah on 4/20/16.
// Copyright © 2016 Mohammad Alabdullah. All rights reserved.
//
import UIKit
import Firebase
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate{
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
FIRApp.configure()
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:.
}
}
|
[
276482,
229380,
276485,
229383,
282632,
229385,
276490,
278539,
229388,
278542,
229391,
282639,
278545,
229394,
276496,
278548,
229397,
282645,
229399,
321560,
229402,
278556,
229405,
282654,
278559,
354338,
278564,
217127,
354348,
282669,
276528,
282681,
286778,
276539,
282687,
276544,
159811,
284739,
325700,
67654,
223303,
276553,
280651,
278605,
307278,
286797,
288848,
354382,
280658,
354390,
288855,
194649,
227418,
194654,
227423,
280671,
223327,
227426,
278623,
313438,
278626,
227430,
276583,
276579,
280681,
276586,
278635,
313451,
223341,
276590,
278639,
227440,
280687,
284786,
280691,
276595,
280702,
227463,
131209,
417930,
311436,
280725,
241813,
276638,
184479,
184481,
284837,
288936,
280747,
288940,
280755,
280759,
176311,
307386,
280764,
176316,
227520,
280769,
227522,
280771,
280774,
280776,
227529,
276685,
131278,
309455,
286928,
280783,
276689,
280786,
280788,
227540,
176343,
278743,
280793,
278747,
280796,
280798,
309471,
155872,
131299,
280807,
278760,
276713,
280811,
280817,
227571,
157940,
182517,
280819,
280823,
276725,
280827,
278781,
280830,
227583,
278783,
282881,
276735,
280833,
227587,
276739,
276742,
280835,
278792,
227593,
278785,
227596,
282893,
291089,
282906,
319770,
276766,
211232,
276775,
262448,
307510,
151864,
307512,
280888,
280891,
282942,
155966,
278849,
151874,
280897,
280900,
282947,
260421,
276809,
280906,
276811,
285002,
276816,
278865,
280919,
276829,
276833,
276836,
280937,
276843,
280940,
276848,
285051,
280956,
227709,
280959,
299398,
178572,
311693,
285070,
178575,
190868,
285077,
240021,
65943,
283033,
291226,
227738,
141725,
319903,
276896,
283042,
285093,
278952,
285098,
276907,
147032,
276917,
283062,
278967,
180668,
283069,
278975,
281024,
278980,
289221,
278983,
283080,
278986,
289227,
278990,
176592,
278994,
281045,
176597,
281047,
283095,
279003,
279006,
276961,
227810,
279010,
276964,
215526,
279015,
279020,
279023,
281075,
279027,
164343,
301562,
279035,
281084,
279040,
287234,
279045,
287238,
281095,
121352,
236043,
279051,
281102,
279055,
279058,
223763,
277011,
223765,
279063,
281113,
283161,
279067,
281116,
279072,
281121,
182819,
227877,
227879,
281127,
279082,
279084,
309804,
281135,
285236,
158262,
279095,
277054,
281154,
129603,
158283,
281163,
277071,
285265,
279124,
277080,
281179,
285277,
199262,
262752,
285282,
281190,
318055,
189034,
277100,
281196,
295533,
189039,
189040,
277106,
189044,
184952,
281210,
170619,
282623,
287360,
291456,
277122,
287365,
295557,
166535,
285320,
279178,
287371,
135820,
133776,
277136,
240275,
277139,
225941,
299672,
227992,
285340,
164509,
287390,
295583,
299680,
227998,
299677,
225954,
137889,
209576,
287400,
279208,
279212,
285357,
277170,
342707,
154292,
277173,
318132,
285368,
277177,
277181,
279231,
277187,
287427,
199367,
277194,
107212,
277196,
225998,
277201,
226002,
226005,
279255,
226008,
279258,
213724,
363234,
279267,
228069,
277223,
283368,
279272,
285417,
283372,
277232,
228081,
230131,
226037,
289525,
234231,
283382,
234236,
226045,
234239,
209665,
285441,
226056,
234248,
285448,
33548,
234254,
228113,
281361,
285459,
234261,
369433,
277273,
293659,
281372,
283421,
228128,
234274,
228135,
283432,
277291,
281388,
207661,
279340,
234284,
283440,
285489,
301876,
234292,
285494,
279353,
289593,
281401,
283452,
234298,
281410,
277314,
277317,
281413,
281414,
234309,
234313,
277322,
281420,
283468,
234321,
277329,
185173,
281430,
279383,
301913,
297818,
281435,
234329,
277337,
279390,
281438,
234333,
279394,
281442,
234338,
177004,
224110,
328563,
279413,
277368,
234362,
226171,
234368,
226182,
234375,
213895,
39817,
187274,
277385,
226185,
234379,
213902,
279438,
234384,
234388,
279445,
424853,
226200,
279452,
277405,
234398,
279461,
279462,
234407,
226220,
234414,
289712,
277426,
275384,
234428,
226239,
238528,
189378,
52163,
226245,
234439,
197580,
193486,
275406,
193488,
304084,
234459,
234461,
281567,
293861,
234470,
228327,
5096,
228328,
228330,
297961,
228332,
234475,
281581,
277486,
234484,
293877,
285690,
244731,
234490,
234493,
134142,
293887,
277504,
277507,
234501,
277511,
295949,
234510,
234515,
277526,
234523,
300069,
189479,
144430,
234543,
275508,
300088,
277561,
277564,
234556,
207937,
230465,
296004,
277573,
228422,
310344,
234568,
234570,
277577,
207949,
277583,
234580,
234581,
234585,
281691,
234590,
277598,
285792,
277601,
234595,
281702,
281704,
234601,
277608,
228460,
164973,
205934,
281711,
203886,
275569,
281708,
234607,
279661,
187509,
234614,
285815,
289912,
285817,
279669,
234618,
187880,
285821,
234623,
285824,
226433,
279679,
279683,
234627,
285831,
275594,
285835,
234636,
275602,
226453,
275608,
283805,
234657,
283813,
205991,
277671,
234664,
275626,
165035,
165038,
277678,
228526,
277687,
277695,
316610,
142531,
226500,
279750,
228550,
306377,
283850,
203987,
249045,
279769,
216801,
363745,
279777,
279781,
285927,
279788,
195822,
279790,
228592,
120053,
228601,
204031,
283904,
234760,
228617,
296202,
283917,
204067,
283939,
277798,
259367,
113964,
285997,
283951,
113969,
277811,
216376,
277816,
222522,
286010,
283963,
222525,
277822,
286016,
281923,
226628,
283973,
378181,
224584,
277832,
277836,
283983,
277839,
222545,
224594,
277850,
179547,
159068,
224603,
277853,
230752,
218464,
277857,
302436,
281960,
173418,
284010,
181626,
275834,
298365,
277888,
281987,
277892,
281990,
224647,
327046,
277898,
142733,
226703,
230800,
277903,
277905,
277908,
226709,
144796,
277917,
288160,
277921,
277923,
279975,
228776,
282025,
282027,
277932,
370092,
284076,
279983,
277937,
282034,
279985,
284084,
296373,
284087,
144828,
282044,
277953,
284099,
144835,
296389,
38342,
64966,
163272,
245191,
277959,
280014,
277966,
288210,
370130,
288212,
280021,
288214,
277975,
239064,
286169,
288217,
280027,
288218,
288220,
228825,
163290,
288224,
277981,
288226,
370146,
280036,
288229,
280038,
288230,
288232,
282089,
288234,
280034,
288236,
259565,
288238,
259567,
288240,
286188,
226802,
282098,
288242,
288244,
241142,
308727,
282101,
278003,
296439,
278009,
151036,
282111,
228864,
300543,
175621,
228871,
192008,
370187,
65038,
282127,
282130,
282133,
286233,
282142,
284191,
282144,
108066,
286248,
278057,
316983,
226877,
228933,
226886,
128584,
282186,
366155,
280140,
276043,
226895,
228944,
280145,
282195,
276052,
280149,
276053,
280152,
282201,
243290,
284251,
159324,
278109,
284253,
284255,
370272,
280158,
159330,
284258,
284263,
286312,
284265,
286313,
284267,
276086,
280183,
280185,
257658,
280188,
276093,
276095,
280191,
280194,
276098,
278150,
282249,
276109,
280208,
286354,
278163,
280211,
282261,
278168,
280218,
280222,
276127,
282277,
280232,
276137,
278188,
278192,
296626,
282295,
282300,
280260,
282310,
278216,
280264,
302793,
276170,
282319,
276175,
306897,
276177,
278227,
280276,
229076,
282328,
276187,
278235,
280283,
229086,
278238,
284379,
282337,
284381,
284384,
284386,
276197,
216806,
286432,
284392,
282345,
284394,
12011,
317158,
284397,
276206,
284399,
280302,
419570,
282356,
276216,
280314,
282364,
284413,
171774,
282367,
67330,
284418,
280324,
278274,
282376,
216842,
280331,
282388,
116503,
282392,
284440,
184090,
186139,
276255,
284449,
278306,
282402,
300834,
227109,
188199,
282410,
280363,
276268,
141101,
306988,
194351,
278320,
165678,
300845,
284469,
280375,
276280,
282425,
276291,
280388,
276295,
280393,
282446,
358224,
280402,
276308,
284502,
282454,
276315,
284511,
317279,
282465,
280419,
227175,
277989,
282478,
282481,
110450,
315251,
284529,
284540,
1920,
255873,
294785,
282499,
280454,
247688,
282505,
280458,
276365,
280464,
282514,
40851,
284564,
317332,
284566,
239510,
282520,
280473,
280468,
294811,
284572,
247709,
294817,
276386,
282531,
284579,
276388,
280487,
282537,
284585,
276395,
276402,
282547,
276410,
276411,
276418,
280515,
280521,
276425,
231379,
276446,
153568,
276448,
276452,
276455,
231404,
276460,
276464,
278513,
276466,
227314,
278516,
278519,
276472,
276476,
276479
] |
31534ae438e3e87379f7a5927debcc3285daace3
|
ff2e3e7829365a715d7f1f09546e15ecbda423d3
|
/Todoey/ViewController.swift
|
6c96e9c64f9c6072ebd7d6869a4fc75c8114aecb
|
[] |
no_license
|
jjr21/Todoey
|
5ed1b3cc4f2a3f91908d3adef2e3aed32f0a6139
|
005af910c85f4d90a29f08e4fd84f776ca581bce
|
refs/heads/master
| 2020-06-10T02:46:22.651644 | 2019-06-24T13:53:39 | 2019-06-24T13:53:39 | 193,559,467 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 337 |
swift
|
//
// ViewController.swift
// Todoey
//
// Created by Jonathan Rogers on 6/24/19.
// Copyright © 2019 Jonathan Rogers. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
}
|
[
-1
] |
3f33590bf5b5e2a318fe7898da5d63461cea5596
|
530aff210d9ca5ef3875de8fe3a4dbbd75ae6434
|
/CustomVision/HapticManager.swift
|
fcb775ae284809e6b6e9752146b88b6d4b271705
|
[
"MIT"
] |
permissive
|
adarshhasija/se_two_ios
|
5152625e48afe3fda02e9f4a5ff0489d434ae50a
|
de63141d1c4ebb71669c89b72621264a07ceee03
|
refs/heads/master
| 2023-07-11T04:01:24.248794 | 2023-06-28T04:57:16 | 2023-06-28T04:57:16 | 137,344,274 | 0 | 1 | null | null | null | null |
UTF-8
|
Swift
| false | false | 9,731 |
swift
|
//
// HapticManager.swift
// Suno
//
// Created by Adarsh Hasija on 09/05/20.
// Copyright © 2020 Adam Behringer. All rights reserved.
//
import Foundation
import CoreHaptics
import AVFoundation
import UIKit
class HapticManager {
let MC_DOT = "MC_DOT"
let MC_DASH = "MC_DASH"
let RESULT_SUCCESS = "RESULT_SUCCESS"
let RESULT_FAILURE = "RESULT_FAILURE"
private let supportsHaptics : Bool
var chHapticEngine : CHHapticEngine?
private var engineNeedsStart = true
init(supportsHaptics : Bool) {
self.supportsHaptics = supportsHaptics
if supportsHaptics {
createAndStartHapticEngine()
}
}
func stopEngine() {
self.chHapticEngine?.stop()
}
private func createAndStartHapticEngine() {
// Create and configure a haptic engine.
do {
chHapticEngine = try CHHapticEngine()
} catch let error {
fatalError("Engine Creation Error: \(error)")
}
// The stopped handler alerts engine stoppage.
chHapticEngine?.stoppedHandler = { reason in
print("Stop Handler: The engine stopped for reason: \(reason.rawValue)")
switch reason {
case .audioSessionInterrupt: print("Audio session interrupt")
case .applicationSuspended: print("Application suspended")
case .idleTimeout: print("Idle timeout")
case .notifyWhenFinished: print("Finished")
case .systemError: print("System error")
@unknown default:
print("Unknown error")
}
// Indicate that the next time the app requires a haptic, the app must call engine.start().
self.engineNeedsStart = true
}
// The reset handler notifies the app that it must reload all its content.
// If necessary, it recreates all players and restarts the engine in response to a server restart.
chHapticEngine?.resetHandler = {
print("The engine reset --> Restarting now!")
// Tell the rest of the app to start the engine the next time a haptic is necessary.
self.engineNeedsStart = true
}
// Start haptic engine to prepare for use.
do {
try chHapticEngine?.start()
// Indicate that the next time the app requires a haptic, the app doesn't need to call engine.start().
engineNeedsStart = false
} catch let error {
print("The engine failed to start with error: \(error)")
}
}
func generateStandardResponseHaptic() {
generateHaptic(code: MC_DOT)
}
func generateErrorHaptic() {
generateHaptic(code: RESULT_FAILURE)
}
func playSelectedCharacterHaptic(inputString : String, inputIndex : Int) {
let index = inputString.index(inputString.startIndex, offsetBy: inputIndex)
let char = String(inputString[index])
if char == "." || char == "x" {
//try? hapticForMorseCode(isDash: false)
generateHaptic(code: MC_DOT)
}
if char == "-" || char == "o" {
//try? hapticForMorseCode(isDash: true)
generateHaptic(code: MC_DASH)
}
if char == "|" {
//WKInterfaceDevice.current().play(.success)
generateHaptic(code: RESULT_SUCCESS)
}
}
func generateHaptic(code : String?) {
if supportsHaptics == false {
if code == MC_DOT {
// 'Peek' feedback (weak boom)
//let peek = SystemSoundID(1519)
//AudioServicesPlaySystemSound(peek)
// 'Pop' feedback (strong boom)
let pop = SystemSoundID(1520)
AudioServicesPlaySystemSound(pop)
}
else if code == MC_DASH {
// 'Try Again' feedback (week boom then strong boom)
let tryAgain = SystemSoundID(1102)
AudioServicesPlaySystemSound(tryAgain)
}
else if code == RESULT_SUCCESS {
AudioServicesPlayAlertSound(kSystemSoundID_Vibrate)
}
return
}
var hapticPlayer : CHHapticPatternPlayer? = nil
do {
if code == MC_DOT {
hapticPlayer = try hapticForMorseCode(isDash: false)
}
else if code == MC_DASH {
hapticPlayer = try hapticForMorseCode(isDash: true)
}
else if code == RESULT_SUCCESS {
//hapticPlayer = try hapticForResult(success: true)
let generator = UINotificationFeedbackGenerator()
generator.notificationOccurred(.success)
}
else if code == RESULT_FAILURE {
//hapticPlayer = try hapticForResult(success: false)
let generator = UINotificationFeedbackGenerator()
generator.notificationOccurred(.error)
}
try hapticPlayer?.start(atTime: CHHapticTimeImmediate)
} catch let error {
print("Generate haptic error is: \(error)")
}
}
func hapticsForEndofEntireAlphanumeric() {
if supportsHaptics == false {
AudioServicesPlayAlertSound(kSystemSoundID_Vibrate)
return
}
var hapticPlayer : CHHapticPatternPlayer? = nil
do {
//hapticPlayer = try hapticForResult(success: true)
let generator = UINotificationFeedbackGenerator()
generator.notificationOccurred(.success)
try hapticPlayer?.start(atTime: CHHapticTimeImmediate)
} catch let error {
print("Generate haptic error is: \(error)")
}
}
private func hapticForResult(success : Bool) throws -> CHHapticPatternPlayer? {
let volume = linearInterpolation(alpha: 1, min: 0.1, max: 0.4)
let decay: Float = linearInterpolation(alpha: 1, min: 0.0, max: 0.1)
let audioEvent = CHHapticEvent(eventType: .audioContinuous, parameters: [
CHHapticEventParameter(parameterID: .audioPitch, value: -0.15),
CHHapticEventParameter(parameterID: .audioVolume, value: volume),
CHHapticEventParameter(parameterID: .decayTime, value: decay),
CHHapticEventParameter(parameterID: .sustained, value: 0)
], relativeTime: 0)
let sharpness : Float = success == true ? 0.5 : 1.0 //Success haptics is more dull. Failure haptic is more sharp
let intensity : Float = 1.0
let duration = TimeInterval(2.0) //Success/failure haptics are more drawn out. Based on testing, 2 seconds can be identified as longer
let hapticEvent = CHHapticEvent(eventType: .hapticTransient, parameters: [
CHHapticEventParameter(parameterID: .hapticSharpness, value: sharpness),
CHHapticEventParameter(parameterID: .hapticIntensity, value: intensity)
], relativeTime: 0, duration: duration)
let pattern = try CHHapticPattern(events: [/*audioEvent,*/ hapticEvent], parameters: [])
return try chHapticEngine?.makePlayer(with: pattern)
}
private func hapticForMorseCode(isDash : Bool) throws -> CHHapticPatternPlayer? {
let volume = linearInterpolation(alpha: 1, min: 0.1, max: 0.4)
let decay: Float = linearInterpolation(alpha: 1, min: 0.0, max: 0.1)
let audioEvent = CHHapticEvent(eventType: .audioContinuous, parameters: [
CHHapticEventParameter(parameterID: .audioPitch, value: -0.15),
CHHapticEventParameter(parameterID: .audioVolume, value: volume),
CHHapticEventParameter(parameterID: .decayTime, value: decay),
CHHapticEventParameter(parameterID: .sustained, value: 0)
], relativeTime: 0)
let sharpness : Float = 1.0
let intensity : Float = 1.0
//For dash, a longer ping
let duration = TimeInterval(0.25)
let hapticDash = CHHapticEvent(eventType: .hapticContinuous, parameters: [
CHHapticEventParameter(parameterID: .hapticSharpness, value: sharpness),
CHHapticEventParameter(parameterID: .hapticIntensity, value: intensity)
], relativeTime: 0, duration: duration)
/* //For dash, its 2 pings
let hapticDash1 = CHHapticEvent(eventType: .hapticTransient, parameters: [
CHHapticEventParameter(parameterID: .hapticSharpness, value: sharpness),
CHHapticEventParameter(parameterID: .hapticIntensity, value: intensity)
], relativeTime: 0)
let hapticDash2 = CHHapticEvent(eventType: .hapticTransient, parameters: [
CHHapticEventParameter(parameterID: .hapticSharpness, value: sharpness),
CHHapticEventParameter(parameterID: .hapticIntensity, value: intensity)
], relativeTime: 0.5) */
//For dot its a single ping
let hapticDot = CHHapticEvent(eventType: .hapticTransient, parameters: [
CHHapticEventParameter(parameterID: .hapticSharpness, value: sharpness),
CHHapticEventParameter(parameterID: .hapticIntensity, value: intensity)
], relativeTime: 0)
let hapticEvents = isDash == true ? [/*hapticDash1, hapticDash2*/hapticDash] : [hapticDot]
let pattern = try CHHapticPattern(events: hapticEvents, parameters: [])
return try chHapticEngine?.makePlayer(with: pattern)
}
func linearInterpolation(alpha: Float, min: Float, max: Float) -> Float {
return min + alpha * (max - min)
}
}
|
[
-1
] |
6740bab60214b63478a64ad7bdb9c07f8b7c7c89
|
f50ec5626cef35eef2e75f10cdf54aafd02cb17f
|
/week6Assignment/week6Assignment/viewcontrollers/BookmarkViewController.swift
|
b652eeae7f0a5f27eb7b779bb6e3adc9230cccac
|
[] |
no_license
|
suwinphyu/iOS_week6Assignment
|
5be1eee3920fd9ad5404d4f7f4237936de771241
|
39bcad90f0cf4ae754b485a6aa2c863ca52cc7b2
|
refs/heads/master
| 2020-07-21T17:13:27.916553 | 2019-09-07T16:49:00 | 2019-09-07T16:49:00 | 206,928,898 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 767 |
swift
|
//
// BookmarkViewController.swift
// week6Assignment
//
// Created by Su Win Phyu on 9/6/19.
// Copyright © 2019 swp. All rights reserved.
//
import UIKit
class BookmarkViewController: UIViewController {
static let identifier = "BookmarkViewController"
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.
}
*/
}
|
[
241633,
175462,
325448,
324172,
210075,
159025,
326971,
329235,
342552,
338617,
320506,
210043,
340988,
334205,
149306
] |
6b1563413d692aaa4930a62d8cf056ab9ea11ba9
|
c36845fa2a358a7009ff20d814921e11f366747a
|
/Sources/SwiftSDAIap242/type-ap242/F/font_select.swift
|
23e259699c5c6189b986091744855c626a45e339
|
[
"MIT"
] |
permissive
|
tsun7170/SwiftSDAIap242
|
d7aaa707099ded34539ef82318ab7e2f73e3bd04
|
d1b72f0b5586db6cdd8a19c55fef120e943b7b6a
|
refs/heads/main
| 2022-09-04T02:02:06.286519 | 2022-08-14T11:09:16 | 2022-08-14T11:09:16 | 413,585,320 | 1 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 23,193 |
swift
|
/* file: font_select.swift generated: Mon Jan 3 16:32:52 2022 */
/* This file was generated by the EXPRESS to Swift translator "exp2swift",
derived from STEPcode (formerly NIST's SCL).
exp2swift version: v.1.0.1, derived from stepcode v0.8 as of 2019/11/23
WARNING: You probably don't want to edit it since your modifications
will be lost if exp2swift is used to regenerate it.
*/
import SwiftSDAIcore
extension AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF {
//MARK: -TYPE DEFINITION in EXPRESS
/*
TYPE font_select = SELECT
( externally_defined_text_font (*ENTITY*),
pre_defined_text_font (*ENTITY*),
text_font (*ENTITY*) );
END_TYPE; -- font_select (line:3184 file:ap242ed2_mim_lf_v1.101.TY.exp)
*/
//MARK: - ALL DEFINED ATTRIBUTES FOR SELECT
/*
externally_defined_text_font (*ENTITY*):
ATTR: item_id: source_item
ATTR: source: external_source
pre_defined_text_font (*ENTITY*):
ATTR: name: label *** Multiple Select Case Sources ***
text_font (*ENTITY*):
ATTR: description: text
ATTR: glyphs: SET [1 : ?] OF character_glyph_font_usage
ATTR: id: identifier
ATTR: name: label *** Multiple Select Case Sources ***
*/
/** SELECT type
- EXPRESS:
```express
TYPE font_select = SELECT
( externally_defined_text_font (*ENTITY*),
pre_defined_text_font (*ENTITY*),
text_font (*ENTITY*) );
END_TYPE; -- font_select (line:3184 file:ap242ed2_mim_lf_v1.101.TY.exp)
```
*/
public enum sFONT_SELECT : SDAIValue, AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF__sFONT_SELECT__type {
/// SELECT case ``eEXTERNALLY_DEFINED_TEXT_FONT`` (ENTITY) in ``sFONT_SELECT``
case _EXTERNALLY_DEFINED_TEXT_FONT(eEXTERNALLY_DEFINED_TEXT_FONT) // (ENTITY)
/// SELECT case ``ePRE_DEFINED_TEXT_FONT`` (ENTITY) in ``sFONT_SELECT``
case _PRE_DEFINED_TEXT_FONT(ePRE_DEFINED_TEXT_FONT) // (ENTITY)
/// SELECT case ``eTEXT_FONT`` (ENTITY) in ``sFONT_SELECT``
case _TEXT_FONT(eTEXT_FONT) // (ENTITY)
//MARK: - CONSTRUCTORS
public init(fundamental: FundamentalType) { self = fundamental }
public init?<T: SDAIUnderlyingType>(possiblyFrom underlyingType: T?){
return nil
}
public init?(possiblyFrom complex: SDAI.ComplexEntity?) {
guard let complex = complex else { return nil }
if let base = complex.entityReference(eEXTERNALLY_DEFINED_TEXT_FONT.self) {self = ._EXTERNALLY_DEFINED_TEXT_FONT(base) }
else if let base = complex.entityReference(ePRE_DEFINED_TEXT_FONT.self) {self = ._PRE_DEFINED_TEXT_FONT(base) }
else if let base = complex.entityReference(eTEXT_FONT.self) {self = ._TEXT_FONT(base) }
else { return nil }
}
public init?<G: SDAIGenericType>(fromGeneric generic: G?) {
guard let select = generic else { return nil }
if let fundamental = select as? Self {
self.init(fundamental: fundamental)
}
else if let base = eEXTERNALLY_DEFINED_TEXT_FONT.convert(fromGeneric: select) {
self = ._EXTERNALLY_DEFINED_TEXT_FONT(base)
}
else if let base = ePRE_DEFINED_TEXT_FONT.convert(fromGeneric: select) {
self = ._PRE_DEFINED_TEXT_FONT(base)
}
else if let base = eTEXT_FONT.convert(fromGeneric: select) {
self = ._TEXT_FONT(base)
}
else { return nil }
}
// InitializableByP21Parameter
public static var bareTypeName: String = "FONT_SELECT"
public init?(p21typedParam: P21Decode.ExchangeStructure.TypedParameter, from exchangeStructure: P21Decode.ExchangeStructure) {
guard let keyword = p21typedParam.keyword.asStandardKeyword else { exchangeStructure.error = "unexpected p21parameter(\(p21typedParam)) while resolving \(Self.bareTypeName) select value"; return nil }
switch(keyword) {
default:
exchangeStructure.error = "unexpected p21parameter(\(p21typedParam)) while resolving \(Self.bareTypeName) select value"
return nil
}
}
public init?(p21untypedParam: P21Decode.ExchangeStructure.UntypedParameter, from exchangeStructure: P21Decode.ExchangeStructure) {
switch p21untypedParam {
case .rhsOccurenceName(let rhsname):
switch rhsname {
case .constantEntityName(let name):
guard let entity = exchangeStructure.resolve(constantEntityName: name) else {exchangeStructure.add(errorContext: "while resolving \(Self.bareTypeName) instance"); return nil }
self.init(possiblyFrom: entity.complexEntity)
case .entityInstanceName(let name):
guard let complex = exchangeStructure.resolve(entityInstanceName: name) else {exchangeStructure.add(errorContext: "while resolving \(Self.bareTypeName) instance"); return nil }
self.init(possiblyFrom: complex)
default:
exchangeStructure.error = "unexpected p21parameter(\(p21untypedParam)) while resolving \(Self.bareTypeName) select instance"
return nil
}
default:
exchangeStructure.error = "unexpected p21parameter(\(p21untypedParam)) while resolving \(Self.bareTypeName) select instance"
return nil
}
}
public init?(p21omittedParamfrom exchangeStructure: P21Decode.ExchangeStructure) {
return nil
}
//MARK: - ENTITY UNDERLYING TYPE REFERENCES
public var super_ePRE_DEFINED_TEXT_FONT: ePRE_DEFINED_TEXT_FONT? {
switch self {
case ._PRE_DEFINED_TEXT_FONT(let entity): return entity
default: return nil
}
}
public var super_ePRE_DEFINED_ITEM: ePRE_DEFINED_ITEM? {
switch self {
case ._PRE_DEFINED_TEXT_FONT(let entity): return entity.super_ePRE_DEFINED_ITEM
default: return nil
}
}
public var super_eEXTERNALLY_DEFINED_ITEM: eEXTERNALLY_DEFINED_ITEM? {
switch self {
case ._EXTERNALLY_DEFINED_TEXT_FONT(let entity): return entity.super_eEXTERNALLY_DEFINED_ITEM
default: return nil
}
}
public var super_eEXTERNALLY_DEFINED_TEXT_FONT: eEXTERNALLY_DEFINED_TEXT_FONT? {
switch self {
case ._EXTERNALLY_DEFINED_TEXT_FONT(let entity): return entity
default: return nil
}
}
public var super_eTEXT_FONT: eTEXT_FONT? {
switch self {
case ._TEXT_FONT(let entity): return entity
default: return nil
}
}
//MARK: - ENTITY ATTRIBUTE REFERENCES
/// attribute of SELECT type ``sFONT_SELECT``
/// - origin: ENTITY( ``eEXTERNALLY_DEFINED_TEXT_FONT`` )
public var ITEM_ID: sSOURCE_ITEM? {
switch self {
case ._EXTERNALLY_DEFINED_TEXT_FONT(let entity): return entity.ITEM_ID
default: return nil
}
}
/// attribute of SELECT type ``sFONT_SELECT``
/// - origin: ENTITY( ``eTEXT_FONT`` )
public var DESCRIPTION: tTEXT? {
switch self {
case ._TEXT_FONT(let entity): return entity.DESCRIPTION
default: return nil
}
}
/// attribute of SELECT type ``sFONT_SELECT``
/// - origin: ENTITY( ``eTEXT_FONT`` )
public var GLYPHS: (SDAI.SET<eCHARACTER_GLYPH_FONT_USAGE>/*[1:nil]*/ )? {
switch self {
case ._TEXT_FONT(let entity): return entity.GLYPHS
default: return nil
}
}
/// attribute of SELECT type ``sFONT_SELECT``
/// - origin: ENTITY( ``eEXTERNALLY_DEFINED_TEXT_FONT`` )
public var SOURCE: eEXTERNAL_SOURCE? {
switch self {
case ._EXTERNALLY_DEFINED_TEXT_FONT(let entity): return entity.SOURCE
default: return nil
}
}
/// attribute of SELECT type ``sFONT_SELECT``
/// - origin: ENTITY( ``eTEXT_FONT`` )
public var ID: tIDENTIFIER? {
switch self {
case ._TEXT_FONT(let entity): return entity.ID
default: return nil
}
}
/// attribute of SELECT type ``sFONT_SELECT``
/// - origin: ENTITY( ``ePRE_DEFINED_TEXT_FONT`` )
/// - origin: ENTITY( ``eTEXT_FONT`` )
public var NAME: tLABEL? {
switch self {
case ._PRE_DEFINED_TEXT_FONT(let entity): return entity.NAME
case ._TEXT_FONT(let entity): return entity.NAME
default: return nil
}
}
//MARK: - SDAIValue
public func isValueEqual<T: SDAIValue>(to rhs: T) -> Bool {
switch self {
case ._EXTERNALLY_DEFINED_TEXT_FONT(let selection): return selection.value.isValueEqual(to: rhs)
case ._PRE_DEFINED_TEXT_FONT(let selection): return selection.value.isValueEqual(to: rhs)
case ._TEXT_FONT(let selection): return selection.value.isValueEqual(to: rhs)
}
}
public func isValueEqualOptionally<T: SDAIValue>(to rhs: T?) -> Bool? {
switch self {
case ._EXTERNALLY_DEFINED_TEXT_FONT(let selection): return selection.value.isValueEqualOptionally(to: rhs)
case ._PRE_DEFINED_TEXT_FONT(let selection): return selection.value.isValueEqualOptionally(to: rhs)
case ._TEXT_FONT(let selection): return selection.value.isValueEqualOptionally(to: rhs)
}
}
public func hashAsValue(into hasher: inout Hasher, visited complexEntities: inout Set<SDAI.ComplexEntity>) {
switch self {
case ._EXTERNALLY_DEFINED_TEXT_FONT(let selection): selection.value.hashAsValue(into: &hasher, visited: &complexEntities)
case ._PRE_DEFINED_TEXT_FONT(let selection): selection.value.hashAsValue(into: &hasher, visited: &complexEntities)
case ._TEXT_FONT(let selection): selection.value.hashAsValue(into: &hasher, visited: &complexEntities)
}
}
public func isValueEqual<T: SDAIValue>(to rhs: T, visited comppairs: inout Set<SDAI.ComplexPair>) -> Bool {
switch self {
case ._EXTERNALLY_DEFINED_TEXT_FONT(let selection): return selection.value.isValueEqual(to: rhs, visited: &comppairs)
case ._PRE_DEFINED_TEXT_FONT(let selection): return selection.value.isValueEqual(to: rhs, visited: &comppairs)
case ._TEXT_FONT(let selection): return selection.value.isValueEqual(to: rhs, visited: &comppairs)
}
}
public func isValueEqualOptionally<T: SDAIValue>(to rhs: T?, visited comppairs: inout Set<SDAI.ComplexPair>) -> Bool? {
switch self {
case ._EXTERNALLY_DEFINED_TEXT_FONT(let selection): return selection.value.isValueEqualOptionally(to: rhs, visited: &comppairs)
case ._PRE_DEFINED_TEXT_FONT(let selection): return selection.value.isValueEqualOptionally(to: rhs, visited: &comppairs)
case ._TEXT_FONT(let selection): return selection.value.isValueEqualOptionally(to: rhs, visited: &comppairs)
}
}
//MARK: SDAIGenericTypeBase
public func copy() -> Self {
switch self {
case ._EXTERNALLY_DEFINED_TEXT_FONT(let selection): return ._EXTERNALLY_DEFINED_TEXT_FONT(selection.copy())
case ._PRE_DEFINED_TEXT_FONT(let selection): return ._PRE_DEFINED_TEXT_FONT(selection.copy())
case ._TEXT_FONT(let selection): return ._TEXT_FONT(selection.copy())
}
}
//MARK: SDAIGenericType
public var typeMembers: Set<SDAI.STRING> {
var members: Set<SDAI.STRING> = [SDAI.STRING(Self.typeName)]
switch self {
case ._EXTERNALLY_DEFINED_TEXT_FONT(let selection): members.formUnion(selection.typeMembers)
case ._PRE_DEFINED_TEXT_FONT(let selection): members.formUnion(selection.typeMembers)
case ._TEXT_FONT(let selection): members.formUnion(selection.typeMembers)
}
return members
}
public var entityReference: SDAI.EntityReference? {
switch self {
case ._EXTERNALLY_DEFINED_TEXT_FONT(let selection): return selection.entityReference
case ._PRE_DEFINED_TEXT_FONT(let selection): return selection.entityReference
case ._TEXT_FONT(let selection): return selection.entityReference
}
}
public var stringValue: SDAI.STRING? {
switch self {
case ._EXTERNALLY_DEFINED_TEXT_FONT(let selection): return selection.stringValue
case ._PRE_DEFINED_TEXT_FONT(let selection): return selection.stringValue
case ._TEXT_FONT(let selection): return selection.stringValue
}
}
public var binaryValue: SDAI.BINARY? {
switch self {
case ._EXTERNALLY_DEFINED_TEXT_FONT(let selection): return selection.binaryValue
case ._PRE_DEFINED_TEXT_FONT(let selection): return selection.binaryValue
case ._TEXT_FONT(let selection): return selection.binaryValue
}
}
public var logicalValue: SDAI.LOGICAL? {
switch self {
case ._EXTERNALLY_DEFINED_TEXT_FONT(let selection): return selection.logicalValue
case ._PRE_DEFINED_TEXT_FONT(let selection): return selection.logicalValue
case ._TEXT_FONT(let selection): return selection.logicalValue
}
}
public var booleanValue: SDAI.BOOLEAN? {
switch self {
case ._EXTERNALLY_DEFINED_TEXT_FONT(let selection): return selection.booleanValue
case ._PRE_DEFINED_TEXT_FONT(let selection): return selection.booleanValue
case ._TEXT_FONT(let selection): return selection.booleanValue
}
}
public var numberValue: SDAI.NUMBER? {
switch self {
case ._EXTERNALLY_DEFINED_TEXT_FONT(let selection): return selection.numberValue
case ._PRE_DEFINED_TEXT_FONT(let selection): return selection.numberValue
case ._TEXT_FONT(let selection): return selection.numberValue
}
}
public var realValue: SDAI.REAL? {
switch self {
case ._EXTERNALLY_DEFINED_TEXT_FONT(let selection): return selection.realValue
case ._PRE_DEFINED_TEXT_FONT(let selection): return selection.realValue
case ._TEXT_FONT(let selection): return selection.realValue
}
}
public var integerValue: SDAI.INTEGER? {
switch self {
case ._EXTERNALLY_DEFINED_TEXT_FONT(let selection): return selection.integerValue
case ._PRE_DEFINED_TEXT_FONT(let selection): return selection.integerValue
case ._TEXT_FONT(let selection): return selection.integerValue
}
}
public var genericEnumValue: SDAI.GenericEnumValue? {
switch self {
case ._EXTERNALLY_DEFINED_TEXT_FONT(let selection): return selection.genericEnumValue
case ._PRE_DEFINED_TEXT_FONT(let selection): return selection.genericEnumValue
case ._TEXT_FONT(let selection): return selection.genericEnumValue
}
}
public func arrayOptionalValue<ELEM:SDAIGenericType>(elementType:ELEM.Type) -> SDAI.ARRAY_OPTIONAL<ELEM>? {
switch self {
case ._EXTERNALLY_DEFINED_TEXT_FONT(let selection): return selection.arrayOptionalValue(elementType:elementType)
case ._PRE_DEFINED_TEXT_FONT(let selection): return selection.arrayOptionalValue(elementType:elementType)
case ._TEXT_FONT(let selection): return selection.arrayOptionalValue(elementType:elementType)
}
}
public func arrayValue<ELEM:SDAIGenericType>(elementType:ELEM.Type) -> SDAI.ARRAY<ELEM>? {
switch self {
case ._EXTERNALLY_DEFINED_TEXT_FONT(let selection): return selection.arrayValue(elementType:elementType)
case ._PRE_DEFINED_TEXT_FONT(let selection): return selection.arrayValue(elementType:elementType)
case ._TEXT_FONT(let selection): return selection.arrayValue(elementType:elementType)
}
}
public func listValue<ELEM:SDAIGenericType>(elementType:ELEM.Type) -> SDAI.LIST<ELEM>? {
switch self {
case ._EXTERNALLY_DEFINED_TEXT_FONT(let selection): return selection.listValue(elementType:elementType)
case ._PRE_DEFINED_TEXT_FONT(let selection): return selection.listValue(elementType:elementType)
case ._TEXT_FONT(let selection): return selection.listValue(elementType:elementType)
}
}
public func bagValue<ELEM:SDAIGenericType>(elementType:ELEM.Type) -> SDAI.BAG<ELEM>? {
switch self {
case ._EXTERNALLY_DEFINED_TEXT_FONT(let selection): return selection.bagValue(elementType:elementType)
case ._PRE_DEFINED_TEXT_FONT(let selection): return selection.bagValue(elementType:elementType)
case ._TEXT_FONT(let selection): return selection.bagValue(elementType:elementType)
}
}
public func setValue<ELEM:SDAIGenericType>(elementType:ELEM.Type) -> SDAI.SET<ELEM>? {
switch self {
case ._EXTERNALLY_DEFINED_TEXT_FONT(let selection): return selection.setValue(elementType:elementType)
case ._PRE_DEFINED_TEXT_FONT(let selection): return selection.setValue(elementType:elementType)
case ._TEXT_FONT(let selection): return selection.setValue(elementType:elementType)
}
}
public func enumValue<ENUM:SDAIEnumerationType>(enumType:ENUM.Type) -> ENUM? {
switch self {
case ._EXTERNALLY_DEFINED_TEXT_FONT(let selection): return selection.enumValue(enumType:enumType)
case ._PRE_DEFINED_TEXT_FONT(let selection): return selection.enumValue(enumType:enumType)
case ._TEXT_FONT(let selection): return selection.enumValue(enumType:enumType)
}
}
//MARK: SDAIUnderlyingType
public typealias FundamentalType = Self
public static var typeName: String = "AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF.FONT_SELECT"
public var asFundamentalType: FundamentalType { return self }
//MARK: SDAIObservableAggregateElement
public var entityReferences: AnySequence<SDAI.EntityReference> {
switch self {
case ._EXTERNALLY_DEFINED_TEXT_FONT(let entity): return entity.entityReferences
case ._PRE_DEFINED_TEXT_FONT(let entity): return entity.entityReferences
case ._TEXT_FONT(let entity): return entity.entityReferences
}
}
public mutating func configure(with observer: SDAI.EntityReferenceObserver) {
switch self {
case ._EXTERNALLY_DEFINED_TEXT_FONT(let entity):
entity.configure(with: observer)
self = ._EXTERNALLY_DEFINED_TEXT_FONT(entity)
case ._PRE_DEFINED_TEXT_FONT(let entity):
entity.configure(with: observer)
self = ._PRE_DEFINED_TEXT_FONT(entity)
case ._TEXT_FONT(let entity):
entity.configure(with: observer)
self = ._TEXT_FONT(entity)
}
}
public mutating func teardownObserver() {
switch self {
case ._EXTERNALLY_DEFINED_TEXT_FONT(let entity):
entity.teardownObserver()
self = ._EXTERNALLY_DEFINED_TEXT_FONT(entity)
case ._PRE_DEFINED_TEXT_FONT(let entity):
entity.teardownObserver()
self = ._PRE_DEFINED_TEXT_FONT(entity)
case ._TEXT_FONT(let entity):
entity.teardownObserver()
self = ._TEXT_FONT(entity)
}
}
//MARK: SDAIAggregationBehavior
public var aggregationHiBound: Int? {
switch self {
default: return nil
}
}
public var aggregationHiIndex: Int? {
switch self {
default: return nil
}
}
public var aggregationLoBound: Int? {
switch self {
default: return nil
}
}
public var aggregationLoIndex: Int? {
switch self {
default: return nil
}
}
public var aggregationSize: Int? {
switch self {
default: return nil
}
}
//MARK: WHERE RULE VALIDATION (SELECT TYPE)
public static func validateWhereRules(instance:Self?, prefix:SDAI.WhereLabel) -> [SDAI.WhereLabel:SDAI.LOGICAL] {
var result: [SDAI.WhereLabel:SDAI.LOGICAL] = [:]
switch instance {
case ._EXTERNALLY_DEFINED_TEXT_FONT(let selectValue):
result = eEXTERNALLY_DEFINED_TEXT_FONT.validateWhereRules(instance:selectValue,
prefix:prefix + "\\EXTERNALLY_DEFINED_TEXT_FONT")
case ._PRE_DEFINED_TEXT_FONT(let selectValue):
result = ePRE_DEFINED_TEXT_FONT.validateWhereRules(instance:selectValue,
prefix:prefix + "\\PRE_DEFINED_TEXT_FONT")
case ._TEXT_FONT(let selectValue): result = eTEXT_FONT.validateWhereRules(instance:selectValue,
prefix:prefix + "\\TEXT_FONT")
case nil: break
}
return result
}
}
}
//MARK: - SELECT TYPE HIERARCHY
public protocol AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF__sFONT_SELECT__type: SDAISelectType {
//MARK: GROUP REFERENCES
var super_ePRE_DEFINED_TEXT_FONT:
AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF.ePRE_DEFINED_TEXT_FONT? { get }
var super_ePRE_DEFINED_ITEM: AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF.ePRE_DEFINED_ITEM? { get }
var super_eEXTERNALLY_DEFINED_ITEM:
AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF.eEXTERNALLY_DEFINED_ITEM? { get }
var super_eEXTERNALLY_DEFINED_TEXT_FONT:
AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF.eEXTERNALLY_DEFINED_TEXT_FONT? { get }
var super_eTEXT_FONT: AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF.eTEXT_FONT? { get }
//MARK: ENTITY ATTRIBUTE REFERENCES
var ITEM_ID: AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF.sSOURCE_ITEM? { get }
var DESCRIPTION: AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF.tTEXT? { get }
var GLYPHS: (SDAI.SET<AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF.eCHARACTER_GLYPH_FONT_USAGE>/*[1:nil]*/ )? { get }
var SOURCE: AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF.eEXTERNAL_SOURCE? { get }
var ID: AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF.tIDENTIFIER? { get }
var NAME: AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF.tLABEL? { get }
}
public protocol AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF__sFONT_SELECT__subtype:
AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF__sFONT_SELECT__type, SDAIDefinedType
where Supertype: AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF__sFONT_SELECT__type
{}
public extension AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF__sFONT_SELECT__subtype {
//MARK: CONSTRUCTORS
init?(possiblyFrom complex: SDAI.ComplexEntity?) {
self.init(fundamental: FundamentalType(possiblyFrom: complex))
}
init?<T: SDAIUnderlyingType>(possiblyFrom underlyingType: T?) {
self.init(fundamental: FundamentalType(possiblyFrom: underlyingType))
}
init?<G: SDAIGenericType>(fromGeneric generic: G?) {
self.init(fundamental: FundamentalType.convert(fromGeneric: generic))
}
//MARK: GROUP REFERENCES
var super_ePRE_DEFINED_TEXT_FONT: AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF.ePRE_DEFINED_TEXT_FONT? { rep.super_ePRE_DEFINED_TEXT_FONT }
var super_ePRE_DEFINED_ITEM:
AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF.ePRE_DEFINED_ITEM? { rep.super_ePRE_DEFINED_ITEM }
var super_eEXTERNALLY_DEFINED_ITEM: AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF.eEXTERNALLY_DEFINED_ITEM? { rep.super_eEXTERNALLY_DEFINED_ITEM }
var super_eEXTERNALLY_DEFINED_TEXT_FONT: AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF.eEXTERNALLY_DEFINED_TEXT_FONT? { rep.super_eEXTERNALLY_DEFINED_TEXT_FONT }
var super_eTEXT_FONT: AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF.eTEXT_FONT? { rep.super_eTEXT_FONT }
//MARK: ENTITY ATTRIBUTE REFERENCES
var ITEM_ID: AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF.sSOURCE_ITEM? { rep.ITEM_ID }
var DESCRIPTION: AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF.tTEXT? { rep.DESCRIPTION }
var GLYPHS: (SDAI.SET<AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF.eCHARACTER_GLYPH_FONT_USAGE>/*[1:nil]*/ )? { rep.GLYPHS }
var SOURCE: AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF.eEXTERNAL_SOURCE? { rep.SOURCE }
var ID: AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF.tIDENTIFIER? { rep.ID }
var NAME: AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF.tLABEL? { rep.NAME }
}
|
[
-1
] |
b1c02a42b88b52b651d40c45a91072e979030e8e
|
db595bf8047cf56ebad733ca7fa369913862d5a4
|
/2019.11.11(월)-조건문, 반복문, 제어/수업(조건,제어,반복) 복사본.playground/Pages/Tuples.xcplaygroundpage/Contents.swift
|
f44303ff2b9a1f45a7d05b0bab0ef7fe8ac99131
|
[] |
no_license
|
hongkimin1126/iOS-FastCampus
|
c3f0b446ebea82717741897b60fd3c253cd1e3bc
|
2d4cc32317949ef9fe661adf5668d546d0955a0f
|
refs/heads/master
| 2022-06-13T16:51:29.011068 | 2020-05-05T09:10:08 | 2020-05-05T09:10:08 | 260,648,498 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 2,944 |
swift
|
//: [Previous](@previous)
/*:
---
# Tuples
---
*/
/*:
---
## Unnamed Tuple
---
*/
let number: Int = 10
let threeNumbers: (Int, Int, Int) = (1, 2, 5) //여러개 값 넣는 튜플
type(of: threeNumbers)
threeNumbers
threeNumbers.0
threeNumbers.1
threeNumbers.2
var threeValues: (Int, Double, String) = (10, 100.0, "이름")
type(of: threeValues)
threeValues
threeValues.0 = 5
threeValues
/*:
## Decomposition
*/
let numbers = threeNumbers
numbers
numbers.0
numbers.1
let (first, second, third) = threeNumbers
first
second
third
// wildcard pattern
let (_, second1, third1) = threeNumbers
second1
third1
/*:
---
## Named Tuple
---
*/
let iOS = (language: "Swift", version: "4")
//let iOS: (language: String, version: String) = (language: "Swift", version: "4")
//let iOS: (language: String, version: String) = ("Swift", "4")
//let iOS = (language: "Swift", version: "4")
iOS.0
iOS.1
iOS.language
iOS.version
func 튜플(a: Int, b: (Int, Int)) -> (first: Int, second: Int) //반환도 튜플로 받겠다.
{
return (a + b.0, a + b.1)
}
let result = 튜플(a: 10, b: (20, 30))
result.first
result.second
/*:
## Comparison Operators
* Tuple 은 7개 미만 요소에 대한 비교 연산자가 포함되어 있음
* 7개 이상의 요소를 비교하기 위해서는 비교 연산자를 직접 구현해야 함
*/
//var something1: (Int, Int, Int, Int, Int, Int) = (1,2,3,4,5,6)
//var something2: (Int, Int, Int, Int, Int, Int) = (1,2,3,4,5,6)
//something1 == something2
//var something3: (Int, Int, Int, Int, Int, Int, Int) = (1,2,3,4,5,6,7) //6개까지만 사용가능하기 때문에 에러난다.
//var something4: (Int, Int, Int, Int, Int, Int, Int) = (1,2,3,4,5,6,7) //6개까지만 사용가능하기 때문에 에러난다.
//something3 == something4
// 다음의 비교 결과는?
(1, "zebra") < (2, "apple") //true
(3, "apple") > (3, "bird") //false
("3.14", 99) > ("1.99", 1) //true
("blue", 1) > ("bluesky", -1) //false
(4, "dog") == (4, "dog") //true
// Q. 다음 튜플 연산에 대한 결과는?
//
// - ("일", 1) > ("이", 2.0) //true
// - (1, "zebra") < ("2", "apple") //true
// - ("blue", false) < ("purple", true)//
//
/*:
---
## Tuple Matching
---
*/
let somePoint = (1, 1)
switch somePoint
{
case (0, 0):
print("\(somePoint) is at the origin")
case (_, 0):
print("\(somePoint) is on the x-axis")
case (0, _):
print("\(somePoint) is on the y-axis")
case (-2...2, -2...2):
print("\(somePoint) is inside the box")
default:
print("\(somePoint) is outside of the box")
}
/*:
## Dictionary Enumeration
*/
let fruits = ["A": "Apple", "B": "Banana", "C": "Cherry"]
for (key, value) in fruits
{
print(key, value)
}
print()
//for element in fruits {
// // 어떤 식으로 출력해야 할까요?
//}
for i in fruits
{
i.0
i.1
i.key
i.value
}
//: [Next](@next)
|
[
-1
] |
a3ba3ad50b2de12238a42b55c0f495dd2852c0e6
|
1a8124f71a5467e2f1266a0d929d0d5df34ef777
|
/LionsAndTigersTests/LionsAndTigersTests.swift
|
8ca0e5e393111c03a759db43e1dc659d225e15a6
|
[] |
no_license
|
hectorrios/LionsAndTigers
|
b865e723c1b41b134349dad8d1ca355316d74ff5
|
ddca820df54d3a3a1c345dc314bc473249b6dd01
|
refs/heads/master
| 2021-01-22T09:27:56.785273 | 2015-05-13T06:35:24 | 2015-05-13T06:35:24 | 29,585,227 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 920 |
swift
|
//
// LionsAndTigersTests.swift
// LionsAndTigersTests
//
// Created by Juice Rios on 12/22/14.
// Copyright (c) 2014 HectorRios. All rights reserved.
//
import UIKit
import XCTest
class LionsAndTigersTests: 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.
}
}
}
|
[
234498,
276484,
276998,
278023,
277513,
276492,
275469,
277517,
197647,
278544,
234509,
279054,
295953,
223767,
234522,
276509,
234531,
277029,
278060,
310317,
281138,
275506,
234548,
228917,
277048,
156733,
277566,
276543,
234560,
369220,
234565,
277574,
234569,
280649,
277579,
277066,
276046,
226897,
277585,
207953,
223318,
234583,
226906,
277083,
194652,
147036,
194653,
226910,
278624,
276577,
277603,
276581,
277101,
189037,
227439,
276592,
275571,
276084,
276085,
227446,
276088,
234616,
277118,
234622,
188031,
276097,
275585,
226435,
276100,
276101,
276613,
234632,
277640,
277133,
225936,
226451,
226452,
276627,
276631,
276120,
225944,
278170,
276632,
276126,
164512,
277665,
276129,
234659,
227492,
227495,
285353,
225962,
208043,
278191,
226481,
276146,
276148,
296628,
277686,
154294,
176314,
276156,
276165,
278214,
276682,
276172,
276173,
225997,
276687,
276684,
226001,
277203,
276180,
278742,
226007,
155867,
201442,
226019,
277219,
276195,
276710,
285929,
226033,
276210,
226035,
226036,
157944,
226043,
234238,
276737,
226051,
234245,
204041,
226058,
234250,
203529,
278285,
234256,
276753,
157970,
227091,
184086,
234263,
276760,
278810,
278299,
276764,
276253,
234268,
105246,
277792,
276257,
278307,
234280,
277800,
113962,
277289,
159533,
165677,
234286,
277294,
226609,
226608,
277814,
276279,
277815,
276282,
276283,
162621,
234301,
234304,
234305,
277824,
277825,
277831,
278856,
226632,
276298,
276813,
278862,
234317,
142669,
277841,
6482,
234323,
277838,
276821,
234326,
277327,
277339,
276318,
276831,
234335,
277856,
218462,
234340,
276325,
276839,
234346,
277354,
276332,
234349,
281962,
277871,
277360,
279919,
278898,
276847,
277878,
275831,
276344,
226170,
234366,
234367,
227199,
280961,
277890,
276350,
226181,
226694,
213894,
277381,
234377,
277897,
281992,
277900,
226189,
234381,
40850,
234387,
206228,
40853,
296338,
234392,
234395,
277919,
234400,
277920,
277410,
234404,
276900,
227238,
277925,
234409,
276394,
275371,
276400,
277936,
234419,
277939,
278965,
277943,
276408,
234425,
278969,
277435,
234436,
275397,
276421,
276422,
296391,
234445,
277965,
275410,
234451,
284116,
277974,
234457,
279002,
276443,
275418,
153566,
234463,
276958,
276962,
276451,
276963,
277988,
276454,
277479,
277480,
277994,
279019,
276459,
234477,
276462,
278002,
276468,
226805,
276469,
278518,
278008,
276475,
234492,
276478,
234495
] |
bde962c79f471487dc42b2c55e07db2390bad842
|
639d3323dcab84973e1f4fce3d7c388bbc929aa7
|
/RxFeedbackDemo/Modules/Main/MainScreenIO.swift
|
0db394401df2bd24ce20d75b7febd55a0ca6abcd
|
[
"MIT"
] |
permissive
|
dvstupivtsev/RxFeedbackDemo
|
0569a1eff78dbfd0aab3d45d83eca6edc25b14e3
|
a4d0535c1405efc7454c37fc5d0d4a7291830384
|
refs/heads/master
| 2020-07-15T19:43:41.643026 | 2019-09-08T19:15:23 | 2019-09-08T19:15:23 | 205,636,402 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 327 |
swift
|
//
// Created by Stupivtsev Dmitriy on 03/09/2019.
//
import Foundation
import RxSwift
protocol MainScreenIO {
var playerPitchText: AnyObserver<String?> { get }
var machinePitchText: AnyObserver<String?> { get }
var pitchButtonHidden: AnyObserver<Bool> { get }
var pitchButtonTap: Observable<Void> { get }
}
|
[
-1
] |
e5d0ed712aead20d455e63040a10b6c793f9b6d6
|
192c3be947d8e684527c8072fea48f9ea95cab57
|
/ScheduleChart/Chart/helpers/ShapeLayer.swift
|
08d5a6dfbcf4be6ee298a5b645b05aac89ad9ac4
|
[
"MIT"
] |
permissive
|
dima-xo/TelegramChart
|
6b9d27dd900a909ecb9fb74da34b07008012b99a
|
968384d6d8f06ce6626d2c5de01f123b0c95208d
|
refs/heads/master
| 2022-03-26T10:25:17.089567 | 2019-10-24T13:35:41 | 2019-10-24T13:35:41 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 295 |
swift
|
//
// ShapeLayer.swift
// ScheduleChart
//
// Created by Alexander Graschenkov on 07/04/2019.
// Copyright © 2019 Alex the Best. All rights reserved.
//
import UIKit
class ShapeLayer: CAShapeLayer {
override func action(forKey event: String) -> CAAction? {
return nil
}
}
|
[
-1
] |
176fdabd362b5d4c7654941dadef501668620e1e
|
9b452bce08e3d4826bea62877c77198280c7b08e
|
/Source/AddressBook/ViewControllers/AddressBookAddViewController.swift
|
5fcb415e8f6d136a777942e16efa087f2d7873d8
|
[] |
no_license
|
SmartCash/smarthub_ios
|
5c030a73d064de14bacbef8c6245acc3c2461101
|
a41d9525344472d69fac6b9d39097769887b992d
|
refs/heads/master
| 2020-11-25T02:44:35.803573 | 2019-12-20T08:37:15 | 2019-12-20T08:37:15 | 228,458,573 | 1 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 3,373 |
swift
|
//
// AddressBookAddViewController.swift
// SmartcashWallet
//
// Created by Erick Vavretchek on 8/10/17.
// Copyright © 2017 Erick Vavretchek. All rights reserved.
//
import UIKit
import FirebaseAnalytics
class AddressBookAddViewController: UIViewController {
@IBOutlet weak var nameTextField: UITextField!
@IBOutlet weak var addressTextField: UITextField!
@IBOutlet weak var qrButton: UIButton!
var viewModel: AddressBookAddViewModel!
var loadingView: UIView = LoadingView.make()
override func viewDidLoad() {
super.viewDidLoad()
prepareNavigationController()
qrButton.layer.cornerRadius = 5
qrButton.layer.borderColor = SmartcashKit.Colors.yellow.cgColor
qrButton.layer.borderWidth = 1
qrButton.clipsToBounds = true
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
Analytics.setScreenName("Add Address Book", screenClass: nil)
}
// MARK: Actions
@IBAction func cancelAction(_ sender: Any) {
dismiss(animated: true, completion: nil)
}
@IBAction func qrButtonAction(_ sender: Any) {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
if let qRScannerController = storyboard.instantiateViewController(withIdentifier: "QRScannerController") as? QRScannerController {
qRScannerController.delegate = self
present(qRScannerController, animated: true, completion: nil)
}
}
@IBAction func saveAction(_ sender: Any) {
guard
let name = nameTextField.text,
let address = addressTextField.text,
name != "",
address != ""
else { return }
view.endEditing(true)
viewModel.save(name: name, address: address)
}
// MARK: Private
private func prepareNavigationController() {
title = "Add Address"
if #available(iOS 11.0, *) {
navigationItem.largeTitleDisplayMode = .never
}
}
}
extension AddressBookAddViewController: QRCodeDelegate {
func updateQRCode(withAddress address: String) {
var workAddress = address
guard let index = address.index(of: ":") else {
addressTextField.text = address
return
}
let indexStartOfText = address.index(address.startIndex, offsetBy: 0)
let indexEndOfText = address.index(address.startIndex, offsetBy: index.encodedOffset + 1)
let scheme = address[indexStartOfText..<indexEndOfText]
if scheme == "smartcash:" {
workAddress = address.replacingOccurrences(of: scheme, with: "smartcash://")
print(workAddress)
}
if let index2 = workAddress.index(of: "?") {
print(index2.encodedOffset)
workAddress.insert("/", at: index2)
print(workAddress)
}
if let uri = URL(string: workAddress), let address = uri.host {
addressTextField.text = address
} else {
addressTextField.text = address
}
}
}
extension AddressBookAddViewController: AddressBookAddViewControllerProtocol {
func displayError(message: String) {
let alertController = UIAlertController(title: "Error", message: message, preferredStyle: .alert)
let okAction = UIAlertAction(title: "Ok", style: .default, handler: nil)
alertController.addAction(okAction)
present(alertController, animated: true, completion: nil)
}
func dismissScreen() {
dismiss(animated: true, completion: nil)
}
}
|
[
-1
] |
13364682196870617a3ac746c0fed4cfab69294b
|
07ccac0e19dbbdbcc4b88d6eb8433371c4b522ba
|
/CoinSaver/SceneDelegate.swift
|
1777b1a49f1deede8b085ada8f0f032e0b39d7f6
|
[] |
no_license
|
iOS-HSE/CoinSaver
|
1ba0bebcdfdc9b41b9208f9d23da145b842495b0
|
b5f1d4cb147151c169454d4741f0d32506b3bbfe
|
refs/heads/master
| 2023-02-03T14:01:23.517495 | 2020-12-18T20:42:09 | 2020-12-19T09:21:52 | 299,647,119 | 1 | 2 | null | 2020-12-18T10:10:40 | 2020-09-29T14:43:50 |
Swift
|
UTF-8
|
Swift
| false | false | 3,485 |
swift
|
//
// SceneDelegate.swift
// CoinSaver
//
// Created by fiskirton on 13.11.2020.
//
//
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 }
self.updateRootVC()
}
func updateRootVC(){
guard let window = self.window else { return }
let status = BasicUserSettings.isLoggedIn
var rootVC : UIViewController?
window.makeKeyAndVisible()
if(status == true){
rootVC = UIStoryboard(name: "HomeStoryboard", bundle: nil).instantiateViewController(withIdentifier: "TabBar") as! TabBarViewController
self.window?.rootViewController = rootVC
}else{
rootVC = UIStoryboard(name: "AuthStoryboard", bundle: nil).instantiateViewController(withIdentifier: "AuthNavController") as! NavigationController
self.window?.rootViewController = rootVC
}
self.window?.makeKeyAndVisible()
}
func changeRootViewController(_ vc: UIViewController, animated: Bool = true) {
guard let window = self.window else {
return
}
window.rootViewController = vc
UIView.transition(with: window,
duration: 0.5,
options: [.transitionCrossDissolve],
animations: nil,
completion: nil)
}
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.
}
}
|
[
-1
] |
2ea68aaf1509038ab5ae10306e61086b81f6a35c
|
f6e99770f5f7efba45f3e2154d7fa6559a8c90cd
|
/SwiftTemplet/UICollectionViewCell/NNCollectionViewTagsFlowLayout.swift
|
ba5ed3dd7e0334ef55660fa4020b8551bea806db
|
[] |
no_license
|
shang1219178163/SwiftTemplet
|
23abb7b489a6366c0a606e12bf36ec398121388d
|
d8781229cbb887a73b4506bcba62d6d07c2f618a
|
refs/heads/master
| 2023-07-19T19:16:58.370737 | 2023-07-18T02:46:33 | 2023-07-18T02:46:33 | 130,779,084 | 21 | 10 | null | 2019-04-23T01:18:21 | 2018-04-24T01:35:58 |
Swift
|
UTF-8
|
Swift
| false | false | 3,573 |
swift
|
//
// NNCollectionViewTagsFlowLayout.swift
// SwiftTemplet
//
// Created by Bin Shang on 2020/8/16.
// Copyright © 2020 BN. All rights reserved.
//
import UIKit
@objc protocol NNCollectionViewTagsFlowLayoutDelegate {
@objc func collectionView(_ collectionView:UICollectionView, itemSizeAt indexPath:NSIndexPath) -> CGSize
}
@objcMembers class NNCollectionViewTagsFlowLayout: UICollectionViewFlowLayout {
var delegate: NNCollectionViewTagsFlowLayoutDelegate?
private var itemAttributesCache: Array<UICollectionViewLayoutAttributes> = []
private var contentSize: CGSize = CGSize.zero
override var collectionViewContentSize: CGSize {
return contentSize
}
// MARK:-
// MARK:- Initialize
override init() {
super.init()
scrollDirection = .vertical;
minimumLineSpacing = 5.0
minimumInteritemSpacing = 5.0
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
scrollDirection = .vertical;
minimumLineSpacing = 5.0
minimumInteritemSpacing = 5.0
}
// MARK:-
// MARK:- Override
override func prepare() {
super.prepare()
if (collectionView?.numberOfSections == 0 ||
collectionView?.numberOfItems(inSection: 0) == 0) {
return
}
var x:CGFloat = 0
var y:CGFloat = 0
var iSize:CGSize = CGSize.zero
var indexPath:NSIndexPath?
let numberOfItems:NSInteger = (self.collectionView?.numberOfItems(inSection: 0))!
itemAttributesCache = []
for index in 0..<numberOfItems {
indexPath = NSIndexPath(item: index, section: 0)
iSize = (delegate?.collectionView(collectionView!, itemSizeAt: indexPath!))!
var itemRect:CGRect = CGRect(x: x, y: y, width: iSize.width, height: iSize.height)
if (x > 0 && (x + iSize.width + minimumInteritemSpacing > (collectionView?.frame.size.width)!)) {
//...Checking if item width is greater than collection view width then set item in new row.
itemRect.origin.x = 0
itemRect.origin.y = y + iSize.height + minimumLineSpacing
}
let itemAttributes = UICollectionViewLayoutAttributes(forCellWith: indexPath! as IndexPath)
itemAttributes.frame = itemRect
itemAttributesCache.append(itemAttributes)
x = itemRect.origin.x + iSize.width + minimumInteritemSpacing
y = itemRect.origin.y
}
y += iSize.height + self.minimumLineSpacing
x = 0
contentSize = CGSize(width: (collectionView?.frame.size.width)!, height: y)
}
override func shouldInvalidateLayout(forBoundsChange newBounds: CGRect) -> Bool {
return true
}
override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? {
let numberOfItems:NSInteger = (self.collectionView?.numberOfItems(inSection: 0))!
let itemAttributes = itemAttributesCache.filter {
$0.frame.intersects(rect) &&
$0.indexPath.row < numberOfItems
}
return itemAttributes
}
override func layoutAttributesForItem(at indexPath: IndexPath) -> UICollectionViewLayoutAttributes? {
return itemAttributesCache.first {
$0.indexPath == indexPath
}
}
}
|
[
-1
] |
b900aa2ae065a361ba68e0a52121350627d3af77
|
b77447678fe26990967c742297f626f42aa3a62b
|
/LeagueAPI/LeagueAPI/FrameworkAPI/TFTAPI.swift
|
d6ed1cb9c846f3fea8e92fe8c49b50265018ed4c
|
[
"MIT"
] |
permissive
|
Kelmatou/LeagueAPI
|
2099f132266846d593fb62abedba69dfae901746
|
08016541d4780df3be46d8f67f0b8eb3ddb2cda7
|
refs/heads/master
| 2022-02-26T16:17:24.499706 | 2022-02-09T11:31:17 | 2022-02-09T11:31:17 | 142,478,095 | 65 | 17 |
MIT
| 2022-02-09T11:31:18 | 2018-07-26T18:19:05 |
Swift
|
UTF-8
|
Swift
| false | false | 5,666 |
swift
|
//
// TFTAPI.swift
// LeagueAPI
//
// Created by Antoine Clop on 7/20/20.
// Copyright © 2020 Antoine Clop. All rights reserved.
//
import Foundation
public class TFTAPI: APIClient {
// MARK: - RANKED
public func getChallengerLeague(on region: Region, handler: @escaping (League?, String?) -> Void) {
TFTRankedBusiness.getRanked(method: .GetChallenger, region: region, key: self.key, handler: handler)
}
public func getGrandMasterLeague(on region: Region, handler: @escaping (League?, String?) -> Void) {
TFTRankedBusiness.getRanked(method: .GetGrandMaster, region: region, key: self.key, handler: handler)
}
public func getLeague(by leagueId: TFTLeagueId, on region: Region, handler: @escaping (League?, String?) -> Void) {
TFTRankedBusiness.getRanked(method: .LeagueById(id: leagueId), region: region, key: self.key, handler: handler)
}
public func getMasterLeague(on region: Region, handler: @escaping (League?, String?) -> Void) {
TFTRankedBusiness.getRanked(method:.GetMaster, region: region, key: self.key, handler: handler)
}
public func getRankedEntries(for summonerId: SummonerId, on region: Region, handler: @escaping ([RankedEntry]?, String?) -> Void) {
TFTRankedBusiness.getRanked(method: .EntriesById(id: summonerId), region: region, key: self.key, handler: handler)
}
public func getEntries(on region: Region, division: RankedDivision, page: Int = 1, handler: @escaping ([RankedEntry]?, String?) -> Void) {
TFTRankedBusiness.getRanked(method: .EntriesByTierAndDivision(division: division, page: page), region: region, key: self.key, handler: handler)
}
public func getTopRatedLadders(on region: Region, handler: @escaping ([TFTRatedLadder]?, String?) -> Void) {
TFTRankedBusiness.getRanked(method: .GetTopRatedLadders, region: region, key: self.key, handler: handler)
}
// MARK: - Match
public func getMatchList(by puuid: SummonerPuuid, count: Int? = nil, on region: Region, handler: @escaping ([TFTGameId]?, String?) -> Void) {
let middleHandler: ([String]?, String?) -> Void = { (TFTgameIds, errorMsg) in
if let TFTgameIds = TFTgameIds {
handler(TFTgameIds.map({ TFTGameId($0) }), errorMsg)
} else {
handler(nil, errorMsg)
}
}
TFTMatchBusiness.getMatch(method: .byPuuid(puuid: puuid, count: count), region: region, key: self.key, handler: middleHandler)
}
public func getMatch(by gameId: TFTGameId, on region: Region, handler: @escaping (TFTMatch?, String?) -> Void) {
TFTMatchBusiness.getMatch(method: .ById(id: gameId), region: region, key: self.key, handler: handler)
}
// MARK: - Summoner
public func getSummoner(by accountId: AccountId, on region: Region, handler: @escaping (Summoner?, String?) -> Void) {
TFTSummonerBusiness.getSummoner(method: .ByAccountId(id: accountId), region: region, key: self.key, handler: handler)
}
public func getSummoner(byName name: String, on region: Region, handler: @escaping (Summoner?, String?) -> Void) {
TFTSummonerBusiness.getSummoner(method: .ByName(name: name), region: region, key: self.key, handler: handler)
}
public func getSummoner(by puuid: SummonerPuuid, on region: Region, handler: @escaping (Summoner?, String?) -> Void) {
TFTSummonerBusiness.getSummoner(method: .byPuuid(puuid: puuid), region: region, key: self.key, handler: handler)
}
public func getSummoner(by summonerId: SummonerId, on region: Region, handler: @escaping (Summoner?, String?) -> Void) {
TFTSummonerBusiness.getSummoner(method: .ById(id: summonerId), region: region, key: self.key, handler: handler)
}
public func getSummoner(byAuthorizationToken token: String, on region: Region, handler: @escaping (Summoner?, String?) -> Void) {
TFTSummonerBusiness.getSummoner(method: .ByAuthorizationToken(token: token), region: region, key: self.key, handler: handler)
}
// MARK: - Assets
// MARK: - Items
public func getItem(byId id: TFTItemId) -> TFTItem? {
return TFTItemsBusiness.getItem(byId: id)
}
public func getItem(byName name: String) -> TFTItem? {
return TFTItemsBusiness.getItem(byName: name)
}
public func getItems() -> [TFTItem] {
return TFTItemsBusiness.getAllItems()
}
// MARK: - Champions
public func getChampion(byId id: TFTChampionId) -> TFTChampion? {
return TFTChampionBusiness.getChampion(byId: id)
}
public func getChampion(byName name: String) -> TFTChampion? {
return TFTChampionBusiness.getChampion(byName: name)
}
public func getChampions(byCost cost: Int) -> [TFTChampion]? {
return TFTChampionBusiness.getChampions(byCost: cost)
}
public func getChampions(withTrait trait: String) -> [TFTChampion]? {
return TFTChampionBusiness.getChampions(withTrait: trait)
}
public func getAllChampions() -> [TFTChampion] {
return TFTChampionBusiness.getAllChampions()
}
// MARK: - Traits Infos
public func getTraitInfos(byId id: TFTTraitId) -> TFTTraitInfo? {
return TFTTraitInfoBusiness.getTraitInfos(byId: id)
}
public func getTraitInfos(byName name: String) -> TFTTraitInfo? {
return TFTTraitInfoBusiness.getTraitInfos(byName: name)
}
public func getAllTraitInfos() -> [TFTTraitInfo] {
return TFTTraitInfoBusiness.getAllTraitInfos()
}
}
|
[
-1
] |
b80b5af0f7fd29721f5d41962eb698a914539d9f
|
fc2fe664fe08bead471f54c710d35e77d6ac4d52
|
/PM2_storyboardCalculadora/SceneDelegate.swift
|
69fe0026a86ddc892305f51a55e8600b8e178fa2
|
[] |
no_license
|
gesaro/PM2_calculadora
|
9ea3192259683fe0c03c3a7cb31b4f015a87238d
|
9e9ceeeb0566a431dbb906105aaff41688553270
|
refs/heads/master
| 2021-01-06T09:24:24.866625 | 2020-02-18T05:18:13 | 2020-02-18T05:18:13 | 241,278,695 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 2,356 |
swift
|
//
// SceneDelegate.swift
// PM2_storyboardCalculadora
//
// Created by Gerardo on 17/02/20.
// Copyright © 2020 Gerardo. All rights reserved.
//
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 neccessarily discarded (see `application:didDiscardSceneSessions` instead).
}
func sceneDidBecomeActive(_ scene: UIScene) {
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
}
func sceneWillResignActive(_ scene: UIScene) {
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).
}
func sceneWillEnterForeground(_ scene: UIScene) {
// Called as the scene transitions from the background to the foreground.
// Use this method to undo the changes made on entering the background.
}
func sceneDidEnterBackground(_ scene: UIScene) {
// Called as the scene transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
}
}
|
[
393221,
163849,
393228,
393231,
393251,
352294,
344103,
393260,
393269,
213049,
376890,
385082,
16444,
393277,
376906,
327757,
254032,
286804,
368728,
254045,
368736,
180322,
376932,
286833,
286845,
286851,
417925,
262284,
360598,
286880,
286889,
377003,
377013,
164029,
327872,
180418,
377030,
377037,
180432,
377047,
418008,
385243,
418012,
377063,
327915,
205037,
393457,
393461,
393466,
418044,
336124,
385281,
336129,
262405,
180491,
336140,
164107,
262417,
368913,
262423,
377118,
262437,
254253,
336181,
262455,
393539,
262473,
344404,
213333,
418135,
270687,
262497,
418145,
262501,
213354,
246124,
262508,
262512,
213374,
385420,
262551,
262553,
385441,
385444,
262567,
385452,
262574,
393649,
385460,
262587,
344512,
262593,
336326,
360917,
369119,
328178,
328180,
328183,
328190,
254463,
328193,
98819,
164362,
328207,
410129,
393748,
377372,
188959,
385571,
377384,
197160,
33322,
352822,
270905,
197178,
418364,
188990,
369224,
385610,
270922,
352844,
385617,
352865,
262761,
352875,
344694,
352888,
336513,
377473,
336517,
344710,
385671,
148106,
377485,
352919,
98969,
336549,
344745,
361130,
336556,
434868,
164535,
336568,
164539,
328379,
328387,
352969,
418508,
385743,
385749,
189154,
369382,
361196,
344832,
336644,
344837,
344843,
328462,
361231,
394002,
336660,
418581,
418586,
434971,
369436,
262943,
369439,
418591,
418594,
336676,
418600,
418606,
271154,
328498,
369464,
361274,
328516,
336709,
328520,
336712,
361289,
328523,
336715,
361300,
213848,
426842,
361307,
197469,
361310,
254813,
361318,
344936,
361323,
361335,
328574,
369544,
222129,
345036,
115661,
386004,
345046,
386012,
386019,
386023,
328690,
435188,
328703,
328710,
418822,
377867,
328715,
361490,
386070,
271382,
336922,
345119,
377888,
328747,
214060,
345134,
345139,
361525,
361537,
377931,
197708,
189525,
156762,
402523,
361568,
148580,
345200,
361591,
361594,
410746,
214150,
345224,
386187,
337048,
345247,
361645,
345268,
337076,
402615,
361657,
402636,
328925,
165086,
165092,
328933,
222438,
328942,
386286,
386292,
206084,
115973,
328967,
345377,
345380,
353572,
345383,
337207,
345400,
378170,
369979,
386366,
337224,
337230,
337235,
263509,
353634,
337252,
402792,
345449,
99692,
271731,
378232,
337278,
271746,
181639,
353674,
181644,
361869,
181650,
181655,
230810,
181671,
181674,
181679,
181682,
337330,
181687,
370105,
181691,
181697,
361922,
337350,
181704,
337366,
271841,
329192,
361961,
329195,
116211,
337399,
402943,
337416,
329227,
419341,
419345,
329234,
419351,
345626,
419357,
345631,
419360,
370208,
394787,
419363,
370214,
419369,
394796,
419377,
419386,
206397,
419401,
353868,
419404,
173648,
419408,
214611,
419412,
403040,
345702,
222831,
370298,
353920,
403073,
403076,
345737,
198282,
403085,
403092,
345750,
419484,
345758,
345763,
419492,
345766,
419498,
419502,
370351,
419507,
337588,
419510,
419513,
419518,
403139,
337607,
419528,
419531,
419536,
272083,
394967,
419543,
419545,
345819,
419548,
181982,
419551,
345829,
419560,
337643,
419564,
337647,
370416,
141052,
337661,
337671,
362249,
362252,
395022,
362256,
321300,
345888,
116512,
378664,
354107,
354112,
247618,
370504,
329545,
345932,
354124,
370510,
247639,
337751,
370520,
313181,
182110,
354143,
354157,
345965,
345968,
345971,
345975,
182136,
403321,
1914,
354173,
395148,
247692,
337809,
247701,
329625,
436127,
436133,
247720,
337834,
362414,
337845,
190393,
247760,
346064,
346069,
329699,
354275,
190440,
247790,
354314,
346140,
337980,
436290,
395340,
378956,
436307,
338005,
329816,
100454,
329833,
329853,
329857,
329868,
411806,
329886,
346273,
362661,
100525,
387250,
379067,
387261,
256193,
395467,
346317,
411862,
411865,
411869,
411874,
379108,
411877,
387303,
346344,
395496,
338154,
387307,
346350,
338161,
436474,
321787,
379135,
411905,
411917,
43279,
379154,
395539,
387350,
387353,
338201,
182559,
338212,
248112,
362823,
436556,
321880,
362844,
379234,
354674,
182642,
321911,
420237,
379279,
272787,
354728,
338353,
338363,
338382,
272849,
248279,
256474,
182755,
338404,
338411,
330225,
248309,
199165,
248332,
330254,
199182,
199189,
420377,
330268,
191012,
330320,
199250,
191069,
346722,
248427,
191085,
338544,
191093,
346743,
330384,
346769,
150184,
174775,
248505,
174778,
363198,
223936,
355025,
273109,
264919,
256735,
338661,
264942,
330479,
363252,
338680,
207620,
264965,
191240,
338701,
199455,
396067,
346917,
396070,
215854,
355123,
355141,
355144,
338764,
330581,
330585,
387929,
355167,
265056,
265059,
355176,
355180,
355185,
330612,
330643,
412600,
207809,
379849,
347082,
396246,
330711,
248794,
248799,
437219,
257009,
265208,
330750,
199681,
338951,
330761,
330769,
330775,
248863,
158759,
396329,
404526,
396337,
330803,
396340,
339002,
388155,
339010,
347208,
248905,
330827,
330830,
248915,
183384,
339037,
412765,
257121,
322660,
265321,
330869,
248952,
420985,
330886,
347288,
248986,
44199,
380071,
339118,
249018,
339133,
126148,
322763,
330959,
330966,
265433,
265438,
388320,
363757,
339199,
396552,
175376,
175397,
208167,
273709,
372016,
437553,
347442,
199989,
175416,
396601,
208189,
437567,
175425,
437571,
437576,
437584,
331089,
396634,
175451,
437596,
429408,
175458,
208228,
175461,
175464,
265581,
331124,
175478,
249210,
175484,
175487,
249215,
175491,
249219,
249225,
249228,
249235,
175514,
175517,
396703,
396706,
175523,
355749,
396723,
388543,
380353,
216518,
339401,
380364,
339406,
372177,
339414,
249303,
413143,
339418,
339421,
249310,
339425,
249313,
339429,
339435,
249329,
69114,
372229,
339464,
249355,
208399,
380433,
175637,
134689,
339504,
265779,
421442,
413251,
265796,
265806,
224854,
224858,
339553,
257636,
224871,
372328,
257647,
372338,
339572,
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,
339696,
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,
323404,
257869,
257872,
225105,
339795,
397140,
225109,
225113,
257881,
257884,
257887,
225120,
257891,
413539,
225128,
257897,
225138,
339827,
257909,
225142,
257914,
257917,
225150,
257922,
380803,
225156,
339845,
257927,
225166,
397201,
225171,
380823,
225176,
225183,
372698,
372704,
372707,
356336,
380919,
393215,
372739,
405534,
266295,
266298,
217158,
421961,
200786,
356440,
217180,
430181,
266351,
356467,
266365,
266375,
381069,
225425,
250003,
225430,
250008,
356507,
250012,
225439,
135328,
192674,
225442,
438434,
225445,
438438,
225448,
438441,
225451,
258223,
225456,
430257,
225459,
225462,
225468,
389309,
225472,
372931,
225476,
430275,
389322,
225485,
225488,
225491,
266454,
225494,
225497,
225500,
225503,
225506,
356580,
225511,
217319,
225515,
225519,
381177,
397572,
389381,
356631,
356638,
356641,
356644,
356647,
266537,
389417,
356650,
356656,
332081,
307507,
340276,
356662,
397623,
332091,
225599,
332098,
201030,
348489,
332107,
151884,
430422,
348503,
332118,
250201,
250203,
332130,
250211,
340328,
250217,
348523,
348528,
332153,
356734,
389503,
332158,
438657,
250239,
332162,
348548,
356741,
332175,
160152,
373146,
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,
119432,
340628,
184983,
373399,
340639,
258723,
332455,
332460,
389806,
332464,
332473,
381626,
332484,
332487,
332494,
357070,
357074,
332512,
332521,
340724,
332534,
373499,
348926,
389927,
348979,
152371,
398141,
127815,
357202,
389971,
357208,
136024,
389979,
430940,
357212,
357215,
201580,
201583,
349041,
340850,
201589,
381815,
430967,
324473,
398202,
119675,
340859,
324476,
430973,
324479,
340863,
324482,
324485,
324488,
185226,
381834,
324493,
324496,
324499,
430996,
324502,
324511,
422817,
324514,
201638,
373672,
324525,
5040,
111539,
324534,
5047,
324539,
324542,
398280,
349129,
340940,
340942,
209874,
340958,
431073,
398307,
340964,
209896,
201712,
209904,
349173,
381947,
201724,
349181,
431100,
431107,
349203,
209944,
209948,
250915,
250917,
169002,
357419,
209966,
209969,
209973,
209976,
209980,
209988,
209991,
431180,
209996,
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,
333010,
210132,
333016,
210139,
210144,
218355,
251123,
218361,
275709,
128254,
275713,
242947,
275717,
275723,
333075,
349460,
333079,
251161,
349486,
349492,
415034,
251211,
210261,
365912,
259423,
374113,
251236,
374118,
234867,
390518,
357756,
374161,
112021,
349591,
357793,
333222,
210357,
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,
333387,
333396,
333400,
366173,
333415,
423529,
423533,
333423,
210547,
415354,
333440,
267910,
267929,
333472,
333512,
259789,
358100,
366301,
333535,
366308,
366312,
431852,
399086,
366319,
210673,
366322,
399092,
366326,
333566,
268042,
210700,
366349,
210707,
399129,
333593,
333595,
210720,
366384,
358192,
210740,
366388,
358201,
399166,
325441,
366403,
325447,
341831,
341835,
341839,
341844,
415574,
358235,
341852,
350046,
399200,
399208,
268144,
358256,
358260,
399222,
325494,
186233,
333690,
243584,
325505,
333699,
399244,
333709,
333725,
333737,
382891,
382898,
333767,
358348,
333777,
219094,
358372,
350190,
350194,
333819,
350204,
350207,
325633,
325637,
350214,
268299,
333838,
350225,
350232,
333851,
350238,
350241,
374819,
350245,
350249,
350252,
178221,
350257,
350260,
350272,
243782,
350281,
350286,
374865,
252021,
342134,
374904,
268435,
333989,
333998,
334012,
260299,
350411,
350417,
350423,
350426,
334047,
350436,
350449,
375027,
358645,
350454,
350459,
350462,
350465,
350469,
325895,
268553,
194829,
350477,
268560,
350481,
432406,
350487,
350491,
350494,
325920,
350500,
350505,
358701,
391469,
350510,
358705,
358714,
358717,
383307,
358738,
334162,
383331,
383334,
391531,
383342,
334204,
268669,
194942,
391564,
366991,
334224,
342431,
375209,
326059,
375220,
342453,
334263,
326087,
358857,
195041,
334312,
104940,
375279,
350724,
186898,
342546,
350740,
342551,
334359,
342555,
334364,
416294,
350762,
252463,
358962,
334386,
334397,
252483,
219719,
399957,
244309,
334425,
326240,
375401,
334466,
334469,
391813,
162446,
326291,
342680,
342685,
260767,
342711,
244410,
260798,
334530,
260802,
350918,
154318,
342737,
391895,
154329,
416476,
64231,
113389,
342769,
203508,
375541,
342777,
391938,
391949,
375569,
375572,
375575,
375580,
162592,
334633,
326444,
383794,
326452,
326455,
375613,
244542,
260925,
375616,
326468,
244552,
342857,
326474,
326479,
326486,
416599,
342875,
244572,
326494,
326503,
433001,
326508,
400238,
326511,
211826,
211832,
392061,
351102,
252801,
260993,
400260,
211846,
342921,
342931,
252823,
400279,
392092,
400286,
359335,
211885,
400307,
351169,
359362,
351172,
170950,
187335,
326599,
359367,
359383,
359389,
383968,
343018,
359411,
261109,
261112,
244728,
383999,
261130,
261148,
359452,
211999,
261155,
261160,
261166,
359471,
375868,
384099,
384102,
384108,
367724,
326764,
187503,
343155,
384115,
212095,
384136,
384140,
384144,
384152,
384158,
384161,
351399,
384169,
367795,
244917,
384182,
384189,
384192,
351424,
343232,
244934,
367817,
244938,
384202,
253132,
326858,
343246,
384209,
146644,
351450,
384225,
359650,
343272,
351467,
359660,
384247,
351480,
384250,
351483,
351492,
343307,
384270,
359695,
261391,
253202,
261395,
384276,
384284,
245021,
384290,
253218,
245032,
171304,
384299,
351535,
245042,
326970,
384324,
343366,
212296,
212304,
367966,
343394,
343399,
367981,
343410,
155000,
327035,
245121,
245128,
253321,
155021,
384398,
245137,
245143,
245146,
245149,
343453,
245152,
245155,
155045,
245158,
40358,
245163,
114093,
327090,
343478,
359867,
384444,
146878,
327108,
327112,
384457,
327118,
359887,
359891,
343509,
368093,
155103,
343535,
343540,
368120,
343545,
409092,
359948,
359951,
245295,
359984,
400977,
400982,
179803,
155241,
138865,
155255,
155274,
368289,
245410,
425639,
245415,
425652,
425663,
155328,
245463,
155352,
155356,
212700,
155364,
245477,
155372,
245487,
212723,
245495,
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,
311244,
212945,
393170,
155604,
155620,
253924,
155622,
253927,
327655,
360432,
393204,
360439,
253944,
393209,
155647
] |
a9cc79be3025df1c45760a88e97a470848d9440d
|
c8740aa6368dc80e911b34daa61b0024575af46e
|
/BarcelonaApp/Test/Answer/AnswerTableViewCell.swift
|
304902c75f2749bb5cbc2cf93a0346c3f09ca0a4
|
[] |
no_license
|
BJas/Barcelona
|
36965c550b848a93b3fe81d39f741aa188065af6
|
2a8c858ebbea158ac5059e650fa6f47b9062c51a
|
refs/heads/master
| 2021-08-19T17:51:48.742447 | 2017-11-27T04:30:40 | 2017-11-27T04:30:40 | 108,738,710 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 537 |
swift
|
//
// AnswerTableViewCell.swift
// BarcelonaApp
//
// Created by Apple on 14.11.17.
// Copyright © 2017 Apple. All rights reserved.
//
import UIKit
class AnswerTableViewCell: UITableViewCell {
@IBOutlet weak var titleLabel: 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
}
}
|
[
337412,
346761,
317331,
282900,
373908,
276756,
181529,
258720,
336162,
288382,
229423,
313671,
327241,
358868,
384982,
233814,
291544,
317272,
384988,
358876,
233564,
372718,
244602,
283900,
160894,
360191
] |
83331914db86b33b6e15d541529ba00a55c4c609
|
87c405b6f38952321840dc464c0151a0e1e15c01
|
/SudokuTests/SudokuTests.swift
|
29bffac62e33c299274579b6b8669a2dd1ebeb39
|
[] |
no_license
|
eGust/Sudoku.iOS
|
1156fa84fd0dc40ee687c01f00f3f6a938f46e99
|
76cc7b33ea6dcd4681bc6071da9e44d324b4b1f2
|
refs/heads/master
| 2020-05-17T03:45:39.998611 | 2015-01-07T09:05:15 | 2015-01-07T09:05:15 | 28,587,974 | 2 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 893 |
swift
|
//
// SudokuTests.swift
// SudokuTests
//
// Created by Chen Xi on 14/12/28.
// Copyright (c) 2014年 Chen Xi. All rights reserved.
//
import UIKit
import XCTest
class SudokuTests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// This is an example of a functional test case.
XCTAssert(true, "Pass")
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measureBlock() {
// Put the code you want to measure the time of here.
}
}
}
|
[
276481,
276484,
276489,
276492,
278541,
278544,
278550,
276509,
278561,
276543,
159807,
280649,
223318,
288857,
227417,
278618,
194652,
194653,
276577,
43109,
276581,
276582,
276585,
223340,
276589,
227439,
276592,
227446,
276603,
276606,
276613,
141450,
311435,
276627,
276631,
276632,
184475,
227492,
196773,
129203,
176314,
227528,
276684,
278742,
278746,
155867,
196834,
276709,
276710,
276715,
233715,
157944,
211193,
227576,
227585,
276744,
227592,
276748,
276753,
129301,
276760,
278810,
276764,
276774,
262450,
276787,
276792,
278846,
164162,
276813,
278862,
278863,
6482,
276821,
276822,
276831,
276835,
276839,
276847,
278898,
278908,
280961,
178571,
278954,
278965,
276919,
276920,
278969,
278985,
279002,
276958,
227813,
279019,
279022,
186893,
279054,
223767,
277017,
223769,
277029,
277048,
301634,
369220,
277066,
166507,
189036,
189037,
277101,
189042,
189043,
277118,
184962,
225933,
133774,
225936,
277138,
277142,
225943,
164512,
225956,
225962,
209581,
154291,
154294,
277176,
277190,
199366,
225997,
226001,
164563,
277204,
203477,
226004,
226007,
203478,
119513,
201442,
226019,
226033,
226043,
209660,
234241,
226051,
277254,
209670,
203529,
226058,
234256,
285463,
234263,
234268,
105246,
228129,
234280,
277289,
234283,
277294,
277295,
234286,
226097,
162621,
234301,
277312,
234304,
162626,
277316,
234311,
234312,
234317,
277327,
234323,
234326,
277339,
297822,
234335,
297826,
234340,
174949,
234343,
277354,
234346,
234349,
277360,
213876,
277366,
234361,
277370,
226170,
234367,
234372,
226181,
213894,
226184,
234377,
226189,
234381,
226194,
234387,
234392,
279456,
277410,
234404,
234409,
234412,
234419,
277435,
287677,
234430,
226241,
275397,
234438,
226249,
275410,
234450,
234451,
234454,
234457,
275418,
234463,
234466,
277480,
179176,
234482,
234492,
277505,
234498,
277510,
234503,
234506,
277517,
275469,
197647,
277518,
295953,
234509,
277523,
234517,
281625,
234530,
234534,
275495,
234539,
275500,
310317,
277550,
275505,
275506,
234548,
277563,
156733,
277566,
230463,
7229,
7230,
207938,
7231,
234560,
234565,
277574,
234569,
207953,
277585,
296018,
234583,
234584,
275547,
277596,
234594,
277603,
234603,
281707,
275565,
275571,
234612,
398457,
234622,
275590,
275591,
234631,
253063,
277640,
302217,
277651,
226452,
226451,
275607,
119963,
234652,
277665,
275625,
208043,
275628,
226479,
277686,
277690,
277694,
203989,
195811,
285929,
204022,
120055,
204041,
259363,
199971,
277800,
113962,
277803,
277806,
113966,
226608,
277809,
226609,
277814,
277815,
277821,
277824,
226624,
277825,
15686,
277831,
226632,
277834,
142669,
277838,
277841,
222548,
277845,
277844,
224605,
218462,
224606,
277856,
179552,
142689,
277862,
281962,
277866,
173420,
277868,
277871,
279919,
277878,
275831,
275832,
277882,
142716,
275838,
275839,
277890,
277891,
226694,
275847,
277896,
277897,
277900,
230799,
296338,
277907,
206228,
226711,
226712,
277919,
277920,
277925,
277927,
277936,
277939,
296375,
277946,
277949,
277952,
296387,
163269,
277957,
296391,
277962,
282060,
277965,
277974,
228823,
228824,
277977,
277980,
226781,
277983,
277988,
277993,
296425,
277994,
277997,
278002,
278005,
278008,
153095,
175625,
192010,
280077,
149007,
65041,
204313,
278056,
278060,
228917,
226875,
128583,
226888,
276045,
276046,
276050,
226906,
243292,
276084,
276085,
276088,
278140,
188031,
276097,
192131,
276100,
276101,
312972,
278160,
278162,
276116,
276117,
276120,
278170,
280220,
276126,
276129,
278191,
276146,
278195,
276148,
296628,
278201,
276156,
276165,
278214,
276172,
323276,
276179,
276180,
216795,
216796,
276195,
313065,
276210,
276211,
276219,
171776,
278285,
276238,
227091,
184086,
278299,
276253,
276257,
278307,
288547,
278316,
165677,
159533,
276279,
276282,
276283,
276287,
276298,
296779,
276311,
276325,
276332,
173936,
110452,
276344,
227199,
40850,
40853,
44952,
247712,
227238,
276394,
276401,
276408,
161722,
276413,
276421,
276430,
153552,
276444,
276450,
276451,
276454,
276459,
276462,
276463,
276468,
276469,
278518,
276475,
276478
] |
235dca19e88093d25230261c94a1014da580a042
|
f6d66584bf487901d2a1214140d89639600c0f73
|
/MusicPlayApp/MusicPlayApp/Home/HomeViewController.swift
|
f09af1489343bf8783011d7f44523dac3e353f02
|
[] |
no_license
|
jihokim94/IOS-MusicApp
|
9febd087127a2cc1066144bc015f8c7a3b9b1331
|
3ba54a323147b7560bf4b74e3fbcf726bc1d825c
|
refs/heads/master
| 2023-06-25T09:21:28.184622 | 2021-07-26T15:07:33 | 2021-07-26T15:07:33 | 389,315,473 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 4,442 |
swift
|
//
// ViewController.swift
// MusicPlayApp
//
// Created by 김지호 on 2021/07/25.
//
import UIKit
class HomeViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
}
let trackManager = TrackManager()
extension HomeViewController : UICollectionViewDataSource{
// 섹션마다 아이템 개수 설정 섹셕은 총 두개 아이템은 일단 보자~
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return 10
}
// 콜렉션의 셀이 들어갈 내용
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "TrackCollecionViewCell", for: indexPath) as? TrackCollecionViewCell else {
return UICollectionViewCell()
}
let track = trackManager.track(at: indexPath.item)
cell.updateUI(item: track)
return cell
}
// 헤더 뷰 와 풋터 뷰를 구현할때 필요함
func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
switch kind {
case UICollectionView.elementKindSectionHeader:
guard let item = trackManager.todaysTrack else {
return UICollectionReusableView()
}
guard let header = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "TrackCollectionHeaderView", for: indexPath) as? TrackCollectionHeaderView else {
return UICollectionReusableView()
}
// TODO: 헤더 구성
header.update(with: item)
header.tapHandler = { item -> Void in
//play를 띄운다
print("----> item title : \(item.convertToTrack()?.title)")
let playerStoryboard = UIStoryboard.init(name: "Play", bundle: nil)
// play스토리 보드와 연결되있는 컨트롤러 인스턴스 생성 및 present 하기
// let playVC: PlayerViewController
guard let playVC = playerStoryboard.instantiateViewController(withIdentifier: "PlayerViewController") as? PlayerViewController else { return }
// play컨트롤러에 트랙 AVPlayerItem 인스턴스 전달
playVC.simplePlayer.replaceCurrentItem(with: item)
self.present(playVC, animated: true, completion: nil)
}
return header
default:
return UICollectionReusableView()
}
}
}
extension HomeViewController : UICollectionViewDelegate {
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
// 곡 클릭시 인덱스에 따라 트랙 리스트의 음원이 재생 되어야 한다.
print("---> \(indexPath.item)")
// play 스토리 보드 가져오기
let playerStoryboard = UIStoryboard.init(name: "Play", bundle: nil)
// play스토리 보드와 연결되있는 컨트롤러 인스턴스 생성 및 present 하기
// let playVC: PlayerViewController
guard let playVC = playerStoryboard.instantiateViewController(withIdentifier: "PlayerViewController") as? PlayerViewController else { return }
// play컨트롤러에 트랙 AVPlayerItem 인스턴스 전달
let item = trackManager.tracks[indexPath.item]
playVC.simplePlayer.replaceCurrentItem(with: item)
self.present(playVC, animated: true, completion: nil)
}
}
extension HomeViewController : UICollectionViewDelegateFlowLayout {
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
//Asks the delegate for the size of the specified item’s cell.
let itemSpacing : CGFloat = 20 // 아이템 간의 간격
let margin : CGFloat = 20 // 양쪽 마진 20
let cellWidth = (collectionView.bounds.width - itemSpacing - (margin * 2)) / 2
let cellHeight = cellWidth + 60
return CGSize(width: cellWidth, height: cellHeight)
}
}
|
[
-1
] |
7ae33a038e12e0e24a7b4aed576b5afee33ff8bd
|
6b669dd77dc6910e886f85d9477a274eab395b77
|
/StarDraw/StarDraw/ViewController.swift
|
5797383a7abf9751a49a9ec7a61d5633626566e4
|
[
"MIT"
] |
permissive
|
gutoglup/iesb
|
1a46ab10b386bc229c12e0b1d118162d875a80d2
|
ff5d295dde5bbff93d93385e9a83a2dc6f5ee91a
|
refs/heads/master
| 2021-09-20T08:32:12.493691 | 2018-08-07T01:13:47 | 2018-08-07T01:13:47 | 112,529,427 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 510 |
swift
|
//
// ViewController.swift
// StarDraw
//
// Created by Augusto Reis on 04/03/2018.
// Copyright © 2018 Augusto Reis. 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,
279046,
288775,
277512,
215562,
294411,
275466,
278543,
281107,
279064,
281118,
284192,
197664,
317473,
295460,
284197,
289318,
296487,
286249,
296489,
304174,
309807,
300086,
286775,
279096,
234551,
300089,
234043,
288827,
238653,
226878,
288321,
286786,
129604,
301637,
226887,
293961,
284236,
286796,
278606,
284239,
284240,
158285,
284242,
292435,
226896,
212561,
300629,
276054,
307288,
237655,
282311,
212573,
40545,
200802,
309347,
277602,
309349,
284261,
306791,
309351,
309353,
286314,
311913,
281703,
296042,
164974,
307311,
281202,
284275,
314996,
277108,
300149,
276087,
234619,
284287,
284289,
278657,
276612,
280710,
284298,
303242,
278157,
311437,
226447,
234641,
349332,
117399,
280219,
299165,
284317,
282270,
285855,
228000,
295586,
282275,
284361,
278693,
287399,
284328,
100521,
313007,
284336,
299186,
277171,
307379,
284341,
286390,
300727,
282301,
283839,
277696,
285377,
280770,
227523,
280772,
302788,
228551,
294600,
279751,
280775,
279754,
230604,
298189,
302286,
313550,
230608,
229585,
282320,
276686,
307410,
189655,
302295,
226009,
282329,
280797,
363743,
282338,
298211,
301284,
284391,
228585,
282346,
234223,
358127,
312049,
279791,
286963,
282357,
280821,
120054,
226038,
234232,
280826,
286965,
358139,
282365,
286462,
282368,
280832,
230147,
358147,
226055,
282377,
299786,
312586,
300817,
282389,
282393,
329499,
228127,
315170,
282403,
281380,
304933,
282917,
233767,
315177,
283433,
130346,
282411,
293682,
159541,
285495,
282426,
319291,
307516,
283453,
289596,
279360,
289088,
293700,
238920,
234829,
287055,
296272,
307029,
241499,
308064,
227688,
313706,
290303,
306540,
293742,
299374,
162672,
199024,
276849,
280947,
315250,
298359,
310649,
292730,
207738,
333179,
303998,
290175,
275842,
224643,
183173,
304008,
324491,
304012,
234380,
304015,
300432,
226705,
310673,
277406,
285087,
234402,
289187,
284580,
288165,
279463,
284586,
144811,
276396,
286126,
277935,
324528,
230323,
282548,
282035,
292277,
296374,
230328,
130487,
234423,
277432,
278968,
293308,
278973,
295874,
10179,
299973,
165832,
306633,
288205,
286158,
280015,
310734,
311761,
301016,
163289,
294877,
280031,
286175,
234465,
168936,
294889,
298989,
183278,
277487,
231405,
282095,
227315,
296436,
302580,
310773,
281078,
290299,
233980,
287231
] |
ba31817a1cc43e66e33a6790aa9a2080e6efe55d
|
a90129beeaf36f14ab5fe567f9abf176f201365a
|
/TrackProgress/TrackProgress/Slide.swift
|
92c995f27d3139d30984532f37885e7021b28566
|
[] |
no_license
|
sbiswal92/ByeCiggy
|
5a17c83a7be6772f80746414b18782dbd9839b11
|
c27c5467e4d39b9faa075d253b5e36322ad0bb45
|
refs/heads/master
| 2022-12-25T04:56:11.115323 | 2020-09-15T04:04:32 | 2020-09-15T04:04:32 | 295,609,694 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 503 |
swift
|
//
// Slide.swift
// TrackProgress
//
// Created by Biswal, Shruti [COM S] on 9/9/20.
// Copyright © 2020 Biswal, Shruti [COM S]. All rights reserved.
//
import UIKit
class Slide: UIView {
@IBOutlet var imageView: UIImageView!
@IBOutlet var labelTitle: UILabel!
/*
// Only override draw() if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
override func draw(_ rect: CGRect) {
// Drawing code
}
*/
}
|
[
-1
] |
2994c68bd0cdc94686ca0c88b886d313d7d4d96e
|
36f918fc4d72725a31eb1541c879683c4f973416
|
/FinalChallengeApp/ModelCK/DetailedReportCKModel.swift
|
92b3e612fcbf9231396e30fc1b1ce2132636bfe5
|
[] |
no_license
|
jorjyeah/FinalChallenge
|
e44f90eb6f2506c718bf55a3b7773dacdcb9bb2f
|
b233d505efad5a63bffae2c7218ae1c43ea46451
|
refs/heads/master
| 2020-09-08T01:15:19.661931 | 2019-12-23T08:52:34 | 2019-12-23T08:52:34 | 220,968,004 | 1 | 0 | null | 2020-01-08T02:24:05 | 2019-11-11T11:37:59 |
Swift
|
UTF-8
|
Swift
| false | false | 1,805 |
swift
|
//
// DetailedReportCKModel.swift
// FinalChallengeApp
//
// Created by George Joseph Kristian on 04/12/19.
// Copyright © 2019 George Joseph Kristian. All rights reserved.
//
import CloudKit
import UIKit
class DetailedReportCKModel: NSObject{
var record:CKRecord?
var activityRecordID : String {
get{
return (record?.recordID.recordName)!
}
}
var activityTitle : String {
get{
return record?.value(forKey: "activityTitle") as! String
}
set{
self.record?.setValue(newValue, forKey: "activityTitle")
}
}
var activityDesc : String {
get{
return record?.value(forKey: "activityDesc") as! String
}
set{
self.record?.setValue(newValue, forKey: "activityDesc")
}
}
var activityMedia : String {
get{
return record?.value(forKey: "activityMedia") as! String
}
set{
self.record?.setValue(newValue, forKey: "activityMedia")
}
}
var activityTips : String {
get{
return record?.value(forKey: "activityTips") as! String
}
set{
self.record?.setValue(newValue, forKey: "activityTips")
}
}
var activityPrompt : [String] {
get{
return record?.value(forKey: "activityPrompt") as! [String]
}
set{
self.record?.setValue(newValue, forKey: "activityPrompt")
}
}
var skillTitle : CKRecord.Reference {
get{
return record?.value(forKey: "skillTitle") as! CKRecord.Reference
}
}
var baseProgramTitle = String()
init(record:CKRecord){
self.record = record
}
}
|
[
-1
] |
08901dc6bcf2d60b3940b77cba14a26ba499539f
|
f375ef3b52874ffea7b0e61aa77c92e76f3f8b88
|
/42Events/42Events/Repos/EventsRepo.swift
|
56e7d5bec32cf787b2ccd6f7b67c2914b93041fc
|
[] |
no_license
|
nannymcphee/42Events
|
aebb45da540283804f2fb4c7000c1e3bdd9df399
|
4c5c119e89f94ba1b3716a2744294314a6fdfb8a
|
refs/heads/main
| 2023-07-15T08:54:15.101636 | 2021-08-19T15:53:40 | 2021-08-19T15:53:40 | 368,793,325 | 0 | 0 | null | 2021-08-19T15:48:19 | 2021-05-19T08:14:56 |
Swift
|
UTF-8
|
Swift
| false | false | 707 |
swift
|
//
// EventsRepo.swift
// 42Events
//
// Created by Duy Nguyen on 13/07/2021.
//
import RxSwift
import Resolver
import FTDomain
import FTNetworkPlatform
public protocol EventsRepo {
func getAllEvents() -> Single<EventListResponse>
func getEvents(sportType: String, limit: Int) -> Single<[EventModel]>
}
public class EventsRepoImpl: EventsRepo {
@Injected private var eventsApi: FTNetworkPlatform.EventUseCase
public func getAllEvents() -> Single<EventListResponse> {
return eventsApi.getAllEvents()
}
public func getEvents(sportType: String, limit: Int) -> Single<[EventModel]> {
return eventsApi.getEvents(sportType: sportType, limit: limit)
}
}
|
[
-1
] |
ceaf535e03a46aaf019c35465f35062fe3cd2356
|
c5e2868abfd0d94ad48b11ae480c21b217cd6e64
|
/MyLocations/CategoryPickerViewController.swift
|
da0c64a3a573bd273ada5bb2c4437f4cb6605631
|
[] |
no_license
|
yhkung/MyLocations
|
8bef86dd76aa26f9344867add001be8e853b47a0
|
800b2e2244f346600b833d1f52b91503b9782690
|
refs/heads/master
| 2021-01-20T13:58:13.531300 | 2017-05-07T15:38:39 | 2017-05-07T15:38:39 | 90,542,079 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 2,470 |
swift
|
//
// CategoryPickerViewController.swift
// MyLocations
//
// Created by KungYi-Hsin on 29/04/2017.
// Copyright © 2017 YH. All rights reserved.
//
import UIKit
class CategoryPickerViewController: UITableViewController {
var selectedCategoryName = ""
let categories = [
"No Category",
"Apple Store",
"Bar",
"Bookstore",
"Club",
"Grocery Store",
"Historic Building",
"House",
"Icecream Vendor",
"Landmark",
"Park"]
var selectedIndexPath = IndexPath()
override func viewDidLoad() {
super.viewDidLoad()
for (i, category) in categories.enumerated() {
if category == selectedCategoryName {
selectedIndexPath = IndexPath(row: i, section: 0)
break
}
}
}
// MARK: - UITableViewDataSource
override func tableView(_ tableView: UITableView,
numberOfRowsInSection section: Int) -> Int {
return categories.count
}
override func tableView(_ tableView: UITableView,
cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(
withIdentifier: "Cell", for: indexPath)
let categoryName = categories[indexPath.row]
cell.textLabel!.text = categoryName
if categoryName == selectedCategoryName {
cell.accessoryType = .checkmark
} else {
cell.accessoryType = .none
}
return cell
}
// MARK: - UITableViewDelegate
override func tableView(_ tableView: UITableView,
didSelectRowAt indexPath: IndexPath) {
if indexPath.row != selectedIndexPath.row {
if let newCell = tableView.cellForRow(at: indexPath) {
newCell.accessoryType = .checkmark
}
if let oldCell = tableView.cellForRow(at: selectedIndexPath) {
oldCell.accessoryType = .none
}
selectedIndexPath = indexPath
}
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "PickedCategory" {
let cell = sender as! UITableViewCell
if let indexPath = tableView.indexPath(for: cell) {
selectedCategoryName = categories[indexPath.row]
}
} }
}
|
[
334379
] |
ab13931d6f48d859d0bc5ffa3f0f81dff25402df
|
3c4b7d2bced8305b1c41bd49ed83f1e404734a29
|
/Package.swift
|
4ca46156873163cb13e656f79a647d84cfb7dfc7
|
[] |
no_license
|
swift-package-manager/SVProgressHUD
|
e788c0b4ee200448f24b9be858f584e6854f10bd
|
8ecf8dcb729c3b0850ff5cdf4e1d4f641f6dcc46
|
refs/heads/master
| 2023-01-11T19:20:47.864048 | 2020-08-27T09:43:36 | 2020-09-17T00:54:17 | 309,621,912 | 1 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 463 |
swift
|
// swift-tools-version:5.3
import PackageDescription
let package = Package(
name: "SVProgressHUD",
platforms: [.iOS(.v9)],
products: [
.library(
name: "SVProgressHUD",
targets: ["SVProgressHUD"]),
],
targets: [
.target(
name: "SVProgressHUD",
dependencies: []),
.testTarget(
name: "SVProgressHUDTests",
dependencies: ["SVProgressHUD"]),
]
)
|
[
-1
] |
a6ce9f1b834fab2387811480d6c13f92a87b3876
|
4dce19c5f3c4275894a67a445caff8a749799fd7
|
/Nasa Rovers/Extensions/Extensions+UIView.swift
|
99a8c6e2dd3bee5de8f935e3f1f7b160052bc184
|
[] |
no_license
|
YamanBoztepe/Nasa-Rovers
|
993c1aa6c4a32350d6b300bb5f23f20f5eda0992
|
6fafe7e33e7c48736d0079f5801ce711bccf4c0f
|
refs/heads/master
| 2023-03-14T09:09:16.539720 | 2021-03-07T20:42:49 | 2021-03-07T20:42:49 | 345,446,883 | 0 | 0 | null | null | null | null |
UTF-8
|
Swift
| false | false | 3,826 |
swift
|
//
// Extensions+UIView.swift
// Nasa Rovers
//
// Created by Yaman Boztepe on 2.03.2021.
//
import UIKit
class CustomLabel: UILabel {
init(text: String, textColor: UIColor, textAlignment: NSTextAlignment) {
super.init(frame: .zero)
self.text = text
self.textColor = textColor
self.textAlignment = textAlignment
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
struct AnchorConstraint {
var top: NSLayoutConstraint?
var bottom: NSLayoutConstraint?
var leading: NSLayoutConstraint?
var trailing: NSLayoutConstraint?
var height: NSLayoutConstraint?
var width: NSLayoutConstraint?
}
extension UIView {
func anchor( top: NSLayoutYAxisAnchor?, bottom: NSLayoutYAxisAnchor?, leading: NSLayoutXAxisAnchor?, trailing: NSLayoutXAxisAnchor?, padding: UIEdgeInsets = .zero, size: CGSize = .zero) -> AnchorConstraint {
translatesAutoresizingMaskIntoConstraints = false
var anchorConstraint = AnchorConstraint()
if let top = top {
anchorConstraint.top = topAnchor.constraint(equalTo: top, constant: padding.top)
}
if let bottom = bottom {
anchorConstraint.bottom = bottomAnchor.constraint(equalTo: bottom, constant: -padding.bottom)
}
if let leading = leading {
anchorConstraint.leading = leadingAnchor.constraint(equalTo: leading, constant: padding.left)
}
if let trailing = trailing {
anchorConstraint.trailing = trailingAnchor.constraint(equalTo: trailing, constant: -padding.right)
}
if size.width != 0 {
anchorConstraint.width = widthAnchor.constraint(equalToConstant: size.width)
}
if size.height != 0 {
anchorConstraint.height = heightAnchor.constraint(equalToConstant: size.height)
}
[anchorConstraint.top, anchorConstraint.bottom, anchorConstraint.leading, anchorConstraint.trailing, anchorConstraint.height, anchorConstraint.width].forEach { $0?.isActive = true }
return anchorConstraint
}
func positionInCenterSuperView(size: CGSize = .zero, centerX: NSLayoutXAxisAnchor?, centerY: NSLayoutYAxisAnchor?) {
translatesAutoresizingMaskIntoConstraints = false
if let centerX = centerX {
centerXAnchor.constraint(equalTo: centerX).isActive = true
}
if let centerY = centerY {
centerYAnchor.constraint(equalTo: centerY).isActive = true
}
if size.width != 0 {
widthAnchor.constraint(equalToConstant: size.width).isActive = true
}
if size.height != 0 {
heightAnchor.constraint(equalToConstant: size.height).isActive = true
}
}
func animateIn(_ popUp: PopUp) {
let blurEffect = UIBlurEffect(style: .dark)
let blurView = UIVisualEffectView(effect: blurEffect)
let gesture = UITapGestureRecognizer(target: self, action: #selector(blurPressed))
blurView.addGestureRecognizer(gesture)
self.addSubview(blurView)
self.bringSubviewToFront(popUp)
blurView.frame = self.bounds
[blurView,popUp].forEach { $0.alpha = 0 }
UIView.animate(withDuration: 0.5) {
blurView.alpha = 1
popUp.alpha = 1
}
}
@objc fileprivate func blurPressed() {
for subview in self.subviews {
if (subview.isKind(of: UIVisualEffectView.self)) || (subview.isKind(of: PopUp.self)) {
subview.removeFromSuperview()
}
}
}
}
|
[
-1
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.