blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 2
625
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
47
| license_type
stringclasses 2
values | repo_name
stringlengths 5
116
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 643
values | visit_date
timestamp[ns] | revision_date
timestamp[ns] | committer_date
timestamp[ns] | github_id
int64 80.4k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 16
values | gha_event_created_at
timestamp[ns] | gha_created_at
timestamp[ns] | gha_language
stringclasses 85
values | src_encoding
stringclasses 7
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 1
class | length_bytes
int64 4
6.44M
| extension
stringclasses 17
values | content
stringlengths 4
6.44M
| duplicates
sequencelengths 1
9.02k
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
17635fd884dae22efce37db56b0da635c149ac7d | 3744b76df04f3360b582a231cf059e5743347f09 | /SchoolNewsLetter/Application/NoticeView/NoticeViewModel.swift | 8d0a259b77d1da860a1392556f56ce4d898f5c88 | [] | no_license | craycrayno1/school-newsletter | 73fdc7f0f9e33e47f99247e147a7b1ce9522b0f0 | d93116c64159869a6b330492e76abd9f55e84a07 | refs/heads/master | 2022-06-23T05:16:37.799826 | 2020-05-07T10:34:58 | 2020-05-07T10:34:58 | 262,023,949 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,991 | swift | //
// NoticeViewModel.swift
// SchoolNewsLetter
//
// Created by Jay Lee on 2020/04/23.
// Copyright © 2020 Jay Lee. All rights reserved.
//
import Combine
import Foundation
// C: malloc / free
// C++: new / delete OR RAII
// Garbage Collection : GC
// Automatic Reference Counting : ARC
class NoticeViewModel: ObservableObject {
@Published var events: [Event] = []
func getSchedule() {}
}
final class NetworkNoticeViewModel: NoticeViewModel {
var cancellable: Cancellable?
override func getSchedule() {
var urlComponents = URLComponents()
urlComponents.scheme = "https"
urlComponents.host = "open.neis.go.kr"
urlComponents.path = "/hub/SchoolSchedule"
let parameters = [
"key": "d47ea07feb304beb9622c7dc63321404",
"type": "json",
"sd_schul_code": "7091444",
"atpt_ofcdc_sc_code": "B10",
"aa_from_ymd": "20200415",
"psize": "100"
]
urlComponents.queryItems = parameters.map { URLQueryItem(name: $0, value: $1) }
let url = urlComponents.url!
cancellable = URLSession.shared
.dataTaskPublisher(for: url)
.map { $0.data }
.decode(type: ScheduleWrapper.self, decoder: JSONDecoder())
.map { $0.schedule.events }
.retry(1)
.replaceError(with: [])
.receive(on: DispatchQueue.main)
.assign(to: \.events, on: self)
}
}
final class StubNoticeViewModel: NoticeViewModel {
override init() {
super.init()
guard
let url = Bundle.main.url(
forResource: "sampleSchedule",
withExtension: "json"
),
let data = try? Data(contentsOf: url),
let wrapper = try? JSONDecoder()
.decode(ScheduleWrapper.self, from: data)
else { return }
events = wrapper.schedule.events
}
}
| [
-1
] |
10920b5c7aa5e7bd3168c3d8d8f7ad1617b9282d | 8e9e3aa96ea89c2234523e93ed944d3c92bc6423 | /MapKitDemo_SwiftUI/SceneDelegate.swift | d00b478c3feec34fc71af9a6527726b88d114e29 | [] | no_license | hinzberg/MapViewDemo_for_SwiftUI | f560e2a781f79ec13232ce652a82b415ceacf5f0 | fc5eddb22887b108aa00acc86c1bb1427511f984 | refs/heads/master | 2022-03-30T23:42:26.819090 | 2020-01-27T19:15:29 | 2020-01-27T19:15:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,348 | swift | //
// SceneDelegate.swift
// MapKitDemo_SwiftUI
//
// Created by Holger Hinzberg on 15.12.19.
// Copyright © 2019 Holger Hinzberg. All rights reserved.
//
import UIKit
import SwiftUI
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
// Get the managed object context from the shared persistent container.
let context = (UIApplication.shared.delegate as! AppDelegate).persistentContainer.viewContext
// Create the SwiftUI view and set the context as the value for the managedObjectContext environment keyPath.
// Add `@Environment(\.managedObjectContext)` in the views that will need the context.
let contentView = ContentView().environment(\.managedObjectContext, context)
// Use a UIHostingController as window root view controller.
if let windowScene = scene as? UIWindowScene {
let window = UIWindow(windowScene: windowScene)
window.rootViewController = UIHostingController(rootView: contentView)
self.window = window
window.makeKeyAndVisible()
}
}
func sceneDidDisconnect(_ scene: UIScene) {
// Called as the scene is being released by the system.
// This occurs shortly after the scene enters the background, or when its session is discarded.
// Release any resources associated with this scene that can be re-created the next time the scene connects.
// The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead).
}
func sceneDidBecomeActive(_ scene: UIScene) {
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
}
func sceneWillResignActive(_ scene: UIScene) {
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).
}
func sceneWillEnterForeground(_ scene: UIScene) {
// Called as the scene transitions from the background to the foreground.
// Use this method to undo the changes made on entering the background.
}
func sceneDidEnterBackground(_ scene: UIScene) {
// Called as the scene transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
// Save changes in the application's managed object context when the application transitions to the background.
(UIApplication.shared.delegate as? AppDelegate)?.saveContext()
}
}
| [
325633,
325637,
163849,
333838,
186388,
346140,
16444,
337980,
217158,
243782,
395340,
327757,
200786,
286804,
329816,
217180,
368736,
342113,
180322,
329833,
286833,
252021,
342134,
286845,
286851,
329868,
250008,
329886,
286880,
135328,
192674,
333989,
286889,
356521,
430257,
180418,
350411,
180432,
350417,
350423,
350426,
385243,
334047,
356580,
350436,
346344,
327915,
338161,
350449,
350454,
321787,
336124,
350459,
350462,
336129,
350465,
350469,
325895,
194829,
350477,
43279,
350481,
350487,
356631,
338201,
325915,
350491,
325918,
182559,
350494,
325920,
350500,
194854,
350505,
350510,
248112,
332081,
307507,
340276,
336181,
356662,
332091,
332098,
201030,
332107,
190797,
334162,
332118,
321880,
332126,
258399,
332130,
250211,
340328,
250217,
348523,
348528,
182642,
321911,
332153,
334204,
332158,
250239,
332162,
348548,
332175,
348566,
160152,
340380,
176545,
326059,
342453,
334263,
338363,
324032,
336326,
393671,
338387,
248279,
369119,
334306,
338404,
334312,
338411,
104940,
375279,
162289,
328178,
328180,
248309,
328183,
340473,
199165,
328190,
324095,
328193,
98819,
324100,
324103,
164362,
248332,
199182,
328207,
324112,
330254,
186898,
342546,
340501,
324118,
334359,
342551,
324122,
334364,
330268,
340512,
191012,
332325,
324134,
197160,
324141,
324143,
334386,
324156,
334397,
152128,
324161,
324165,
219719,
324171,
324174,
324177,
244309,
334425,
326240,
248427,
191085,
346736,
338544,
334466,
336517,
344710,
119432,
148106,
162446,
330384,
326291,
340628,
342685,
340639,
336549,
332460,
336556,
332464,
164535,
336568,
174775,
248505,
174778,
244410,
328379,
332473,
223936,
328387,
332484,
332487,
154318,
332494,
342737,
154329,
183006,
139998,
189154,
338661,
338665,
332521,
330479,
342769,
340724,
332534,
338680,
342777,
344832,
207620,
191240,
328462,
326417,
336660,
199455,
336676,
336681,
334633,
326444,
215854,
328498,
271154,
326452,
152371,
326455,
340792,
348983,
244542,
326463,
326468,
328516,
336709,
127815,
244552,
328520,
326474,
328523,
336712,
342857,
326479,
355151,
330581,
326486,
136024,
330585,
326494,
326503,
201580,
326508,
201583,
326511,
211826,
340850,
330612,
201589,
340859,
324476,
328574,
340863,
351105,
324482,
324488,
324496,
330643,
324502,
252823,
324511,
324514,
252838,
201638,
211885,
252846,
324525,
5040,
5047,
324539,
324542,
340940,
345046,
330711,
248794,
340958,
248799,
340964,
338928,
328690,
359411,
244728,
330750,
328703,
199681,
328710,
330761,
328715,
330769,
209944,
336922,
209948,
248863,
345119,
250915,
357411,
250917,
158759,
328747,
209966,
209969,
330803,
209973,
209976,
339002,
339010,
209988,
209991,
347208,
248905,
330827,
197708,
330830,
248915,
345172,
183384,
156762,
343132,
339037,
322660,
210028,
326764,
326767,
345200,
330869,
361591,
210042,
210045,
152704,
160896,
351366,
330886,
384136,
384140,
337048,
210072,
248986,
384152,
210078,
384158,
210081,
384161,
210085,
210089,
339118,
337072,
337076,
210100,
324792,
367801,
339133,
384189,
343232,
384192,
210116,
337093,
244934,
326858,
322763,
333003,
384202,
343246,
384209,
333010,
146644,
330966,
210139,
328925,
66783,
384225,
343272,
351467,
328942,
251123,
384247,
384250,
242947,
206084,
115973,
343307,
384270,
333075,
384276,
333079,
251161,
384284,
245021,
384290,
208167,
171304,
245032,
245042,
345400,
208189,
372035,
343366,
337224,
251211,
337230,
331089,
337235,
331094,
365922,
175458,
208228,
343394,
175461,
343399,
337252,
345449,
175464,
333164,
99692,
343410,
234867,
331124,
175478,
155000,
378232,
249210,
175484,
337278,
249215,
245121,
249219,
245128,
249225,
181644,
249228,
136591,
245137,
181650,
249235,
112021,
181655,
245143,
175514,
245146,
245149,
343453,
245152,
245155,
355749,
40358,
181671,
245158,
333222,
245163,
181679,
327090,
337330,
210357,
146878,
181697,
361922,
327108,
181704,
339401,
327112,
384457,
327118,
208338,
366035,
343509,
337366,
249310,
249313,
333285,
329195,
343540,
343545,
339464,
337416,
249355,
329227,
175637,
345626,
245275,
366118,
339504,
206397,
349762,
339524,
333387,
214611,
333400,
339553,
343650,
333415,
245358,
333423,
222831,
138865,
339572,
126597,
339593,
126611,
140955,
333472,
245410,
345763,
245415,
337588,
325309,
337601,
337607,
333512,
339664,
358100,
245463,
212700,
181982,
153311,
333535,
225000,
337643,
245487,
339696,
337647,
245495,
141052,
337661,
339711,
225027,
337671,
339722,
249617,
321300,
245528,
333593,
116512,
184096,
339748,
358192,
399166,
325441,
247618,
325447,
341831,
329545,
341835,
323404,
354124,
339795,
354132,
341844,
247639,
337751,
358235,
341852,
313181,
413539,
339818,
327532,
339827,
358260,
341877,
325494,
182136,
186233,
1914,
333690,
243584,
325505,
333699,
339845,
247692,
333709,
247701,
337814,
329625,
327590,
333737,
337845,
190393,
327613,
333767,
346059,
311244,
358348,
247760,
212945,
333777,
219094,
329699,
358372,
327655,
247790,
333819
] |
6debedcda7cff8ab1fe6f39a5cb2a29d2611f89c | a07c217b85dc78a80a3f2c925ff80382b56d1263 | /Playgrounds/Functions.playground/section-1.swift | 8888dbb901df7d654b4bdf4b53e27055946410e4 | [] | no_license | LennyDuan/MobileSolutions | 05fca84916d35800dbb7e5b892191357ba4cdc5b | a9e28efa9ad7284e3da8e0a46758be67cc185011 | refs/heads/master | 2020-06-12T18:35:09.915246 | 2016-04-01T07:18:07 | 2016-04-01T07:18:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 8,401 | swift | // This playground covers the topic of functions. There are some short activities, each with a number. Example answers can be found at the end of this Playground.
// A function has a name, an optional list of parameters and an optional return value. Functions can be written at a global level or within classes and structs. All functions start with the keyword func.
// The following example is a function that only includes the name.
func aFunctionName() {
print("The statements are inserted here")
}
// To call the function
aFunctionName()
// The return value is specified after the parameter list. The symbols -> are used to separate the parameter list and the return type
func getMeAStringValue() -> String {
return "A string value as the result"
}
/*************************************************
// Activity
// 1.1 Write a statement that defines a constant that is initialised to the result from this method.
**************************************************/
//////////////////////////////////////////////////////////////////////////////
///
/// Parameters
///
//////////////////////////////////////////////////////////////////////////////
// The parameter list contains parameter names, followed by a colon, followed by a type. If there are multiple parameter names, each parameter is separated by a comma.
func add(int1: Int, int2: Int) -> Int {
return int1 + int2
}
// To call this method, we would write:
add(1, int2: 2)
// There is a different here from what you might expect in the language. Notice that the first parameter is presented as a value, whereas the second parameter needs a label before it. The int2: before the second parameter is the external name for the second parameter. In Swift, all function parameters can have two names: an external and an internal name. In the add() method above, there are only internal names.
// By default, the parameter names are just internal to the method. Formally, they are local parameter names. Howver, in Swift 2, these internal names can also become the default external names that are used in method calls. In Swift 2, a method call does not require an external name for the first parameter, but it does for any other parameters. By default, the internal name becomes the external name. Thus, the method call above uses int2: as a prefix to the second parameter.
// Swift has a way to define a external name for a parameter that is used explain what the purpose of the parameter is. This can be done by adding another name before the local parameter name. For the above example, we could write:
func add(numberOne int1: Int, numberTwo int2: Int) -> Int {
return int1 + int2
}
// To call this method, we include the external parameter names in the method call.
add(numberOne: 1, numberTwo: 2)
// The external parameter names can add clarity to what is being passed. This is something that has come over from the Objective-C approach and the various Objective-C APIs. In Objective-C, a good method name would be something that could be read as a sentence. An example using the add method could be:
func add(number int1: Int, toOtherNumber int2: Int) -> Int {
return int1 + int2
}
/*************************************************
// Activity
// 2.1 How would you call this method? Type it in and try it.
// 2.2 How would you define a function add where the first parameter does not have an external name, but the other parameter does?
**************************************************/
// You don't always have think of two different names. If you have a good local parameter name that is also useful as an external parameter name. As of Swift 2, you insert the name twice. You only need to do this for the first parameter, because the other parameters will automatically use the internal name as an external name.
// In Swift 1, you could use the # character before the name.
func addExternalNameExample(doubleOne doubleOne: Double, doubleTwo: Double) -> Double {
return doubleOne + doubleTwo
}
/*************************************************
// Activity
// 3.1 How would you call this method? Type it in an try it.
**************************************************/
// You have seen examples of the external parameter names when working with the tableView methods. For example, you have seen the following method call.
// tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath)
// Here, the first parameter does not use an external name but the second parameter does. The aim is to make this readable, so that you could read out 'table view dequeue reusable cell with identifier for index path' - which is a description of what should happen. Look at other methods you are using - it is common that the first parameter doesn't use an external name.
// Method parameters can also have default values.
func setName(forename f: String = "Unknown", surname s: String, initials i: String = "") {
print("The values were \(f) \(i) \(s)")
}
// Example method calls are shown below.
setName(forename: "Neil", surname: "Taylor", initials: "S")
setName(forename: "Neil", surname: "Taylor")
setName(surname: "Taylor")
///////////////////////////////////////////////////////////////////////
///
/// Class Initialisation
///
///////////////////////////////////////////////////////////////////////
// A class is setup using an initialiser, which has the name init. It doesn't use the keyword func.
class Circle {
var x: Int
var y: Int
init(x: Int, y: Int) {
self.x = x
self.y = y
}
}
// You can have several init methods, providing alternative ways to initialise the object.
// Initialisers (init methods) use external names by default for all parameters, which is the same as the one specified for the internal name. This is because the names are significant to help differentiate one from another if there are multiple init methods for a single class.
/*************************************************
// Activity
// 4.1 How would you create an instance of Circle? Type it in an try it.
//
// Hint: don't call the let/var name as c, because that is used at the end of this playground, and will make it seem as though your line is an error.
**************************************************/
// If you don't want one of the parameters for init to use an external name, add the _ character before the name.
class Name {
var forename: String
var surname: String
init(_ forename: String, surname: String) {
self.forename = forename
self.surname = surname
}
init(_ forename: String) {
self.forename = forename
self.surname = "Unknown"
}
}
var name1 = Name("Neil", surname: "Taylor")
var name2 = Name("Sarah")
///////////////////////////////////////////////////////////////////////
///
/// Tuples as return types
///
///////////////////////////////////////////////////////////////////////
// Functions can return muliple values, specified as a tuple.
func swap(left: Int, right: Int) -> (left: Int, right: Int) {
return (right, left)
}
let swappedValues = swap(10, right: 20)
// You can access the values using the names specified in the tuple
print(swappedValues.left)
print(swappedValues.right)
// You can also access the values using the index for the position
print(swappedValues.0)
print(swappedValues.1)
// The tuple doesn't have to specify names, so you could alternatively have:
func swapAlternative(left: Int, right: Int) -> (Int, Int) {
return (right, left)
}
let swappedValuesAlternative = swapAlternative(15, right: 5)
// In this situation, you could only use the index positions because there aren't any names
print(swappedValuesAlternative.0)
print(swappedValuesAlternative.1)
// You can also pass in a tuple as a parameter.
func a(t: (Int, Int, Int)) -> Int {
return t.0 + t.1 + t.2
}
a((10, 15, 12))
///////////////////////////////////////////////////////////////////////
///
/// Activities - Answers
///
///////////////////////////////////////////////////////////////////////
// 1.1
let aValue = getMeAStringValue()
// 2.1
add(number: 10, toOtherNumber: 2)
// 2.2
func add(number: Int, toOtherNumber other: Int) -> Int {
return number + other
}
add(10, toOtherNumber: 10)
// 3.1
addExternalNameExample(doubleOne: 5.0, doubleTwo: 10.5)
// 4.1
let c = Circle(x: 5, y: 10)
| [
-1
] |
5e55a27e3fce4da644cc1fd3a879c0c0bbd5a183 | 5c8e2c491f2b39268b16124d5a69d134db91ee57 | /WeatherApp/Views/LocationListView/LocationListFooterView.swift | 74f35d8da96d154b6f803dbd8422cfd52f1cafdd | [
"MIT"
] | permissive | danhenshaw/WeatherApp_V2 | 5fd552d06ad8d6d280eb8f97881ff78600c61de2 | b504f4ae697c06f6dde36cc10a828d920c16484c | refs/heads/master | 2020-04-17T01:38:00.349703 | 2019-02-19T13:45:07 | 2019-02-19T13:45:07 | 166,098,695 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,479 | swift | //
// LocationListFooterView.swift
// PageViewTest
//
// Created by Daniel Henshaw on 15/1/19.
// Copyright © 2019 Dan Henshaw. All rights reserved.
//
import UIKit
class LocationListFooterView : UITableViewHeaderFooterView {
lazy var darkSkyButton: UIButton = {
let width = 240.0
let height = width * 0.22656716417
let button = UIButton(frame: CGRect(x: 0, y: 0, width: width, height: height))
button.setBackgroundImage(UIImage(named: "darkbackground"), for: .normal)
button.addTarget(self, action: #selector(darkSkyButtonTapped), for: .touchUpInside)
button.imageView?.contentMode = .scaleAspectFit
return button
}()
override init(reuseIdentifier: String?) {
super.init(reuseIdentifier: reuseIdentifier)
setupView()
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func layoutSubviews() {
setupConstraints()
}
func setupView() {
addSubview(darkSkyButton)
}
func setupConstraints() {
darkSkyButton.topAnchor.constraint(equalToSystemSpacingBelow: self.topAnchor, multiplier: 0).isActive = true
darkSkyButton.center.x = self.center.x
}
@objc func darkSkyButtonTapped() {
UIApplication.shared.open(URL(string: "https://darksky.net/poweredby/")! as URL, options: [:], completionHandler: nil)
}
}
| [
-1
] |
6a6b9d71e0eba44ca7efa9bb1053be221eab670b | 52d0f15bd2b7e10121ded9001cbbfd0552920a66 | /Album Covers/Extensions.swift | 18391cc7c6238ff17b5f2be38c81f6db2f931022 | [
"MIT"
] | permissive | tarrouye/CoverBuddy | 356a62790dd969aff43ed605ce2b7fab36e7d52e | 14cb27533607feed184a6b54f16c68770d49ee23 | refs/heads/main | 2023-02-23T15:00:01.172812 | 2021-01-28T03:11:42 | 2021-01-28T03:11:42 | 332,084,488 | 9 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 1,940 | swift | //
// Extensions.swift
// Album Covers
//
// Created by Théo Arrouye on 1/11/21.
//
import Foundation
import UIKit
import SwiftUI
// For responsive layout
enum LayoutType {
case compact
case wide
}
func columnLayout(_ geo : GeometryProxy, _ horizontalSizeClass : UserInterfaceSizeClass?) -> LayoutType {
return ((UIDevice.current.userInterfaceIdiom == .pad || geo.size.width > geo.size.height) && horizontalSizeClass != .compact) ? .wide : .compact
}
// extend Cover to always assign a UUID and date on creation
extension Cover {
public override func awakeFromInsert() {
super.awakeFromInsert()
id = UUID()
dateEdited = Date()
}
}
// extend UIImage to add function to return average color of the image
extension UIImage {
var averageColor: UIColor? {
guard let inputImage = CIImage(image: self) else { return nil }
let extentVector = CIVector(x: inputImage.extent.origin.x, y: inputImage.extent.origin.y, z: inputImage.extent.size.width, w: inputImage.extent.size.height)
guard let filter = CIFilter(name: "CIAreaAverage", parameters: [kCIInputImageKey: inputImage, kCIInputExtentKey: extentVector]) else { return nil }
guard let outputImage = filter.outputImage else { return nil }
var bitmap = [UInt8](repeating: 0, count: 4)
let context = CIContext(options: [.workingColorSpace: kCFNull as Any])
context.render(outputImage, toBitmap: &bitmap, rowBytes: 4, bounds: CGRect(x: 0, y: 0, width: 1, height: 1), format: .RGBA8, colorSpace: nil)
return UIColor(red: CGFloat(bitmap[0]) / 255, green: CGFloat(bitmap[1]) / 255, blue: CGFloat(bitmap[2]) / 255, alpha: CGFloat(bitmap[3]) / 255)
}
}
// extend UIApplication to add function to dismiss the keyboard
extension UIApplication {
func endEditing() {
sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil)
}
}
| [
-1
] |
6d74fa7b8928f7d722f90183f1a9eeaa0c02fb36 | 4f01eb1ede2689c046b9f9f946b5e22000872484 | /Pods/CocoaDebug/Sources/App/AboutViewController.swift | 76c6761314aa93f94d69b5d93cdf1b0077aef6bd | [
"Apache-2.0",
"MIT"
] | permissive | corus19/corus-ios | e9d6e93933416404d4248cc10d7d47c2b3e63ae8 | 35ee35e81db08576a889fc4dbf5e216844a177bf | refs/heads/master | 2021-05-20T08:22:56.028186 | 2020-04-01T21:07:16 | 2020-04-01T21:07:16 | 252,193,068 | 4 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 525 | swift | //
// Example
// man.li
//
// Created by man.li on 11/11/2018.
// Copyright © 2020 man.li. All rights reserved.
//
import Foundation
import UIKit
class AboutViewController: UITableViewController {
@IBOutlet weak var versionLabel: UILabel!
//MARK: - init
override func viewDidLoad() {
super.viewDidLoad()
let version = "1.2.3"
self.versionLabel.text = "CocoaDebug Version ".appending(version)
tableView.tableFooterView = UIView()
}
}
| [
-1
] |
e3241c152a3ff163c630588361fa7551503457d8 | d2411025a1c2c018a460be85d8ddc7b7303bbc98 | /SpaceMissionReloaded/SpecialThanksCreditsScene.swift | d8f08f212ef81d46da3a7767f1d9cd143468c2f4 | [] | no_license | yklose/SpaceMission | 53000035c48052b3357658bd98577b4f4918c347 | dfc0b5be9bc6194cb2f69816740410a00ad1f31d | refs/heads/master | 2021-01-17T14:31:54.327675 | 2019-11-23T21:00:37 | 2019-11-23T21:00:37 | 70,249,177 | 3 | 1 | null | 2016-10-31T21:05:47 | 2016-10-07T13:29:11 | Swift | UTF-8 | Swift | false | false | 2,590 | swift | //
// SpecialThanksCreditsScene.swift
// SpaceMission
//
// Created by Yannick Klose on 02.10.16.
// Copyright © 2016 Yannick Klose. All rights reserved.
//
import Foundation
import SpriteKit
class SpecialThanksCreditsScene: SKScene { //Not finished yet
override func didMove(to view: SKView) {
let background = SKSpriteNode(imageNamed: "background")
background.position = CGPoint(x: self.size.width/2, y: self.size.height/2)
background.zPosition = 0
self.addChild(background)
let backToMenue = SKLabelNode(fontNamed: "The Bold Font")
backToMenue.text = "back to menue"
backToMenue.name = "back"
backToMenue.fontSize = 60
backToMenue.fontColor = SKColor.white
backToMenue.position = CGPoint(x: self.size.width*0.5, y: self.size.height*0.1)
backToMenue.zPosition = 5
self.addChild(backToMenue)
//add here some Special Thanks
let instructions = "-- SPECIAL THANKS --\n\n I really want to thank \nsome people, who made \nthis game possible! \n\nFirst of there is my \nbrother LOUIS KLOSE, who \nmade this insane grafic! \n\nBut then there is also my \nuncle RALF TAPPMEYER, who \nhelped me whenever I \nneeded him.\n\n Thank you! \n"
let instructionMessage = SKLabelNode(fontNamed: "The Bold Font")
instructionMessage.fontSize = 70
//instructionMessage.horizontalAlignmentMode = .left
//instructionMessage.verticalAlignmentMode = .top
instructionMessage.fontColor = UIColor.white
instructionMessage.text = instructions
let message = instructionMessage.multilined()
message.position = CGPoint(x: self.size.width*0.5, y: self.size.height*0.5)
message.zPosition = 1001
self.addChild(message)
//test test
}
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
for touch: AnyObject in touches{
let pointOfTouch = touch.location(in: self)
let NodeITapped = atPoint(pointOfTouch)
if NodeITapped.name == "back"{
let sceneToMoveTo = MainMenueScene(size: self.size)
sceneToMoveTo.scaleMode = self.scaleMode
let myTransition = SKTransition.fade(withDuration: 0.5)
self.view!.presentScene(sceneToMoveTo, transition: myTransition)
}
}}
}
| [
-1
] |
66d641e57b6dab149c2950595cf0c965502e9762 | 0fe46a01564055e09925a1aedf3492714bb62f1c | /CoinKeeperTests/Networking/NetworkManagerIntegrationTests.swift | 0b9e97fbfede60e5ab807426224d3296dd3b9173 | [
"MIT"
] | permissive | SixFiveSoftware/dropbit-ios | b56b9cfa3180207e14ee2d989ef62475bace5412 | 0d5eebd082a9e6f632f13145bc18d7ce52dccb12 | refs/heads/master | 2020-12-31T10:12:13.362185 | 2020-02-05T00:08:06 | 2020-02-05T00:08:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,560 | swift | //
// NetworkManagerIntegrationTests.swift
// DropBitTests
//
// Created by Ben Winters on 10/22/18.
// Copyright © 2018 Coin Ninja, LLC. All rights reserved.
//
import PromiseKit
@testable import DropBit
import Moya
import XCTest
/// Runs tests that provide the MockCoinNinjaProvider with response data
/// and status codes to simulate actual server responses.
class NetworkManagerIntegrationTests: XCTestCase {
var sut: NetworkManager!
var persistenceManager: PersistenceManagerType!
var cnProvider: MockCoinNinjaProvider!
override func setUp() {
super.setUp()
persistenceManager = MockPersistenceManager()
cnProvider = MockCoinNinjaProvider()
self.sut = NetworkManager(persistenceManager: self.persistenceManager,
analyticsManager: MockAnalyticsManager(),
coinNinjaProvider: cnProvider)
}
override func tearDown() {
self.sut = nil
self.persistenceManager = nil
self.cnProvider = nil
super.tearDown()
}
func testNegativeTransactionPriceThrowsError() {
let response = PriceTransactionResponse(average: -100)
cnProvider.appendResponseStub(data: response.asData())
let expectation = XCTestExpectation(description: "throw error for negative price")
self.sut.fetchDayAveragePrice(for: "")
.done { _ in
XCTFail("Should not return valid response")
}.catch { error in
let expectedPath = PriceTransactionResponseKey.average.path
let expectedValue = String(response.average)
guard let networkError = error as? DBTError.Network,
case let .invalidValue(path, value, _) = networkError else {
XCTFail("Received incorrect error: \(error.localizedDescription)")
return
}
XCTAssertEqual(expectedPath, path, "Error path should be \(expectedPath)")
XCTAssertEqual(expectedValue, value, "Error value should be \(expectedValue)")
expectation.fulfill()
}
wait(for: [expectation], timeout: 3.0)
}
func testMaxFeesThrowsError() {
let sample = CheckInResponse.sampleInstance()!
let invalidFee = FeesResponse.validFeeCeiling + 1
let testFees = FeesResponse(fast: 1, med: 1, slow: invalidFee)
let testCheckInResponse = CheckInResponse(blockheight: sample.blockheight, fees: testFees, pricing: sample.pricing)
cnProvider.appendResponseStub(data: testCheckInResponse.asData())
let expectation = XCTestExpectation(description: "throw error for max fees")
self.sut.walletCheckIn()
.done { _ in
XCTFail("Should not return valid response")
}.catch { error in
let expectedPath = FeesResponseKey.slow.path
let expectedValue = String(testCheckInResponse.fees.good)
guard let networkError = error as? DBTError.Network,
case let .invalidValue(path, value, _) = networkError else {
XCTFail("Received incorrect error: \(error.localizedDescription)")
return
}
XCTAssertEqual(expectedPath, path, "Error path should be \(expectedPath)")
XCTAssertEqual(expectedValue, value, "Error value should be \(expectedValue)")
expectation.fulfill()
}
wait(for: [expectation], timeout: 3.0)
}
func testEmptyStringWalletAddressThrowsError() {
let sample = WalletAddressResponse.sampleInstance()!
let emptyWalletAddress = WalletAddressResponse(id: sample.id,
createdAt: sample.createdAt,
updatedAt: sample.updatedAt,
address: "",
addressPubkey: sample.addressPubkey,
walletId: sample.walletId)
let validWalletAddress = sample
let responseListWithEmptyAddress = [emptyWalletAddress, validWalletAddress].asData()
cnProvider.appendResponseStub(data: responseListWithEmptyAddress)
let expectation = XCTestExpectation(description: "throw error for empty string as address")
self.sut.getWalletAddresses()
.done { _ in
XCTFail("Should not return valid response")
}
.catch { error in
guard let networkError = error as? DBTError.Network,
case .invalidValue = networkError else {
XCTFail("Received incorrect error: \(error.localizedDescription)")
return
}
expectation.fulfill()
}
wait(for: [expectation], timeout: 3.0)
}
}
| [
-1
] |
23f3b7b6bcccbb7433b68b34e17a2adea0575a5d | 2ca5bf394b620605039da9cc07f0c3e202fdff59 | /GarbageCam/CameraController.swift | 52a532389ed200d3f63e6669d9e05888162c0618 | [] | no_license | caraesten/garbagecam | eafcfcbc4d8e652852de79204484c7fd679fbb99 | 257d950c9ad1dfb718c2d44cfc44dcf98cdd901b | refs/heads/master | 2023-04-07T14:10:32.648016 | 2023-03-18T00:49:22 | 2023-03-18T00:49:22 | 67,636,080 | 7 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 12,851 | swift | //
// CameraController.swift
// GarbageCam
//
// Created by Esten Hurtle on 9/7/16.
// Copyright © 2016 Esten Hurtle. All rights reserved.
//
import Foundation
import UIKit
import AVFoundation
import CoreVideo
import CoreGraphics
import FirebaseCrashlytics
class CameraController: NSObject, AVCaptureVideoDataOutputSampleBufferDelegate {
static let DEFAULT_QUEUE_NAME = "com.estenh.GarbageCameraQueue"
static let DEFAULT_PROCESS_QUEUE_NAME = "com.estenh.GarbageCameraProcessQueue"
var processedImage:UIImage? {
get {
if (mIsRecording || mCurrentData.isEmpty) {
return nil
}
if let processed = mFinalImage {
return processed
} else {
mFinalImage = processImages()
return mFinalImage!
}
}
}
let currentCamera: GarbageCamera
fileprivate let mCaptureQueue: DispatchQueue
fileprivate let mProcessQueue: DispatchQueue
fileprivate let mQueueName: String
fileprivate let mProcessor: ImageProcessor
fileprivate let mCaptureProcessor: CaptureProcessor
fileprivate let mDelegate: CameraEventDelegate
fileprivate var mIsRecording:Bool = false
fileprivate var mIsExposureLocked:Bool = false
fileprivate var mCurrentData:[UIImage] = [UIImage]()
fileprivate var mFinalImage:UIImage?
fileprivate var mCaptureDevice: AVCaptureDevice?
fileprivate var mPreviewLayer: CALayer?
fileprivate lazy var cameraSession: AVCaptureSession = {
let captureDevice = AVCaptureDevice.default(for: .video)
let s = AVCaptureSession()
return s
}()
class func make(camera: GarbageCamera, delegate: CameraEventDelegate, controller: CameraController?, queueName: String?) -> CameraController {
let cameraController = CameraController(camera: camera, delegate: delegate, queueName: queueName)
if let camCtrl = controller {
cameraController.mCaptureDevice = camCtrl.mCaptureDevice
}
return cameraController
}
init(camera: GarbageCamera, delegate: CameraEventDelegate, queueName: String?) {
if let qn = queueName {
mQueueName = qn
} else {
mQueueName = CameraController.DEFAULT_QUEUE_NAME
}
mCaptureQueue = DispatchQueue(label: mQueueName, qos: .userInitiated, attributes: [])
mProcessQueue = DispatchQueue(label: CameraController.DEFAULT_PROCESS_QUEUE_NAME, qos: .utility)
mProcessor = camera.imageProcessor
mCaptureProcessor = camera.captureProcessor
mDelegate = delegate
currentCamera = camera
}
func startSession() {
cameraSession.startRunning()
}
func stopSession() {
cameraSession.stopRunning()
}
func processImages() -> UIImage {
return mProcessor.process(mCurrentData)
}
func tearDownPreview(_ view: UIView) {
if let oldLayer = mPreviewLayer {
oldLayer.removeFromSuperlayer()
}
}
func switchCamera() {
cameraSession.beginConfiguration()
if let input = cameraSession.inputs[0] as? AVCaptureDeviceInput {
cameraSession.removeInput(input)
if let newCam = getCameraForPosition(position: input.device.position == .back ? .front : .back) {
do {
let maxFps = configureForMaxFps(device: newCam)
let newInput:AVCaptureDeviceInput = try AVCaptureDeviceInput(device: newCam)
mCaptureDevice = newCam
cameraSession.addInput(newInput)
cameraSession.commitConfiguration()
mDelegate.onCameraPrepared(fps: Float(maxFps))
} catch let e as NSError {
// Crashlytics.sharedInstance().recordError(e)
}
}
}
}
func getCameraForPosition(position: AVCaptureDevice.Position) -> AVCaptureDevice? {
return (AVCaptureDevice.devices(for: .video) as! [AVCaptureDevice]).first(where: {$0.position == position})
}
func getCurrentCaptureHeight() -> CGFloat {
if (mCurrentData.count == 0) {
return 0
} else {
return (mCurrentData.first?.size.height)!
}
}
func setupSession(_ view: UIView) {
let maxFps: Float
if mCaptureDevice == nil {
mCaptureDevice = AVCaptureDevice.default(for: .video)
}
let captureDevice = mCaptureDevice!
cameraSession.beginConfiguration()
do {
NotificationCenter.default.addObserver(forName: NSNotification.Name.AVCaptureSessionRuntimeError, object: nil, queue: nil, using: {
(errorNotif: Notification!) -> Void in
NSLog("Error: %@", errorNotif.description)
// TODO: Ideally this would accurately record stack frame
let error = NSError(domain: "SessionError", code: -1001)
Crashlytics.crashlytics().record(error: error)
})
let input = try AVCaptureDeviceInput(device: captureDevice)
try mCaptureDevice?.lockForConfiguration()
if let inputs = cameraSession.inputs as? [AVCaptureDeviceInput] {
if (inputs.count > 0) {
cameraSession.removeInput(inputs[0])
}
}
if (cameraSession.canAddInput(input)) {
cameraSession.addInput(input)
}
let dataOut = AVCaptureVideoDataOutput()
dataOut.videoSettings = [(kCVPixelBufferPixelFormatTypeKey as String) : NSNumber(value: kCVPixelFormatType_32BGRA as UInt32)]
dataOut.alwaysDiscardsLateVideoFrames = true
let outputs = cameraSession.outputs
if (outputs.count > 0) {
cameraSession.removeOutput(outputs[0])
}
if (cameraSession.canAddOutput(dataOut)) {
cameraSession.addOutput(dataOut)
}
// TODO: Add selection of mode (> resolution than 720p for grid capture would be nice, 4k would be incredible)
dataOut.setSampleBufferDelegate(self, queue: mCaptureQueue)
} catch let error as NSError {
NSLog("Error: %@", error.description)
Crashlytics.crashlytics().record(error: error)
}
preparePreviewLayer(view)
// MAX POWER
let curMax: Double
if let captureDevice = mCaptureDevice {
curMax = configureForMaxFps(device: captureDevice)
} else {
curMax = 0
}
maxFps = Float(curMax)
cameraSession.commitConfiguration()
mDelegate.onCameraPrepared(fps: maxFps)
}
// Returns the configured max FPS
func configureForMaxFps(device: AVCaptureDevice) -> Double {
var curMax = 0.0
var bestFormat = device.formats.first
for format in device.formats {
let ranges = format.videoSupportedFrameRateRanges
let rates = ranges[0]
if (rates.maxFrameRate > curMax) {
bestFormat = format
curMax = rates.maxFrameRate
}
}
do {
if let formatToConfigure = bestFormat {
try device.lockForConfiguration()
device.activeFormat = formatToConfigure
let rates = formatToConfigure.videoSupportedFrameRateRanges[0]
device.activeVideoMinFrameDuration = rates.minFrameDuration
device.activeVideoMaxFrameDuration = rates.minFrameDuration
device.unlockForConfiguration()
}
} catch let error as NSError {
NSLog("Error: %@", error.description)
Crashlytics.crashlytics().record(error: error)
}
return curMax
}
// Returns new state
func toggleRecording() -> Bool {
if (!mIsRecording) {
if let device = mCaptureDevice {
do {
if device.isFocusModeSupported(.locked) {
try device.lockForConfiguration()
device.focusMode = AVCaptureDevice.FocusMode.locked
device.unlockForConfiguration()
}
} catch let error as NSError {
NSLog("Error: %@", error.description)
Crashlytics.crashlytics().record(error: error)
}
}
mIsRecording = true
} else {
if let device = mCaptureDevice {
do {
if device.isFocusModeSupported(.autoFocus) {
try device.lockForConfiguration()
device.focusMode = AVCaptureDevice.FocusMode.autoFocus
device.unlockForConfiguration()
}
} catch let error as NSError {
NSLog("Error: %@", error.description)
Crashlytics.crashlytics().record(error: error)
}
}
mIsRecording = false
if (mCurrentData.count > 0) {
// Enqueue a finish, wait for frames to process
mCaptureQueue.async(execute: {() in
self.finishRecording()
})
}
}
return mIsRecording
}
func finishRecording() {
mIsRecording = false
// Post this to the main thread; this method is usually called from a dispatch queue,
// no reason for clients to have to worry about that.
DispatchQueue.main.async {
self.mDelegate.onRecordingFinished()
}
}
func isRecording() -> Bool {
return mIsRecording
}
// Returns new state
func toggleExposureLock() -> Bool {
if let device = mCaptureDevice {
do {
try device.lockForConfiguration()
let newState: Bool
if (device.exposureMode != .locked) {
device.exposureMode = .locked
newState = true
} else {
device.exposureMode = .continuousAutoExposure
newState = false
}
device.unlockForConfiguration()
return newState
} catch let error as NSError {
NSLog("Error: %@", error.description)
Crashlytics.crashlytics().record(error: error)
}
}
return false
}
func clearData() {
mCurrentData.removeAll()
mFinalImage = nil
}
@objc func captureOutput(_ output: AVCaptureOutput,
didOutput sampleBuffer: CMSampleBuffer,
from connection: AVCaptureConnection) {
let progress = mCaptureProcessor.getProgress(mCurrentData.count)
let isDone = mCaptureProcessor.isDone(mCurrentData.count)
if (progress > 0 && !isDone) {
DispatchQueue.main.async {
self.mDelegate.onRecordingProgress(percent: progress)
}
} else if (!isDone) {
DispatchQueue.main.async {
self.mDelegate.onRecordingProgress(frames: self.mCurrentData.count)
}
}
if (mIsRecording && isDone) {
finishRecording()
} else if (mIsRecording) {
mProcessQueue.async {
if (self.mCaptureProcessor.getMaxSize() == -1 || self.mCurrentData.count < self.mCaptureProcessor.getMaxSize()) {
let img = self.mCaptureProcessor.process(sampleBuffer, frameCount: self.mCurrentData.count)
self.mCurrentData.append(img)
}
}
}
}
fileprivate func preparePreviewLayer(_ view: UIView) {
let viewBounds = view.bounds
if let oldLayer = mPreviewLayer {
oldLayer.removeFromSuperlayer()
}
let previewLayer = AVCaptureVideoPreviewLayer(session: self.cameraSession)
previewLayer.bounds = CGRect(x: 0, y: 0, width: viewBounds.width, height: viewBounds.height)
previewLayer.position = CGPoint(x: viewBounds.midX, y: viewBounds.midY)
previewLayer.videoGravity = AVLayerVideoGravity.resizeAspectFill
view.layer.insertSublayer(previewLayer, at: 0)
mPreviewLayer = previewLayer
}
}
protocol CameraEventDelegate {
func onRecordingProgress(percent: Float)
func onRecordingProgress(frames: Int)
func onRecordingFinished()
func onCameraPrepared(fps: Float)
}
| [
-1
] |
45e210a2ad56d4d2c37a2d9893dfa79f09dbc17e | 5e5219b3476166e6d25d489380862f838cc932d3 | /Sources/ApodiniGraphQL/GraphQLInterfaceExporter.swift | e8a8198bedf899e9dfd9043fb24e3605c2a2c324 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | Apodini/Apodini | 5f235c6025a6a6f2c4624e54f68062f7abff0a90 | 1f9f36d54f42620d52cff67e82e09f62c2566ac3 | refs/heads/develop | 2023-04-09T21:26:35.820074 | 2022-10-07T07:59:50 | 2022-10-07T07:59:50 | 274,515,276 | 86 | 15 | null | 2022-10-11T11:46:10 | 2020-06-23T21:45:56 | Swift | UTF-8 | Swift | false | false | 6,093 | swift | //
// This source file is part of the Apodini open source project
//
// SPDX-FileCopyrightText: 2019-2021 Paul Schmiedmayer and the Apodini project authors (see CONTRIBUTORS.md) <[email protected]>
//
// SPDX-License-Identifier: MIT
//
import Apodini
import ApodiniExtension
import ApodiniNetworking
import Logging
import Foundation
import GraphQL
public class GraphQL: Configuration {
fileprivate let graphQLEndpoint: [HTTPPathComponent]
fileprivate let enableGraphiQL: Bool
fileprivate let graphiQLEndpoint: [HTTPPathComponent]
fileprivate let enableCustom64BitIntScalars: Bool
public init(
graphQLEndpoint: [HTTPPathComponent] = "/graphql",
enableGraphiQL: Bool = false,
graphiQLEndpoint: [HTTPPathComponent] = "/graphiql",
enableCustom64BitIntScalars: Bool = true
) {
precondition(graphQLEndpoint.allSatisfy(\.isConstant), "GraphQL endpoint must be a constant path")
precondition(graphiQLEndpoint.allSatisfy(\.isConstant), "GraphiQL endpoint must be a constant path")
self.graphQLEndpoint = graphQLEndpoint
self.enableGraphiQL = enableGraphiQL
self.graphiQLEndpoint = graphiQLEndpoint
self.enableCustom64BitIntScalars = enableCustom64BitIntScalars
}
public func configure(_ app: Application) {
let exporter = GraphQLInterfaceExporter(app: app, config: self)
app.registerExporter(exporter: exporter)
}
}
class GraphQLInterfaceExporter: InterfaceExporter {
private let app: Application
private let config: GraphQL
private let logger: Logger
private let schemaBuilder: GraphQLSchemaBuilder
init(app: Application, config: GraphQL) {
self.app = app
self.config = config
self.logger = Logger(label: "\(app.logger.label).GraphQL")
self.schemaBuilder = GraphQLSchemaBuilder(
enableCustom64BitIntScalars: config.enableCustom64BitIntScalars
)
}
func export<H: Handler>(_ endpoint: Endpoint<H>) {
do {
try schemaBuilder.add(endpoint)
logger.notice("Exported endpoint \(endpoint)")
} catch let error as GraphQLSchemaBuilder.SchemaError {
switch error {
case let .unsupportedOpCommPatternTuple(operation, commPattern):
logger.error("Not exporting endpoint: unsupported operation/commPattern tuple (\(operation), \(commPattern)). (endpoint: \(endpoint))")
default:
fatalError("\(error)")
}
} catch {
fatalError("\(error)")
}
}
func export<H: Handler>(blob endpoint: Endpoint<H>) where H.Response.Content == Blob {
logger.error("Blob endpoint \(endpoint) cannot be exported")
}
func finishedExporting(_ webService: WebServiceModel) {
let schema: GraphQLSchema
do {
schema = try schemaBuilder.finalize()
} catch {
fatalError("Error finalizing GraphQL schema: \(error)")
}
try! app.httpServer.registerRoute(.GET, config.graphQLEndpoint, responder: GraphQLQueryHTTPResponder(schema: schema))
try! app.httpServer.registerRoute(.POST, config.graphQLEndpoint, responder: GraphQLQueryHTTPResponder(schema: schema))
if config.enableGraphiQL {
registerGraphiQLEndpoint()
}
}
private func registerGraphiQLEndpoint() {
let graphqlEndpointUrl = app.httpConfiguration.uriPrefix + config.graphQLEndpoint.httpPathString
try! app.httpServer.registerRoute(.GET, config.graphiQLEndpoint) { req -> HTTPResponse in
guard let url = Bundle.module.url(forResource: "graphiql", withExtension: "html") else {
throw HTTPAbortError(status: .internalServerError)
}
guard var htmlPage = (try? Data(contentsOf: url)).flatMap({ String(data: $0, encoding: .utf8) }) else {
throw HTTPAbortError(status: .internalServerError)
}
htmlPage = htmlPage.replacingOccurrences(of: "{{APODINI_GRAPHQL_ENDPOINT_URL}}", with: graphqlEndpointUrl)
return HTTPResponse(
version: req.version,
status: .ok,
headers: HTTPHeaders {
$0[.contentType] = .html
},
bodyStorage: .buffer(.init(string: htmlPage))
)
}
}
}
struct GraphQLEndpointDecodingStrategy: EndpointDecodingStrategy {
typealias Input = Map
func strategy<Element: Codable>(for parameter: EndpointParameter<Element>) -> AnyParameterDecodingStrategy<Element, Input> {
GraphQLEndpointParameterDecodingStrategy<Element>(name: parameter.name).typeErased
}
}
private struct GraphQLEndpointParameterDecodingStrategy<T: Codable>: ParameterDecodingStrategy {
typealias Element = T
typealias Input = Map
private struct Wrapped<T: Codable>: Codable {
let value: T
}
let name: String
func decode(from input: Input) throws -> T {
guard let value = try input.dictionaryValue(converting: true)[name] else {
throw ApodiniError(type: .badInput, reason: "Unable to find parameter named '\(name)' (T: \(T.self))")
}
if value.isUndefined {
throw ApodiniError(type: .badInput, reason: "Parameter value is `undefined`")
}
// We need to wrap this in a dictionary to make sure that we're working with a top-level object.
// (This isn't strictly necessary, since these coding steps seem to be working fine for top-level strings,
// but it reduces the probability of something going wrong, because otherwuise we'd be emitting not-standard-conformant JSON)
let data = try JSONEncoder().encode(Map.dictionary(["value": value]))
let decoder = JSONDecoder()
decoder.dateDecodingStrategy = .formatted(GraphQLSchemaBuilder.dateFormatter)
decoder.dataDecodingStrategy = .base64
return try decoder.decode(Wrapped<T>.self, from: data).value
}
}
| [
-1
] |
d05df7987d5acd556b3ff2bcc2ebfdb227ffe5e4 | 5023031a635afbdf84a3c0a59801c66318d30728 | /Demo/Sources/SwiftUIDemoViewController.swift | 8f7db864fb39800e18835fed78f22d7c2e5abcb6 | [
"MIT"
] | permissive | psharanda/Atributika | 9b2faecdcfa3a316a89db7d155f54235caafcaf1 | 03602383e9e046bb0ebab64de570096fb14d6267 | refs/heads/master | 2023-08-18T07:25:56.790668 | 2023-06-05T12:45:51 | 2023-06-05T12:45:51 | 58,332,862 | 1,299 | 175 | MIT | 2023-06-04T10:59:09 | 2016-05-08T21:46:22 | Swift | UTF-8 | Swift | false | false | 2,994 | swift | //
// Copyright © 2017-2023 Pavel Sharanda. All rights reserved.
//
import Atributika
import AtributikaViews
import SwiftUI
import UIKit
@available(iOS 13.0, *)
public struct AttrLabel: UIViewRepresentable {
public var attributedString: NSAttributedString
public var preferredMaxLayoutWidth: CGFloat = .greatestFiniteMagnitude
public init(attributedString: NSAttributedString, preferredMaxLayoutWidth: CGFloat) {
self.attributedString = attributedString
self.preferredMaxLayoutWidth = preferredMaxLayoutWidth
}
public func makeUIView(context: Context) -> AttributedLabel {
let label = AttributedLabel()
label.numberOfLines = 0
label.setContentHuggingPriority(.required, for: .vertical)
label.setContentCompressionResistancePriority(.required, for: .vertical)
label.setContentHuggingPriority(.defaultLow, for: .horizontal)
label.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
label.linkHighlightViewFactory = RoundedRectLinkHighlightViewFactory()
updateUIView(label, context: context)
return label
}
public func updateUIView(_ label: AttributedLabel, context _: Context) {
label.attributedText = attributedString
label.preferredMaxLayoutWidth = preferredMaxLayoutWidth
}
}
@available(iOS 13.0, *)
public struct HorizontalGeometryReader<Content: View>: View {
public var content: (CGFloat) -> Content
@State private var width: CGFloat = 0
public init(@ViewBuilder content: @escaping (CGFloat) -> Content) {
self.content = content
}
public var body: some View {
content(width)
.frame(minWidth: 0, maxWidth: .infinity)
.background(
GeometryReader { geometry in
Color.clear
.preference(key: WidthPreferenceKey.self, value: geometry.size.width)
}
)
.onPreferenceChange(WidthPreferenceKey.self) { width in
self.width = width
}
}
}
@available(iOS 13.0, *)
private struct WidthPreferenceKey: PreferenceKey, Equatable {
static var defaultValue: CGFloat = 0
/// An empty reduce implementation takes the first value
static func reduce(value _: inout CGFloat, nextValue _: () -> CGFloat) {}
}
@available(iOS 13.0, *)
struct ContentView: View {
var body: some View {
List {
ForEach(tweets, id: \.self) { item in
HorizontalGeometryReader { width in
AttrLabel(
attributedString: item.styleAsTweet(),
preferredMaxLayoutWidth: width
)
.padding(5)
}
}
}
}
}
@available(iOS 13.0, *)
class SwiftUIDemoViewController: UIHostingController<ContentView> {
override func viewDidLoad() {
super.viewDidLoad()
title = "SwiftUI"
}
}
| [
-1
] |
7ea16cdde3920516d16b1a68f02957856d798056 | 0213d1a939ed73ae3aae5a583038d40c24fddd18 | /TdlibKit/Models/TestBytes.swift | fe97b4250dd24f9726702677b9e4965f14a658c3 | [] | no_license | antonkhmv/JuliusCaesar | 8a4d58a07f1dd92bf5835426bcfed9679ed931cb | 05985bf2188bcdee0a79eef2cb8d39e874680e17 | refs/heads/main | 2023-07-07T17:27:31.100350 | 2021-08-25T19:46:17 | 2021-08-25T19:46:17 | 366,678,837 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 309 | swift | //
// TestBytes.swift
// tl2swift
//
// Created by Code Generator
//
import Foundation
/// A simple object containing a sequence of bytes; for testing only
public struct TestBytes: Codable {
/// Bytes
public let value: Data
public init (value: Data) {
self.value = value
}
}
| [
-1
] |
ca660884390187a13b401987ebfa24f2b122d115 | 8d415a36aa0ea97895baa7cda7fef5043772ee91 | /Currency/Vendor/SwiftyPickerPopover/StringPickerPopoverViewController.swift | 15802d2ee74967ea327d880f267861a002ce8476 | [
"MIT"
] | permissive | Rahul-Mayani/Currency-Converter | 8c607bcb5ce84ef6f67a87ea3f5950a709abb34d | 76a778d68dc65998c6d43d965432d44de7a3fa27 | refs/heads/main | 2023-05-14T11:27:34.754126 | 2021-06-07T14:50:30 | 2021-06-07T14:50:30 | 374,666,570 | 1 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 9,000 | swift | //
// StringPickerPopoverViewController.swift
// SwiftyPickerPopover
//
// Created by Yuta Hoshino on 2016/09/14.
// Copyright © 2016 Yuta Hoshino. All rights reserved.
//
import Foundation
import UIKit
public class StringPickerPopoverViewController: AbstractPickerPopoverViewController {
// MARK: Types
/// Popover type
typealias PopoverType = StringPickerPopover
// MARK: Properties
/// Popover
private var popover: PopoverType! { return anyPopover as? PopoverType }
@IBOutlet weak private var cancelButton: UIBarButtonItem!
@IBOutlet weak private var doneButton: UIBarButtonItem!
@IBOutlet weak private var picker: UIPickerView!
@IBOutlet weak private var clearButton: UIButton!
override public func viewDidLoad() {
super.viewDidLoad()
picker.delegate = self
}
/// Make the popover properties reflect on this view controller
override func refrectPopoverProperties(){
super.refrectPopoverProperties()
// Select row if needed
picker?.selectRow(popover.selectedRow, inComponent: 0, animated: true)
// Set up cancel button
if #available(iOS 11.0, *) { }
else {
navigationItem.leftBarButtonItem = nil
navigationItem.rightBarButtonItem = nil
}
cancelButton.title = popover.cancelButton.title
if let font = popover.cancelButton.font {
cancelButton.setTitleTextAttributes([NSAttributedString.Key.font: font], for: .normal)
}
cancelButton.tintColor = popover.cancelButton.color ?? popover.tintColor
navigationItem.setLeftBarButton(cancelButton, animated: false)
doneButton.title = popover.doneButton.title
if let font = popover.doneButton.font {
doneButton.setTitleTextAttributes([NSAttributedString.Key.font: font], for: .normal)
}
doneButton.tintColor = popover.doneButton.color ?? popover.tintColor
navigationItem.setRightBarButton(doneButton, animated: false)
clearButton.setTitle(popover.clearButton.title, for: .normal)
if let font = popover.clearButton.font {
clearButton.titleLabel?.font = font
}
clearButton.tintColor = popover.clearButton.color ?? popover.tintColor
clearButton.isHidden = popover.clearButton.action == nil
enableClearButtonIfNeeded()
}
private func enableClearButtonIfNeeded() {
guard !clearButton.isHidden else {
return
}
clearButton.isEnabled = false
if let selectedRow = picker?.selectedRow(inComponent: 0),
let selectedValue = popover.choices[safe: selectedRow] {
clearButton.isEnabled = selectedValue != popover.kValueForCleared
}
}
/// Action when tapping done button
///
/// - Parameter sender: Done button
@IBAction func tappedDone(_ sender: AnyObject? = nil) {
tapped(button: popover.doneButton)
}
/// Action when tapping cancel button
///
/// - Parameter sender: Cancel button
@IBAction func tappedCancel(_ sender: AnyObject? = nil) {
tapped(button: popover.cancelButton)
}
private func tapped(button: StringPickerPopover.ButtonParameterType?) {
let selectedRow = picker.selectedRow(inComponent: 0)
if let selectedValue = popover.choices[safe: selectedRow] {
button?.action?(popover, selectedRow, selectedValue)
}
popover.removeDimmedView()
dismiss(animated: false)
}
/// Action when tapping clear button
///
/// - Parameter sender: Clear button
@IBAction func tappedClear(_ sender: AnyObject? = nil) {
let kTargetRow = 0
picker.selectRow(kTargetRow, inComponent: 0, animated: true)
enableClearButtonIfNeeded()
if let selectedValue = popover.choices[safe: kTargetRow] {
popover.clearButton.action?(popover, kTargetRow, selectedValue)
}
popover.redoDisappearAutomatically()
}
/// Action to be executed after the popover disappears
///
/// - Parameter popoverPresentationController: UIPopoverPresentationController
func popoverPresentationControllerDidDismissPopover(_ popoverPresentationController: UIPopoverPresentationController) {
tappedCancel()
}
}
// MARK: - UIPickerViewDataSource
extension StringPickerPopoverViewController: UIPickerViewDataSource {
public func numberOfComponents(in pickerView: UIPickerView) -> Int {
return 1
}
public func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
return popover.choices.count
}
}
// MARK: - UIPickerViewDelegate
extension StringPickerPopoverViewController: UIPickerViewDelegate {
public func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
let value: String = popover.choices[row]
return popover.displayStringFor?(value) ?? value
}
public func pickerView(_ pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusing view: UIView?) -> UIView {
let value: String = popover.choices[row]
let adjustedValue: String = popover.displayStringFor?(value) ?? value
let label: UILabel = view as? UILabel ?? UILabel()
label.text = adjustedValue
label.attributedText = getAttributedText(image: popover.images?[row], text: adjustedValue)
label.textAlignment = .center
return label
}
private func getAttributedText(image: UIImage?, text: String?) -> NSAttributedString? {
let result: NSMutableAttributedString = NSMutableAttributedString()
if let attributedImage = getAttributedImage(image), let space = getAttributedText(" ") {
result.append(attributedImage)
result.append(space)
}
if let attributedText = getAttributedText(text) {
result.append(attributedText)
}
return result
}
private func getAttributedText(_ text: String?) -> NSAttributedString? {
guard let text = text else {
return nil
}
let font: UIFont = {
if let f = popover.font {
if let size = popover.fontSize {
return UIFont(name: f.fontName, size: size)!
}
return UIFont(name: f.fontName, size: f.pointSize)!
}
let size = popover.fontSize ?? popover.kDefaultFontSize
return UIFont.systemFont(ofSize: size)
}()
let color: UIColor = popover.fontColor
return NSAttributedString(string: text, attributes: [.font: font, .foregroundColor: color])
}
private func getAttributedImage(_ image: UIImage?) -> NSAttributedString? {
guard let image = image else {
return nil
}
let imageAttachment = NSTextAttachment()
imageAttachment.image = image
return NSAttributedString(attachment: imageAttachment)
}
public func pickerView(_ pickerView: UIPickerView, attributedTitleForRow row: Int, forComponent component: Int) -> NSAttributedString? {
let attributedResult = NSMutableAttributedString()
if let image = popover.images?[row] {
let imageAttachment = NSTextAttachment()
imageAttachment.image = image
let attributedImage = NSAttributedString(attachment: imageAttachment)
attributedResult.append(attributedImage)
let AttributedMargin = NSAttributedString(string: " ")
attributedResult.append(AttributedMargin)
}
let value: String = popover.choices[row]
let title: String = popover.displayStringFor?(value) ?? value
let font: UIFont = {
if let f = popover.font {
if let fontSize = popover.fontSize {
return UIFont(name: f.fontName, size: fontSize)!
}
return UIFont(name: f.fontName, size: f.pointSize)!
}
let fontSize = popover.fontSize ?? popover.kDefaultFontSize
return UIFont.systemFont(ofSize: fontSize)
}()
let attributedTitle: NSAttributedString = NSAttributedString(string: title, attributes: [.font: font, .foregroundColor: popover.fontColor])
attributedResult.append(attributedTitle)
return attributedResult
}
public func pickerView(_ pickerView: UIPickerView,
rowHeightForComponent component: Int) -> CGFloat {
return popover.rowHeight
}
public func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
enableClearButtonIfNeeded()
popover.valueChangeAction?(popover, row, popover.choices[row])
popover.redoDisappearAutomatically()
}
}
| [
324847
] |
f6dd25509ef7705c2f6b853e9b4b26ddd6a6ef15 | e51684a656bfb160aee4ee39df1d8c0d4f927da7 | /APIApp/AppDelegate.swift | 672e811c4e63d51af2019e61b7b720bcaafd0618 | [
"MIT"
] | permissive | imberezin/NewsAppWIthSwiftUI | c0c21b80874cf099d9281e597e729066fd9e7d5f | 0a7243769983ed9f5c8d337385c7dac5dfce5f11 | refs/heads/master | 2021-01-07T10:01:18.955012 | 2020-05-21T10:02:33 | 2020-05-21T10:02:33 | 241,657,318 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,419 | swift | //
// AppDelegate.swift
// APIApp
//
// Created by Israel Berezin on 2/18/20.
// Copyright © 2020 Israel Berezin. 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,
213048,
385081,
376889,
393275,
376905,
327756,
254030,
286800,
368727,
180313,
368735,
180320,
376931,
286831,
368752,
286844,
262283,
286879,
286888,
377012,
327871,
180416,
377036,
180431,
377046,
377060,
327914,
205036,
393456,
393460,
418043,
336123,
336128,
385280,
262404,
180490,
368911,
262416,
262422,
377117,
262436,
336180,
262454,
262472,
344403,
213332,
65880,
262496,
418144,
262499,
213352,
246123,
262507,
262510,
213372,
385419,
393612,
262550,
262552,
385440,
385443,
385451,
262573,
393647,
385458,
262586,
344511,
262592,
360916,
369118,
328177,
328179,
328182,
328189,
328192,
164361,
410128,
393747,
254490,
188958,
385570,
33316,
197159,
377383,
352821,
188987,
418363,
369223,
385609,
385616,
352856,
352864,
369253,
262760,
352874,
352887,
254587,
377472,
148105,
377484,
352918,
98968,
344744,
361129,
336555,
385713,
434867,
164534,
336567,
328378,
164538,
328386,
352968,
344776,
418507,
385742,
385748,
361179,
189153,
369381,
361195,
344831,
336643,
344835,
344841,
361230,
336659,
418580,
418585,
434970,
369435,
418589,
262942,
418593,
336675,
328484,
418598,
418605,
336696,
361273,
328515,
336708,
328519,
336711,
361288,
328522,
336714,
426841,
254812,
361309,
197468,
361315,
361322,
328573,
377729,
369542,
361360,
222128,
345035,
345043,
386003,
386011,
386018,
386022,
435187,
328714,
361489,
386069,
336921,
386073,
336925,
345118,
377887,
345133,
345138,
386101,
361536,
197707,
189520,
345169,
156761,
361567,
148578,
345199,
386167,
361593,
410745,
361598,
214149,
345222,
386186,
337047,
345246,
214175,
337071,
337075,
386258,
328924,
66782,
222437,
328941,
386285,
386291,
345376,
345379,
410917,
345382,
337205,
345399,
378169,
369978,
337222,
337229,
337234,
263508,
402791,
345448,
271730,
378227,
271745,
181638,
353673,
181643,
181654,
230809,
181670,
181673,
181678,
181681,
337329,
181684,
181690,
361917,
181696,
337349,
181703,
337365,
271839,
329191,
361960,
329194,
116210,
337398,
337415,
329226,
419339,
419343,
419349,
345625,
419355,
370205,
419359,
394786,
419362,
370213,
419368,
419376,
206395,
214593,
419400,
419402,
353867,
419406,
214610,
419410,
345701,
394853,
222830,
370297,
403070,
403075,
345736,
198280,
345749,
345757,
345762,
419491,
345765,
419497,
419501,
370350,
419506,
419509,
419512,
337592,
419517,
337599,
419527,
419530,
419535,
272081,
419542,
394966,
419544,
181977,
345818,
419547,
419550,
419559,
337642,
419563,
337645,
370415,
337659,
337668,
362247,
395021,
362255,
116509,
345887,
378663,
345905,
354106,
354111,
247617,
354117,
329544,
345930,
370509,
354130,
247637,
337750,
370519,
313180,
345964,
345967,
345970,
345974,
403320,
354172,
247691,
337808,
247700,
329623,
436126,
436132,
337833,
337844,
346057,
247759,
346063,
329697,
354277,
190439,
247789,
354313,
346139,
436289,
378954,
395339,
338004,
329832,
329855,
329867,
329885,
346272,
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,
248186,
420236,
379278,
354727,
338352,
330189,
338381,
338386,
338403,
338409,
248308,
199164,
330252,
420376,
330267,
354855,
10828,
199249,
346721,
174695,
248425,
191084,
338543,
191092,
346742,
330383,
354974,
150183,
248504,
223934,
355024,
273108,
355028,
264918,
183005,
256734,
436962,
338660,
338664,
264941,
207619,
338700,
256786,
199452,
363293,
396066,
346916,
396069,
215853,
355122,
355131,
355140,
355143,
338763,
355150,
330580,
355166,
265055,
265058,
355175,
387944,
355179,
330610,
330642,
355218,
412599,
207808,
379848,
396245,
330710,
248792,
248798,
347105,
257008,
183282,
265207,
330748,
265214,
330760,
330768,
248862,
396328,
158761,
199728,
396336,
330800,
396339,
339001,
388154,
388161,
347205,
248904,
330826,
248914,
183383,
339036,
412764,
257120,
265320,
248951,
420984,
330889,
248985,
339097,
44197,
380070,
339112,
249014,
126144,
330965,
265436,
388319,
388347,
175375,
159005,
175396,
208166,
273708,
372015,
347441,
372018,
199988,
175415,
396600,
437566,
175423,
437570,
437575,
437583,
331088,
437587,
331093,
396633,
175450,
437595,
175457,
208227,
175460,
175463,
437620,
175477,
249208,
175483,
175486,
249214,
175489,
249218,
249224,
249227,
249234,
175513,
175516,
396705,
175522,
355748,
380332,
396722,
388542,
372163,
216517,
380360,
216522,
339404,
372176,
208337,
339412,
413141,
339417,
249308,
339424,
249312,
339428,
339434,
249328,
69113,
372228,
208398,
380432,
175635,
339503,
265778,
265795,
396872,
265805,
224853,
224857,
257633,
224870,
372327,
257646,
372337,
224884,
224887,
224890,
224894,
224897,
372353,
216707,
126596,
224904,
11918,
159374,
224913,
126610,
339601,
224916,
224919,
126616,
224922,
208538,
224926,
224929,
224932,
224936,
257704,
224942,
257712,
224947,
257716,
257720,
257724,
224959,
257732,
224965,
224969,
339662,
224975,
257747,
224981,
224986,
257761,
224993,
257764,
224999,
339695,
225012,
257787,
225020,
339710,
257790,
225025,
257794,
339721,
257801,
257804,
225038,
257807,
225043,
372499,
167700,
225048,
257819,
225053,
184094,
225058,
339747,
339749,
257833,
225066,
257836,
413484,
225070,
225073,
372532,
397112,
225082,
397115,
225087,
323402,
257868,
225103,
257871,
397139,
225108,
225112,
257883,
257886,
225119,
339814,
225127,
257896,
274280,
257901,
225137,
257908,
225141,
257912,
225148,
257916,
257920,
225155,
339844,
225165,
397200,
225170,
380822,
225175,
225180,
118691,
184244,
372664,
372702,
372706,
356335,
380918,
405533,
430129,
266294,
421960,
356439,
421990,
266350,
356466,
266362,
381068,
225423,
250002,
250004,
225429,
356506,
225437,
135327,
225441,
438433,
225444,
438436,
225447,
438440,
225450,
258222,
225455,
430256,
225458,
225461,
225466,
389307,
225470,
381120,
372929,
430274,
225475,
389320,
225484,
225487,
225490,
266453,
225493,
225496,
225499,
225502,
225505,
356578,
225510,
225514,
225518,
372976,
381176,
397571,
389380,
356637,
356640,
356643,
356646,
266536,
356649,
356655,
332080,
340275,
356660,
397622,
332090,
225597,
332097,
201028,
348488,
332106,
332117,
348502,
250199,
250202,
332125,
250210,
348522,
348525,
348527,
332152,
389502,
250238,
356740,
332172,
373145,
340379,
389550,
324030,
266687,
340451,
160234,
127471,
340472,
324094,
266754,
324111,
340500,
332324,
381481,
356907,
324142,
356916,
324149,
324155,
348733,
324164,
356934,
348743,
381512,
324173,
324176,
389723,
332380,
373343,
381545,
340627,
184982,
373398,
258721,
332453,
332459,
389805,
332463,
381617,
332471,
332483,
332486,
373449,
332493,
357069,
357073,
332511,
332520,
340718,
332533,
348924,
389892,
373510,
389926,
152370,
340789,
348982,
398139,
127814,
357201,
357206,
389978,
430939,
357211,
357214,
201579,
201582,
349040,
340849,
201588,
430965,
381813,
324472,
398201,
119674,
340858,
324475,
430972,
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,
340957,
431072,
398306,
340963,
209895,
201711,
349172,
381946,
349180,
439294,
431106,
209943,
209946,
250914,
357410,
185380,
357418,
209965,
209968,
209971,
209975,
209979,
209987,
209990,
341071,
349267,
250967,
210010,
341091,
210025,
210027,
210030,
210036,
210039,
341113,
349308,
210044,
349311,
160895,
152703,
210052,
349319,
210055,
210067,
210071,
210077,
210080,
251044,
210084,
185511,
210088,
210095,
210098,
210107,
210115,
332997,
210127,
333009,
210131,
333014,
210138,
210143,
218354,
218360,
251128,
275706,
275712,
275715,
275721,
349459,
333078,
251160,
349484,
349491,
251189,
415033,
251210,
357708,
210260,
259421,
365921,
333154,
251235,
374117,
333162,
234866,
390516,
333175,
357755,
136590,
112020,
349590,
357792,
259515,
415166,
415185,
366034,
366038,
415191,
415193,
415196,
415199,
423392,
333284,
415207,
366056,
366061,
210420,
415224,
423423,
415257,
415263,
366117,
415270,
144939,
415278,
415281,
415285,
210487,
415290,
415293,
349761,
415300,
333386,
333399,
366172,
333413,
423528,
423532,
210544,
415353,
333439,
415361,
267909,
333498,
210631,
333511,
358099,
153302,
333534,
431851,
366318,
210672,
366321,
210695,
268041,
210698,
366348,
210706,
399128,
333594,
210719,
358191,
366387,
399159,
358200,
325440,
366401,
341829,
325446,
46920,
341834,
341838,
341843,
415573,
358234,
341851,
350045,
399199,
259938,
399206,
268143,
358255,
399215,
358259,
341876,
333689,
243579,
325504,
333698,
333708,
333724,
382890,
350146,
333774,
358371,
350189,
350193,
350202,
333818,
350206,
350213,
268298,
350224,
350231,
333850,
350237,
350240,
350244,
350248,
178218,
350251,
350256,
350259,
350271,
243781,
350285,
374864,
342111,
342133,
374902,
432271,
333997,
334011,
260289,
260298,
350410,
350416,
350422,
211160,
350425,
268507,
334045,
350445,
375026,
358644,
350458,
350461,
350464,
325891,
350467,
350475,
375053,
268559,
350480,
432405,
350486,
325914,
350490,
325917,
350493,
350498,
350504,
358700,
350509,
391468,
358704,
358713,
358716,
383306,
334161,
383321,
383330,
383333,
391530,
383341,
334203,
268668,
194941,
391563,
366990,
416157,
342430,
268701,
375208,
326058,
375216,
334262,
334275,
326084,
358856,
195039,
334304,
334311,
375277,
334321,
350723,
186897,
342545,
334358,
342550,
342554,
334363,
350761,
252461,
334384,
383536,
358961,
334394,
252482,
219718,
334407,
334420,
350822,
375400,
334465,
334468,
162445,
326290,
342679,
342683,
260766,
342710,
244409,
260797,
260801,
350917,
391894,
154328,
416473,
64230,
342766,
375535,
203506,
342776,
391937,
391948,
375568,
326416,
375571,
375574,
162591,
326441,
326451,
326454,
326460,
244540,
375612,
326467,
244551,
326473,
326477,
326485,
416597,
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,
326598,
359366,
359382,
359388,
383967,
343015,
359407,
261108,
244726,
261111,
383997,
261129,
359451,
261147,
211998,
261153,
261159,
359470,
359476,
343131,
384098,
384101,
384107,
367723,
187502,
384114,
343154,
212094,
351364,
384135,
384139,
384143,
351381,
384160,
384168,
367794,
384181,
367800,
384191,
351423,
326855,
244937,
253130,
343244,
146642,
359649,
343270,
351466,
351479,
343306,
261389,
359694,
384275,
245020,
245029,
171302,
351534,
376110,
245040,
425276,
384323,
212291,
343365,
212303,
367965,
343393,
343398,
367980,
425328,
343409,
253303,
154999,
343417,
327034,
245127,
384397,
245136,
245142,
245145,
343450,
245148,
245151,
245154,
245157,
245162,
327084,
359865,
384443,
146876,
327107,
384453,
327110,
327115,
327117,
359886,
359890,
343507,
368092,
343534,
343539,
368119,
343544,
368122,
409091,
359947,
359955,
359983,
343630,
327275,
245357,
138864,
155254,
155273,
368288,
425638,
155322,
425662,
155327,
155351,
155354,
212699,
155363,
245475,
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,
262005,
147317,
425845,
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,
327654,
204784,
393203,
393206,
253943,
360438,
393212,
155646
] |
302329117e4b962a7b669411a8d318f13c280f5c | eda296f3a1d0eb473162e7400d98326c2fabf23f | /Platforms/OSX/ModelIO/MDLVoxelArray.swift | b883ad9abc536f0483c3b502adb12725e9485921 | [] | no_license | johndpope/swift-3-api-guidelines-review | e1a7b52abc6813f7366805a86cc6540c655dfa3d | 64e3132a6a383b4a4603605180ded31efd37dcdc | refs/heads/swift-3 | 2021-01-21T17:29:41.045772 | 2016-02-29T22:10:20 | 2016-02-29T22:10:20 | 91,957,232 | 0 | 0 | null | 2017-05-21T12:58:26 | 2017-05-21T12:58:26 | null | UTF-8 | Swift | false | false | 1,973 | swift |
typealias MDLVoxelIndex = vector_int4
struct MDLVoxelIndexExtent {
var minimumExtent: MDLVoxelIndex
var maximumExtent: MDLVoxelIndex
init()
init(minimumExtent minimumExtent: MDLVoxelIndex, maximumExtent maximumExtent: MDLVoxelIndex)
}
@available(OSX 10.11, *)
class MDLVoxelArray : NSObject {
init(asset asset: MDLAsset, divisions divisions: Int32, interiorShells interiorShells: Int32, exteriorShells exteriorShells: Int32, patchRadius patchRadius: Float)
init(asset asset: MDLAsset, divisions divisions: Int32, interiorNBWidth interiorNBWidth: Float, exteriorNBWidth exteriorNBWidth: Float, patchRadius patchRadius: Float)
init(data voxelData: NSData, boundingBox boundingBox: MDLAxisAlignedBoundingBox, voxelExtent voxelExtent: Float)
func mesh(using allocator: MDLMeshBufferAllocator?) -> MDLMesh?
func voxelExists(atIndex index: MDLVoxelIndex, allowAnyX allowAnyX: Bool, allowAnyY allowAnyY: Bool, allowAnyZ allowAnyZ: Bool, allowAnyShell allowAnyShell: Bool) -> Bool
func setVoxelAtIndex(_ index: MDLVoxelIndex)
func setVoxelsFor(_ mesh: MDLMesh, divisions divisions: Int32, interiorShells interiorShells: Int32, exteriorShells exteriorShells: Int32, patchRadius patchRadius: Float)
func setVoxelsFor(_ mesh: MDLMesh, divisions divisions: Int32, interiorNBWidth interiorNBWidth: Float, exteriorNBWidth exteriorNBWidth: Float, patchRadius patchRadius: Float)
func voxels(within extent: MDLVoxelIndexExtent) -> NSData?
func voxelIndices() -> NSData?
func union(with voxels: MDLVoxelArray)
func difference(with voxels: MDLVoxelArray)
func intersect(with voxels: MDLVoxelArray)
func index(ofSpatialLocation location: vector_float3) -> MDLVoxelIndex
func spatialLocation(ofIndex index: MDLVoxelIndex) -> vector_float3
func voxelBoundingBox(atIndex index: MDLVoxelIndex) -> MDLAxisAlignedBoundingBox
var count: Int { get }
var voxelIndexExtent: MDLVoxelIndexExtent { get }
var boundingBox: MDLAxisAlignedBoundingBox { get }
}
| [
-1
] |
2b380b0a1a965b47fb686ab6a19f286f148106be | 13831d5becb25d12fc604272fae2012e17593ca1 | /Tweet/TweetCell.swift | 19d975ff863ec61b7a84436eab42934d5acf8d33 | [] | no_license | elainekmao/twitter-app | 40d2fc8eafbc001d41ff28714ec62b54666d2b2c | 532d6614ec77764fca40ccd2742e21187f134ead | refs/heads/master | 2020-12-24T16:05:59.432150 | 2015-05-05T09:10:30 | 2015-05-05T09:10:30 | 35,089,358 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,046 | swift | //
// TweetCell.swift
// Tweet
//
// Created by Elaine Mao on 5/4/15.
// Copyright (c) 2015 Elaine Mao. All rights reserved.
//
import UIKit
class TweetCell: UITableViewCell {
@IBOutlet weak var profileImageView: UIImageView!
@IBOutlet weak var nameLabel: UILabel!
@IBOutlet weak var usernameLabel: UILabel!
@IBOutlet weak var timestampLabel: UILabel!
@IBOutlet weak var tweetLabel: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
tweetLabel.preferredMaxLayoutWidth = tweetLabel.frame.size.width
profileImageView.layer.cornerRadius = 3
profileImageView.clipsToBounds = true
// Initialization code
}
override func layoutSubviews() {
super.layoutSubviews()
tweetLabel.preferredMaxLayoutWidth = tweetLabel.frame.size.width
}
override func setSelected(selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}
| [
-1
] |
f8ae820ab211be22774b57476eef51e2f809e17e | 097d1d5c982c54a788d5df39c39c6b23e5f13bf0 | /ios/Classes/Settings/Common/Selection/Views/SingleSelection/List/SingleSelectionListView.swift | 5bacec1ef2bf01dbbdf793429a4dfac64a80c6ac | [
"Apache-2.0"
] | permissive | perawallet/pera-wallet | d12435020ded4705b4a7929ab2611b29dd85810e | 115f85f2d897817276eca9090933f6b0c020f1ab | refs/heads/master | 2023-08-16T21:27:27.885005 | 2023-08-15T21:38:03 | 2023-08-15T21:38:03 | 364,359,642 | 67 | 26 | NOASSERTION | 2023-06-02T16:51:55 | 2021-05-04T19:08:11 | Swift | UTF-8 | Swift | false | false | 4,205 | swift | // Copyright 2022 Pera Wallet, LDA
// 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.
//
// SingleSelectionListView.swift
import UIKit
import MacaroonUIKit
final class SingleSelectionListView: View {
weak var delegate: SingleSelectionListViewDelegate?
private(set) lazy var collectionView: UICollectionView = {
let flowLayout = UICollectionViewFlowLayout()
flowLayout.minimumLineSpacing = theme.collectionViewMinimumLineSpacing
flowLayout.minimumInteritemSpacing = theme.collectionViewMinimumInteritemSpacing
let collectionView = UICollectionView(frame: .zero, collectionViewLayout: flowLayout)
collectionView.showsVerticalScrollIndicator = false
collectionView.showsHorizontalScrollIndicator = false
collectionView.backgroundColor = theme.backgroundColor.uiColor
collectionView.contentInset = UIEdgeInsets(theme.collectionViewEdgeInsets)
collectionView.register(SingleSelectionCell.self)
collectionView.register(header: SingleGrayTitleHeaderSuplementaryView.self)
return collectionView
}()
private lazy var theme = SingleSelectionListViewTheme()
private lazy var errorView = NoContentWithActionView()
private lazy var refreshControl = UIRefreshControl()
override init(frame: CGRect) {
super.init(frame: frame)
customize(theme)
linkInteractors()
}
func customize(_ theme: SingleSelectionListViewTheme) {
errorView.customize(NoContentWithActionViewCommonTheme())
errorView.bindData(ListErrorViewModel())
addCollectionView(theme)
}
func customizeAppearance(_ styleSheet: NoStyleSheet) {}
func prepareLayout(_ layoutSheet: NoLayoutSheet) {}
func linkInteractors() {
errorView.startObserving(event: .performPrimaryAction) {
[weak self] in
guard let self = self else {
return
}
self.delegate?.singleSelectionListViewDidTryAgain(self)
}
refreshControl.addTarget(self, action: #selector(didRefreshList), for: .valueChanged)
}
}
extension SingleSelectionListView {
private func addCollectionView(_ theme: SingleSelectionListViewTheme) {
addSubview(collectionView)
collectionView.snp.makeConstraints {
$0.edges.equalToSuperview()
}
}
}
extension SingleSelectionListView {
@objc
private func didRefreshList() {
delegate?.singleSelectionListViewDidRefreshList(self)
}
}
extension SingleSelectionListView {
func reloadData() {
collectionView.reloadData()
}
func setListDelegate(_ delegate: UICollectionViewDelegate?) {
collectionView.delegate = delegate
}
func setDataSource(_ dataSource: UICollectionViewDataSource?) {
collectionView.dataSource = dataSource
}
func endRefreshing() {
if refreshControl.isRefreshing {
refreshControl.endRefreshing()
}
}
func setErrorState() {
collectionView.contentState = .error(errorView)
}
func setNormalState() {
collectionView.contentState = .none
}
func setLoadingState() {
if !refreshControl.isRefreshing {
collectionView.contentState = .loading
}
}
func setRefreshControl() {
collectionView.refreshControl = refreshControl
}
}
protocol SingleSelectionListViewDelegate: AnyObject {
func singleSelectionListViewDidRefreshList(_ singleSelectionListView: SingleSelectionListView)
func singleSelectionListViewDidTryAgain(_ singleSelectionListView: SingleSelectionListView)
}
| [
-1
] |
0fea354f0ee7e1e47d9329942ba10f5b26784af9 | f0c8065e3d87e36aabe677c2464ad2e8cd504ea3 | /TransafeRx/TransafeRx/MobileCMS/CircularCollectionViewLayout.swift | 50c4767add3f0cdf208e6092c774366e3f4f2a43 | [] | no_license | andrew61/TransafeRx.iOS | 1ac26e959f49912de56ca56fb5161c704e46f41f | 45feb798d6544790a97073e01035b73c3a85b783 | refs/heads/master | 2020-06-05T19:51:14.870030 | 2019-06-20T12:54:32 | 2019-06-20T12:54:32 | 192,530,673 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,948 | swift | //
// CircularCollectionViewLayout.swift
// MobileCMS
//
// Created by Jonathan on 2/26/17.
// Copyright © 2017 Tachl. All rights reserved.
//
import Foundation
class CircularCollectionViewLayout: UICollectionViewLayout {
let itemSize = CGSize(width: 250, height: 320)
var angleAtExtreme: CGFloat {
return collectionView!.numberOfItems(inSection: 0) > 0 ?
-CGFloat(collectionView!.numberOfItems(inSection: 0) - 1) * anglePerItem : 0
}
var angle: CGFloat {
return angleAtExtreme * collectionView!.contentOffset.x / (collectionViewContentSize.width - collectionView!.bounds.width)
}
var radius: CGFloat = 500 {
didSet {
invalidateLayout()
}
}
var anglePerItem: CGFloat {
return atan(itemSize.width / radius)
}
var attributesList = [RoundedCollectionViewLayoutAttributes]()
override var collectionViewContentSize : CGSize {
return CGSize(width: CGFloat(collectionView!.numberOfItems(inSection: 0)) * itemSize.width,
height: collectionView!.bounds.height)
}
override class var layoutAttributesClass : AnyClass {
return RoundedCollectionViewLayoutAttributes.self
}
override func prepare() {
super.prepare()
let centerX = collectionView!.contentOffset.x + (collectionView!.bounds.width / 2.0)
let anchorPointY = ((itemSize.height / 2.0) + radius) / itemSize.height
//1
let theta = atan2(collectionView!.bounds.width / 2.0,
radius + (itemSize.height / 2.0) - (collectionView!.bounds.height / 2.0))
//2
var startIndex = 0
var endIndex = collectionView!.numberOfItems(inSection: 0) - 1
//3
if (angle < -theta) {
startIndex = Int(floor((-theta - angle) / anglePerItem))
}
//4
endIndex = min(endIndex, Int(ceil((theta - angle) / anglePerItem)))
//5
if (endIndex < startIndex) {
endIndex = 0
startIndex = 0
}
attributesList = (0..<collectionView!.numberOfItems(inSection: 0)).map { (i)
-> RoundedCollectionViewLayoutAttributes in
// 1
let attributes = RoundedCollectionViewLayoutAttributes(forCellWith: IndexPath(item: i,
section: 0))
attributes.size = self.itemSize
// 2
attributes.center = CGPoint(x: centerX, y: self.collectionView!.bounds.midY)
// 3
attributes.angle = self.angle + (self.anglePerItem * CGFloat(i))
attributes.anchorPoint = CGPoint(x: 0.5, y: anchorPointY)
return attributes
}
}
override func layoutAttributesForElements(in rect: CGRect) ->
[UICollectionViewLayoutAttributes]? {
return attributesList
}
override func layoutAttributesForItem(at indexPath: IndexPath)
-> UICollectionViewLayoutAttributes? {
return attributesList [(indexPath as NSIndexPath).row]
}
override func shouldInvalidateLayout(forBoundsChange newBounds: CGRect) -> Bool {
return true
}
}
class RoundedCollectionViewLayoutAttributes: UICollectionViewLayoutAttributes {
var anchorPoint = CGPoint(x: 0.5, y: 0.5)
var angle: CGFloat = 0 {
didSet {
//zIndex = Int(angle*1000000)
transform = CGAffineTransform(rotationAngle: angle)
}
}
override func copy(with zone: NSZone?) -> Any {
let copiedAttributes: RoundedCollectionViewLayoutAttributes = super.copy(with: zone) as! RoundedCollectionViewLayoutAttributes
copiedAttributes.anchorPoint = self.anchorPoint
copiedAttributes.angle = self.angle
return copiedAttributes
}
}
| [
-1
] |
a31dbf8e27930b5e1cf02205a82217ba00e6d5ac | 7b58ebe61ebfd6ad289575035f3e2244339ca7ff | /PlaygroundBook/Chapters/Chapter1.playgroundchapter/Pages/PlaygroundPage.playgroundpage/LiveView.swift | dc83f9db67301ae15d9515d3999d22e2298c7a28 | [] | no_license | NickAthn/Opportunity-Xcode | 1517f7122722182ae1a0eff986d23efc58145aa9 | 57a243350740ac3fb7fd07fa9e4a479bbb0780b2 | refs/heads/master | 2021-10-24T18:37:14.536732 | 2019-03-27T16:12:00 | 2019-03-27T16:12:00 | 177,811,334 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 399 | swift | //
// See LICENSE folder for this template’s licensing information.
//
// Abstract:
// Instantiates a live view and passes it to the PlaygroundSupport framework.
//
import UIKit
import PlaygroundSupport
// Instantiate a new instance of the live view from the book's auxiliary sources and pass it to PlaygroundSupport.
PlaygroundPage.current.liveView = instantiateLiveView(name: "TheLaunch")
| [
124801
] |
6fc70f7c670db3d999014b46495c6aa6e87d5f93 | ce9ea8737992b55c888638d2f054ecedaaa709a6 | /ShopApp_Gateway/Models/Policy.swift | fef63f66d6357c26f13817fdd2dbbd89ee87e160 | [
"Apache-2.0"
] | permissive | a-altheeb/shopapp-ios | 506711423221462239eaba262227be16924f39fc | 78a3c836eb412382b5466371b4c6451c97522551 | refs/heads/master | 2021-06-13T04:43:17.038247 | 2020-04-09T19:55:38 | 2020-04-09T19:55:38 | 254,425,528 | 0 | 0 | Apache-2.0 | 2020-04-09T16:36:10 | 2020-04-09T16:36:10 | null | UTF-8 | Swift | false | false | 309 | swift | //
// PolicyObject.swift
// ShopApp_Gateway
//
// Created by Evgeniy Antonov on 10/24/17.
// Copyright © 2017 Evgeniy Antonov. All rights reserved.
//
import Foundation
public class Policy {
public var title: String?
public var body: String?
public var url: String?
public init() {}
}
| [
-1
] |
b53ea4bbad919ad0b8d43c8f03714c6bfef728b7 | ca7b6d223fdc8e7c49d8356af41e4e89f985586d | /smore/Youtube/Model Classes/YTVideo.swift | 6483544a2a534650834ea4dd464d847694403707 | [] | no_license | s-more/Smore | 611ed7f7e38d7e47a3a152d716612f6393038864 | 4f98643f783d159a5caf1a68a781f8234f40e538 | refs/heads/master | 2020-04-19T01:07:07.393282 | 2019-04-26T00:07:04 | 2019-04-26T00:07:04 | 167,864,161 | 4 | 0 | null | 2019-04-26T00:07:05 | 2019-01-27T22:05:49 | Swift | UTF-8 | Swift | false | false | 1,275 | swift | //
// YTSong.swift
// smore
//
// Created by sin on 4/11/19.
// Copyright © 2019 Jing Wei Li. All rights reserved.
//
import Foundation
class YTVideo: Song {
var name: String
var genre: String = ""
var imageLink: URL?
var originalImageLink: String?
var id: String
var playableString: String
var artistName: String
var streamingService: StreamingService = .youtube
var trackNumber: Int = 0
var duration: TimeInterval = 1
init(resource: YTSearchResults.YTResource) {
name = resource.snippet.title
imageLink = resource.snippet.thumbnails.default.url
originalImageLink = resource.snippet.thumbnails.default.url.absoluteString
id = resource.id.videoId ?? ""
playableString = id
artistName = resource.snippet.channelTitle
}
init(songEntity: SongEntity) {
name = songEntity.name ?? ""
genre = songEntity.genre ?? ""
imageLink = songEntity.imageLink
originalImageLink = songEntity.originalImageLink
id = songEntity.id ?? ""
playableString = songEntity.playableString ?? ""
artistName = songEntity.artistName ?? ""
trackNumber = Int(songEntity.trackNumer)
duration = songEntity.duration
}
}
| [
-1
] |
df2f904826e5edab3a6643f2a70478d55033d1c8 | a162d8d4d2b2eaa308698ab67802cceb1f2077e6 | /page/page/RootViewController.swift | 1d5b50396e42374c115afea6a2fc4abb223155c7 | [] | no_license | yxw2014/swift2_template | e25c06474bcc65923d2cc7590e85c2fc4071fffd | f0015e42506f616558cec1c86c45bc8049021b5f | refs/heads/master | 2021-01-10T01:40:30.683104 | 2015-10-01T16:24:18 | 2015-10-01T16:24:18 | 43,503,977 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,872 | swift | //
// RootViewController.swift
// page
//
// Created by yexinwei on 15/10/2.
// Copyright © 2015年 yexinwei. All rights reserved.
//
import UIKit
class RootViewController: UIViewController, UIPageViewControllerDelegate {
var pageViewController: UIPageViewController?
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
// Configure the page view controller and add it as a child view controller.
self.pageViewController = UIPageViewController(transitionStyle: .PageCurl, navigationOrientation: .Horizontal, options: nil)
self.pageViewController!.delegate = self
let startingViewController: DataViewController = self.modelController.viewControllerAtIndex(0, storyboard: self.storyboard!)!
let viewControllers = [startingViewController]
self.pageViewController!.setViewControllers(viewControllers, direction: .Forward, animated: false, completion: {done in })
self.pageViewController!.dataSource = self.modelController
self.addChildViewController(self.pageViewController!)
self.view.addSubview(self.pageViewController!.view)
// Set the page view controller's bounds using an inset rect so that self's view is visible around the edges of the pages.
var pageViewRect = self.view.bounds
if UIDevice.currentDevice().userInterfaceIdiom == .Pad {
pageViewRect = CGRectInset(pageViewRect, 40.0, 40.0)
}
self.pageViewController!.view.frame = pageViewRect
self.pageViewController!.didMoveToParentViewController(self)
// Add the page view controller's gesture recognizers to the book view controller's view so that the gestures are started more easily.
self.view.gestureRecognizers = self.pageViewController!.gestureRecognizers
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
var modelController: ModelController {
// Return the model controller object, creating it if necessary.
// In more complex implementations, the model controller may be passed to the view controller.
if _modelController == nil {
_modelController = ModelController()
}
return _modelController!
}
var _modelController: ModelController? = nil
// MARK: - UIPageViewController delegate methods
func pageViewController(pageViewController: UIPageViewController, spineLocationForInterfaceOrientation orientation: UIInterfaceOrientation) -> UIPageViewControllerSpineLocation {
if (orientation == .Portrait) || (orientation == .PortraitUpsideDown) || (UIDevice.currentDevice().userInterfaceIdiom == .Phone) {
// In portrait orientation or on iPhone: Set the spine position to "min" and the page view controller's view controllers array to contain just one view controller. Setting the spine position to 'UIPageViewControllerSpineLocationMid' in landscape orientation sets the doubleSided property to true, so set it to false here.
let currentViewController = self.pageViewController!.viewControllers![0]
let viewControllers = [currentViewController]
self.pageViewController!.setViewControllers(viewControllers, direction: .Forward, animated: true, completion: {done in })
self.pageViewController!.doubleSided = false
return .Min
}
// In landscape orientation: Set set the spine location to "mid" and the page view controller's view controllers array to contain two view controllers. If the current page is even, set it to contain the current and next view controllers; if it is odd, set the array to contain the previous and current view controllers.
let currentViewController = self.pageViewController!.viewControllers![0] as! DataViewController
var viewControllers: [UIViewController]
let indexOfCurrentViewController = self.modelController.indexOfViewController(currentViewController)
if (indexOfCurrentViewController == 0) || (indexOfCurrentViewController % 2 == 0) {
let nextViewController = self.modelController.pageViewController(self.pageViewController!, viewControllerAfterViewController: currentViewController)
viewControllers = [currentViewController, nextViewController!]
} else {
let previousViewController = self.modelController.pageViewController(self.pageViewController!, viewControllerBeforeViewController: currentViewController)
viewControllers = [previousViewController!, currentViewController]
}
self.pageViewController!.setViewControllers(viewControllers, direction: .Forward, animated: true, completion: {done in })
return .Mid
}
}
| [
299110,
285490,
321843,
291602,
275509,
280344,
296794,
304349,
308735
] |
3c868b18e642c158d527a99b66e69f8a3590596e | 3e087b045f97e1711e6492afc8497b092e8abc47 | /TZSolvelt/TZSolvelt/ClassRoom/Model/StudyingClassModel.swift | 2859300fbaa6bef6cb66f630b3f27aa5ddc180ec | [] | no_license | zatratata/TZSolvelt | 0f21ec21782637a2e0aa7b7a45b5c2310dcfaf92 | 1fb66212ff7111092021c82396dc7e81234ba031 | refs/heads/main | 2023-04-21T17:54:58.019276 | 2021-05-03T07:40:34 | 2021-05-03T07:40:34 | 363,730,384 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 682 | swift | //
// StudyingClassModel.swift
// TZSolvelt
//
// Created by Default User on 5/2/21.
//
import Foundation
final class StudyingClassModel: Decodable {
let id: Int
let type: String
let name: String
private let updateAt: Int
private let status: String
enum State: String {
case inProgress = "inProgress"
case completed = "completed"
case notStarted = "notStarted"
}
//MARK: - Computed properties
var classStatus: StudyingClassModel.State? {
return StudyingClassModel.State(rawValue: status)
}
var lastUpdate: Date {
Date(timeIntervalSince1970: TimeInterval(updateAt))
}
}
| [
-1
] |
f44511333a139c2688299819206ca91e74488127 | f40687a8914743591cf33fec50086c6dfd854e74 | /Sources/Fuzzilli/Core/FuzzEngine.swift | 423c4efe2f377d6d9c6f5b1cd40b796caf747631 | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla"
] | permissive | compnerd/fuzzilli | bf7018ef0663b79180780c4ed2fc79e2d15125fa | 4d4d3fad7ab01f32e22959320233cdb2d7c6ebba | refs/heads/main | 2023-08-28T18:17:15.374579 | 2021-09-23T15:31:36 | 2021-09-23T15:31:36 | 407,906,777 | 0 | 0 | Apache-2.0 | 2021-09-18T16:08:42 | 2021-09-18T16:08:41 | null | UTF-8 | Swift | false | false | 4,059 | swift | // Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import Foundation
/// Number of instructions that should be generated in a program prefix
let programPrefixSize = 5
public protocol FuzzEngine: ComponentBase {
// Performs a single round of fuzzing using the engine.
func fuzzOne(_ group: DispatchGroup)
}
extension FuzzEngine {
public func execute(_ program: Program, stats: inout ProgramGeneratorStats) -> ExecutionOutcome {
fuzzer.dispatchEvent(fuzzer.events.ProgramGenerated, data: program)
let execution = fuzzer.execute(program)
switch execution.outcome {
case .crashed(let termsig):
fuzzer.processCrash(program, withSignal: termsig, withStderr: execution.stderr, origin: .local)
case .succeeded:
fuzzer.dispatchEvent(fuzzer.events.ValidProgramFound, data: program)
if let aspects = fuzzer.evaluator.evaluate(execution) {
if fuzzer.config.inspection.contains(.history) {
program.comments.add("Program is interesting due to \(aspects)", at: .footer)
}
fuzzer.processInteresting(program, havingAspects: aspects, origin: .local)
}
stats.producedValidSample()
case .failed(_):
if fuzzer.config.enableDiagnostics {
program.comments.add("Stdout:\n" + execution.stdout, at: .footer)
}
fuzzer.dispatchEvent(fuzzer.events.InvalidProgramFound, data: program)
stats.producedInvalidSample()
case .timedOut:
fuzzer.dispatchEvent(fuzzer.events.TimeOutFound, data: program)
stats.producedInvalidSample()
}
if fuzzer.config.enableDiagnostics {
// Ensure deterministic execution behaviour. This can for example help detect and debug REPRL issues.
ensureDeterministicExecutionOutcomeForDiagnostic(of: program)
}
return execution.outcome
}
/// Generate some basic Prefix such that samples have some basic types available.
public func generateProgramPrefix() -> Program {
let b = fuzzer.makeBuilder(mode: .conservative)
for _ in 1...programPrefixSize {
let generator = chooseUniform(from: fuzzer.trivialCodeGenerators)
b.run(generator)
}
let prefixProgram = b.finalize()
fuzzer.updateTypeInformation(for: prefixProgram)
return prefixProgram
}
private func ensureDeterministicExecutionOutcomeForDiagnostic(of program: Program) {
let execution1 = fuzzer.execute(program)
let stdout1 = execution1.stdout, stderr1 = execution1.stderr
let execution2 = fuzzer.execute(program)
switch (execution1.outcome, execution2.outcome) {
case (.succeeded, .failed(_)),
(.failed(_), .succeeded):
let stdout2 = execution2.stdout, stderr2 = execution2.stderr
logger.warning("""
Non-deterministic execution detected for program
\(fuzzer.lifter.lift(program))
// Stdout of first execution
\(stdout1)
// Stderr of first execution
\(stderr1)
// Stdout of second execution
\(stdout2)
// Stderr of second execution
\(stderr2)
""")
default:
break
}
}
}
| [
-1
] |
706ab70c1618ed5ead645e779e55cc5826e92ccb | 0045216f94a443d839a13fd76fd237c360e7a7d7 | /MemeTime/AppDelegate.swift | 8e089a774babc1fddd3c51e3033c4b9c9220e576 | [] | no_license | heavenlyboheme/MemeTime | b12df444af78ddbbb36c585e2c997eea0247c236 | 2e8be3978fdc356078513d50991b7ba699b79a3f | refs/heads/master | 2021-01-20T20:32:36.176475 | 2016-06-18T03:44:52 | 2016-06-18T03:44:52 | 61,408,727 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,229 | swift | //
// AppDelegate.swift
// MemeTime
//
// Created by Maria Kennedy on 6/16/16.
// Copyright © 2016 Happy Feat Media. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
func applicationDidEnterBackground(application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(application: UIApplication) {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
//BEGIN MEME EDITOR CODE
// END MEME EDITOR CODE
}
| [
229380,
229383,
229385,
278539,
229388,
294924,
278542,
229391,
327695,
278545,
229394,
278548,
229397,
229399,
229402,
278556,
229405,
352284,
278559,
229408,
278564,
294950,
229415,
229417,
237613,
229422,
229426,
237618,
229428,
286774,
204856,
229432,
286776,
319544,
286791,
237640,
278605,
286797,
311375,
237646,
163920,
196692,
319573,
311383,
278623,
278626,
319590,
311400,
278635,
303212,
278639,
131192,
237693,
327814,
131209,
417930,
303241,
311436,
303244,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
131264,
286916,
286922,
286924,
286926,
319694,
286928,
131281,
278743,
278747,
295133,
155872,
319716,
278760,
237807,
303345,
286962,
131314,
229622,
327930,
278781,
278783,
278785,
237826,
319751,
278792,
286987,
319757,
311569,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
287032,
155966,
278849,
319809,
319810,
319814,
311623,
319818,
311628,
229709,
287054,
319822,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
278980,
98756,
278983,
319945,
278986,
319947,
278990,
278994,
311767,
279003,
279006,
188895,
172512,
279010,
287202,
279015,
172520,
319978,
279020,
172526,
279023,
311791,
172529,
279027,
319989,
164343,
180727,
279035,
311804,
287230,
279040,
303617,
287234,
279045,
287238,
172550,
172552,
303623,
320007,
279051,
172558,
279055,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
279082,
311850,
279084,
172591,
172598,
279095,
172607,
172609,
172612,
377413,
172614,
172618,
303690,
33357,
287309,
279124,
172634,
262752,
172644,
311911,
189034,
295533,
189039,
189040,
352880,
295538,
172655,
189044,
287349,
172656,
172660,
287355,
287360,
295553,
287365,
311942,
295557,
303751,
352905,
279178,
287371,
311946,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
303773,
164509,
287390,
295583,
172702,
230045,
172705,
303780,
287394,
172707,
287398,
287400,
279208,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
279231,
287423,
328384,
287427,
312006,
107208,
107212,
172748,
287436,
172751,
287440,
295633,
303827,
172755,
279255,
172760,
279258,
287450,
213724,
303835,
189149,
303838,
279267,
312035,
295654,
279272,
230128,
312048,
312050,
230131,
205564,
303871,
230146,
295685,
230154,
33548,
312077,
295695,
295701,
369433,
230169,
295707,
328476,
295710,
230175,
303914,
279340,
205613,
279353,
230202,
312124,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
279390,
230241,
279394,
303976,
336744,
303985,
328563,
303987,
279413,
303991,
303997,
295806,
295808,
304005,
295813,
320391,
213895,
304007,
304009,
304011,
230284,
304013,
213902,
279438,
295822,
189329,
295825,
304019,
189331,
279445,
58262,
279452,
410526,
279461,
279462,
304042,
213931,
230327,
304055,
287675,
304063,
238528,
304065,
189378,
213954,
156612,
295873,
213963,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
312321,
295945,
197645,
230413,
295949,
320528,
140312,
295961,
238620,
197663,
304164,
189479,
304170,
238641,
312374,
238652,
238655,
230465,
238658,
296004,
336964,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
205931,
296044,
164973,
205934,
279661,
312432,
279669,
337018,
189562,
279679,
279683,
222340,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
165038,
238766,
230576,
304311,
230592,
279750,
230600,
230607,
148690,
320727,
279769,
304348,
279777,
304354,
296163,
320740,
279781,
304360,
279788,
320748,
279790,
304370,
296189,
320771,
312585,
296202,
296205,
230674,
320786,
230677,
296213,
296215,
320792,
230681,
214294,
304416,
230689,
173350,
312622,
296243,
312630,
222522,
222525,
296253,
296255,
312639,
230718,
296259,
378181,
238919,
296264,
320840,
230727,
296267,
296271,
222545,
230739,
312663,
222556,
337244,
230752,
312676,
230760,
173418,
410987,
230763,
230768,
296305,
312692,
230773,
279929,
181626,
304505,
304506,
181631,
312711,
296331,
288140,
230800,
288144,
304533,
337306,
288154,
288160,
173472,
288162,
288164,
279975,
304555,
370092,
279983,
288176,
279985,
173488,
312755,
296373,
279991,
312759,
288185,
337335,
222652,
312766,
173507,
296389,
222665,
230860,
280014,
312783,
288208,
230865,
288210,
370130,
288212,
280021,
288214,
222676,
239064,
288217,
288218,
280027,
288220,
329177,
239070,
288224,
288226,
370146,
280036,
288229,
280038,
288230,
288232,
280034,
288234,
320998,
288236,
288238,
288240,
288242,
296435,
288244,
288250,
148990,
296446,
402942,
206336,
296450,
321022,
230916,
230919,
214535,
370187,
304651,
304653,
230940,
222752,
108066,
296486,
296488,
157229,
230961,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
288344,
280152,
239194,
280158,
403039,
370272,
181854,
239202,
312938,
280183,
280185,
280188,
280191,
280194,
116354,
280208,
280211,
288408,
280218,
280222,
190118,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
280260,
280264,
206536,
206539,
206541,
206543,
280276,
313044,
321239,
280283,
288478,
313055,
321252,
313066,
280302,
288494,
280304,
313073,
419570,
288499,
288502,
280314,
288510,
124671,
67330,
280324,
280331,
198416,
280337,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
321316,
304932,
280363,
141101,
165678,
280375,
321336,
296767,
288576,
345921,
280388,
304968,
280393,
280402,
313176,
42842,
280419,
321381,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280464,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
280487,
313258,
321458,
296883,
124853,
214966,
296890,
10170,
288700,
296894,
280515,
190403,
296900,
337862,
165831,
280521,
231379,
296921,
239586,
313320,
231404,
124913,
165876,
321528,
313340,
288764,
239612,
239617,
313347,
288773,
313358,
305176,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
378941,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
280671,
223327,
149599,
149601,
149603,
321634,
329830,
280681,
313451,
223341,
280687,
313458,
280691,
215154,
313464,
321659,
280702,
288895,
321670,
215175,
141446,
141455,
141459,
280725,
313498,
288936,
100520,
280747,
288940,
280755,
288947,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
313548,
321740,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
157930,
280811,
280817,
280819,
157940,
182517,
125171,
280823,
280825,
280827,
280830,
280831,
280833,
280835,
125187,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
280888,
280891,
289087,
280897,
280900,
305480,
239944,
280906,
239947,
305485,
305489,
379218,
280919,
354653,
313700,
280937,
313705,
190832,
280946,
223606,
313720,
280956,
280959,
313731,
199051,
240011,
289166,
240017,
297363,
190868,
297365,
240021,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
305594,
289210,
281024,
289218,
289221,
289227,
281045,
281047,
215526,
166378,
305647,
281075,
174580,
281084,
240124,
305662,
305664,
240129,
305666,
240132,
223749,
305668,
281095,
223752,
150025,
338440,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
281135,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
281179,
199262,
338528,
338532,
281190,
199273,
281196,
158317,
19053,
313973,
281210,
297594,
158347,
133776,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
199364,
199367,
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,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
281567,
289762,
322534,
297961,
281581,
183277,
322550,
134142,
322563,
175134,
322599,
322610,
314421,
281654,
314427,
207937,
314433,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
289912,
248995,
306341,
306344,
306347,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
126190,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
257334,
216376,
298306,
281923,
380226,
224584,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
290171,
306555,
314747,
290174,
298365,
224641,
281987,
298372,
314756,
281990,
224647,
265604,
298377,
314763,
142733,
298381,
224657,
306581,
314779,
314785,
282025,
314793,
282027,
241068,
241070,
241072,
282034,
241077,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
290291,
282101,
241142,
191992,
290298,
151036,
290302,
282111,
290305,
175621,
192008,
323084,
257550,
282127,
290321,
282130,
323090,
282133,
290325,
241175,
290328,
282137,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
282186,
224849,
282195,
282199,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
282261,
298651,
323229,
282269,
298655,
323231,
61092,
282277,
306856,
282295,
282300,
323260,
323266,
282310,
323273,
282319,
306897,
241362,
282328,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
282410,
241450,
306988,
306991,
315184,
323376,
315190,
241464,
282425,
159545,
298811,
307009,
413506,
241475,
307012,
148946,
315211,
282446,
307027,
315221,
282454,
323414,
241496,
315223,
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,
282520,
241560,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
178273,
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,
299006,
282623,
315396,
241669,
315397,
282632,
282639,
290835,
282645,
241693,
282654,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
307278,
192596,
176213,
307287,
315482,
315483,
217179,
192605,
233567,
200801,
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,
184503,
307385,
307386,
258235,
176316,
307388,
307390,
299200,
184512,
307394,
307396,
299204,
184518,
307399,
323784,
307409,
307411,
176343,
299225,
233701,
307432,
184572,
282881,
184579,
282893,
291089,
282906,
291104,
233766,
176435,
307508,
315701,
307510,
332086,
151864,
307512,
168245,
307515,
282942,
307518,
151874,
282947,
282957,
323917,
110926,
233808,
323921,
315733,
323926,
233815,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299388,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
283033,
291226,
242075,
291231,
61855,
283042,
291238,
291241,
127403,
127405,
291247,
127407,
299440,
299444,
127413,
283062,
291254,
194660,
127417,
291260,
283069,
127421,
127424,
127429,
127431,
283080,
176592,
315856,
315860,
176597,
283095,
127447,
299481,
176605,
242143,
291299,
127463,
242152,
291305,
127466,
176620,
291314,
291317,
135672,
233979,
291323,
291330,
283142,
127497,
135689,
233994,
291341,
233998,
234003,
234006,
127511,
152087,
283161,
234010,
135707,
242202,
135710,
242206,
242208,
291361,
242220,
291378,
234038,
152118,
234041,
70213,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
291456,
135808,
299655,
373383,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
225948,
135839,
299680,
225954,
299684,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
225998,
299726,
226002,
226005,
119509,
226008,
242396,
299740,
201444,
299750,
283368,
234219,
283372,
226037,
283382,
234231,
316151,
234236,
226045,
234239,
242431,
209665,
234242,
242436,
234246,
226056,
234248,
291593,
242443,
234252,
242445,
234254,
291601,
234258,
242450,
242452,
234261,
348950,
234264,
201496,
234266,
283421,
234269,
234272,
234274,
152355,
234278,
299814,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
283452,
160572,
234302,
234307,
242499,
234309,
292433,
234313,
316233,
316235,
234316,
283468,
234319,
242511,
234321,
234324,
201557,
234329,
234333,
308063,
234336,
234338,
242530,
349027,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
226171,
291711,
234368,
234370,
291714,
291716,
234373,
226182,
234375,
226185,
308105,
234379,
234384,
234388,
234390,
226200,
234393,
209818,
324504,
234396,
324508,
234398,
291742,
308123,
234401,
291747,
291748,
234405,
291750,
234407,
324518,
324520,
234410,
291754,
226220,
324522,
234414,
324527,
291760,
234417,
201650,
324531,
291756,
226230,
234422,
275384,
324536,
234428,
291773,
226239,
234431,
242623,
234434,
324544,
324546,
226245,
234437,
234439,
324548,
234443,
291788,
193486,
275406,
193488,
234446,
234449,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234475,
234478,
316400,
234481,
316403,
234484,
234485,
234487,
324599,
234490,
234493,
234496,
316416,
234501,
275462,
308231,
234504,
234507,
234510,
234515,
300054,
234519,
316439,
234520,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
144430,
234543,
234546,
275508,
234549,
300085,
300088,
234553,
234556,
234558,
316479,
234561,
234563,
316483,
308291,
234568,
234570,
316491,
234572,
300108,
234574,
300115,
234580,
234581,
275545,
234585,
242777,
234590,
234593,
234595,
234597,
300133,
234601,
300139,
234605,
234607,
160879,
275569,
234610,
300148,
234614,
398455,
234618,
275579,
144506,
234620,
234623,
226433,
234627,
275588,
234629,
275594,
234634,
234636,
177293,
234640,
275602,
234643,
226453,
275606,
308373,
275608,
234647,
234648,
234650,
308379,
283805,
324757,
234653,
300189,
234657,
324766,
324768,
119967,
283813,
234661,
242852,
234664,
300197,
275626,
234667,
316596,
308414,
234687,
316610,
300226,
226500,
234692,
283844,
300229,
308420,
308418,
283850,
300234,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
161003,
300267,
300270,
300272,
120053,
300278,
275703,
316663,
300284,
275710,
300287,
283904,
292097,
300289,
300292,
300294,
275719,
300299,
177419,
283917,
242957,
275725,
177424,
300301,
349464,
283939,
259367,
283951,
292143,
300344,
226617,
283963,
243003,
226628,
283973,
300357,
177482,
283983,
316758,
357722,
316766,
218464,
316768,
292197,
316774,
243046,
218473,
284010,
136562,
324978,
275834,
333178,
275836,
275840,
316803,
316806,
226696,
316811,
226699,
316814,
226703,
300433,
234899,
226709,
357783,
316824,
316826,
144796,
300448,
144807,
144810,
284076,
144812,
144814,
284084,
144820,
284087,
292279,
144826,
144828,
144830,
144832,
284099,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
226787,
218597,
292329,
300523,
259565,
259567,
300527,
308720,
226802,
316917,
308727,
292343,
300537,
316947,
308757,
308762,
284191,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
284213,
194101,
284215,
194103,
284218,
226877,
284223,
284226,
243268,
284228,
226886,
284231,
128584,
292421,
284234,
366155,
276043,
317004,
284238,
226895,
284241,
194130,
284243,
276052,
276053,
284245,
284247,
300628,
235097,
243290,
284251,
284249,
284253,
300638,
284255,
317015,
243293,
284258,
292452,
292454,
284263,
177766,
284265,
292458,
284267,
292461,
284272,
284274,
276086,
292470,
284278,
292473,
284283,
276093,
284286,
276095,
292479,
284288,
276098,
325250,
284290,
292485,
284292,
292481,
284297,
317066,
284299,
317068,
276109,
284301,
284303,
276114,
284306,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
276137,
284329,
284331,
317098,
284333,
284335,
276144,
284337,
284339,
300726,
284343,
284346,
284350,
276160,
358080,
284354,
358083,
276166,
284358,
358089,
276170,
284362,
276175,
284368,
276177,
317138,
358098,
284370,
284372,
284377,
276187,
284379,
284381,
284384,
284386,
358116,
276197,
317158,
284392,
325353,
284394,
358122,
284397,
276206,
284399,
358128,
358126,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
284418,
317187,
358146,
317189,
317191,
284428,
300816,
300819,
317207,
284440,
186139,
300828,
300830,
276255,
300832,
284449,
300834,
325408,
227109,
317221,
358183,
186151,
276268,
300845,
194351,
243504,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
300872,
153417,
284499,
276308,
284502,
317271,
178006,
276315,
292700,
284511,
227175,
292715,
300912,
284529,
292721,
300915,
284533,
292729,
317306,
284540,
292734,
325512,
169868,
276365,
284564,
358292,
284566,
350106,
284572,
276386,
284579,
276388,
358312,
284585,
317353,
276395,
292776,
292784,
276402,
358326,
161718,
276410,
276411,
358330,
276418,
276425,
301009,
301011,
301013,
292823,
301015,
301017,
358360,
292828,
276446,
153568,
276448,
276452,
276455,
292839,
292843,
276460,
276464,
178161,
276466,
227314,
276472,
325624,
317435,
276476,
276479,
276482,
276485,
276490,
292876,
276496,
317456,
317458,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
276528,
243762,
309298,
325685,
325689,
276539,
235579,
235581,
325692,
178238,
276544,
284739,
292934,
276553,
243785,
350293,
350295,
194649,
227418,
309337,
194654,
227423,
350302,
194657,
227426,
276579,
309346,
309348,
227430,
276583,
350308,
309350,
276586,
309352,
350313,
350316,
276590,
301167,
227440,
350321,
284786,
276595,
301163,
350325,
350328,
292985,
301178,
292989,
301185,
317570,
350339,
292993,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
194708,
350357,
350359,
350362,
276638,
350366,
153765,
284837,
350375,
350379,
350381,
350383,
129200,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
301258,
309450,
276685,
276689,
227540,
309462,
301272,
276699,
309468,
194780,
309471,
301283,
317672,
276713,
317674,
325867,
243948,
194801,
227571,
309491,
309494,
243960,
227583,
276735,
227587,
276739,
211204,
276742,
227593,
227596,
325910,
309530,
342298,
276766,
211232,
317729,
276775,
211241,
325937,
276789,
325943,
211260,
260421,
276809,
285002,
276811,
235853,
276816,
235858,
276829,
276833,
391523,
276836,
276843,
293227,
276848,
293232,
186744,
211324,
227709,
285061,
317833,
178572,
285070,
178575,
285077,
178583,
227738,
317853,
276896,
317858,
342434,
285093,
285098,
276907,
235955,
276917,
293304,
293307,
293314,
309707,
293325,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
227810,
293346,
276964,
293352,
236013,
293364,
301562,
317951,
309764,
301575,
121352,
236043,
317963,
342541,
55822,
113167,
277011,
309779,
309781,
317971,
55837,
227877,
227879,
293417,
227882,
293421,
105007,
236082,
285236,
23094,
277054,
244288,
129603,
301636,
318020,
301639,
301643,
285265,
399955,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
277106,
121458,
170618,
170619,
309885,
309888,
277122,
227975,
285320,
277128,
301706,
334476,
326285,
318094,
318092,
277136,
277139,
227992,
285340,
318108,
227998,
318110,
137889,
383658,
285357,
318128,
277170,
342707,
154292,
277173,
293555,
318132,
285368,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
137946,
113378,
203491,
228069,
277223,
342760,
285417,
56041,
56043,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
228113,
285459,
277273,
293659,
326430,
228128,
285474,
293666,
228135,
318248,
277291,
293677,
318253,
285489,
293685,
285494,
301880,
285499,
301884,
293696,
310080,
277317,
277322,
277329,
162643,
310100,
301911,
301913,
277337,
301921,
400236,
236397,
162671,
326514,
310134,
277368,
236408,
15224,
416639,
416640,
113538,
310147,
416648,
39817,
187274,
277385,
301972,
424853,
277405,
277411,
310179,
293798,
293802,
236460,
277426,
293811,
293817,
293820,
203715,
326603,
293849,
293861,
228327,
228328,
228330,
318442,
228332,
277486,
326638,
318450,
293876,
293877,
285686,
302073,
285690,
244731,
121850,
302075,
293882,
293887,
277504,
277507,
277511,
277519,
293908,
277526,
293917,
293939,
318516,
277561,
277564,
7232,
310336,
293956,
277573,
228422,
310344,
277577,
293960,
277583,
203857,
293971,
310355,
310359,
236632,
277594,
138332,
277598,
285792,
203872,
277601,
310374,
203879,
277608,
310376,
228460,
318573,
203886,
187509,
285815,
285817,
367737,
285821,
302205,
285824,
392326,
285831,
253064,
302218,
285835,
294026,
384148,
162964,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
285862,
277671,
302248,
64682,
277678,
294063,
228526,
294065,
302258,
277687,
294072,
318651,
294076,
277695,
318657,
244930,
302275,
130244,
302277,
228550,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
302296,
384222,
310498,
285927,
318698,
302315,
195822,
228592,
294132,
138485,
228601,
204026,
228606,
204031,
64768,
310531,
285958,
228617,
138505,
318742,
204067,
277798,
130345,
277801,
113964,
285997,
277804,
277807,
285999,
113969,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
417086,
277822,
286016,
294211,
302403,
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,
310659,
294276,
351619,
327046,
277892,
253320,
277894,
318858,
310665,
277898,
277903,
310672,
351633,
277905,
277908,
277917,
310689,
277921,
130468,
228776,
277928,
277932,
310703,
277937,
130486,
310710,
310712,
277944,
310715,
277947,
302526,
228799,
277950,
277953,
64966,
245191,
163272,
302534,
310727,
277959,
292968,
302541,
277963,
302543,
277966,
310737,
277971,
286169,
228825,
163290,
277978,
310749,
277981,
277984,
310755,
277989,
277991,
187880,
277995,
286188,
310764,
278000,
228851,
310772,
278003,
278006,
212472,
40440,
278009,
286203,
40443,
228864,
286214,
228871,
302603,
302614,
286233,
302617,
302621,
286240,
146977,
187939,
294435,
40484,
286246,
294439,
286248,
278057,
294440,
294443,
40486,
294445,
40488,
40491,
310831,
212538,
40507,
40511,
40513,
228933,
40521,
286283,
40525,
40527,
228944,
400976,
212560,
40533,
147032,
40537,
278109,
40541,
40544,
40548,
40550,
286312,
286313,
40552,
40554,
310892,
40557,
40560,
188022,
122488,
294521,
343679,
278150,
310925,
286354,
278163,
302740,
122517,
278168,
327333,
229030,
212648,
278188,
302764,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
294601,
302793,
278227,
229076,
286420,
319187,
286425,
319194,
278235,
229086,
278238,
286432,
294625,
294634,
302838,
319226,
286460,
171774,
278274,
302852,
278277,
302854,
294664,
311048,
352008,
319243,
311053,
302862,
294682,
278306,
188199,
294701,
278320,
319280,
319290,
229192,
302925,
188247,
237409,
294776,
360317,
294785,
327554,
40840,
40851,
294803,
188312,
294811,
319390,
40865,
294817,
319394,
294821,
180142,
294831,
188340,
40886,
319419,
294844,
294847,
309354,
393177,
294876,
294879,
294883,
294890,
311279,
278513,
237555,
278516,
311283,
278519,
237562
] |
daf079dd0c8634022db5d3ade4b19088d255f647 | 6e7c94f27f3939c6ce08254d21604beb5e0f8ea2 | /RxSwift-Sample/ComicViewModel.swift | 1c1534c493280920579c76d28474e60e7594524b | [] | no_license | label8/RxSwift-MVVM | 750901c1c3934240cbb99b19606c9794dad0bb3a | c9f09558c7b13638a07ad7ece3fe8f2e90977d3e | refs/heads/master | 2020-03-25T13:51:00.143482 | 2018-08-07T08:48:52 | 2018-08-07T08:48:52 | 143,845,937 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,951 | swift | //
// ComicViewModel.swift
// RxSwift-Sample
//
// Created by 蜂谷庸正 on 2018/08/07.
// Copyright © 2018年 Tsunemasa Hachiya. All rights reserved.
//
import Foundation
import RxSwift
import RxCocoa
import RxAlamofire
class ComicViewModel {
var title: Variable<String>
var date: Variable<String>
var imageUrl: Variable<URL?>
var latestComicNum: Variable<Int?>
var currentComic: Variable<Comic?>
var isNextEnabled: Driver<Bool>
var isPreviousEnabled: Driver<Bool>
private var formatter = DateFormatter()
private var service = ComicService()
var disposeBag = DisposeBag()
init() {
title = Variable<String>("")
date = Variable<String>("")
imageUrl = Variable<URL?>(nil)
latestComicNum = Variable<Int?>(nil)
currentComic = Variable<Comic?>(nil)
formatter.dateStyle = .long
formatter.timeStyle = .none
isNextEnabled = Driver.combineLatest(self.latestComicNum.asDriver(), self.currentComic.asDriver(), resultSelector: { (latestNum, current) -> Bool in
guard let latestNum = latestNum, let currentNum = current?.num else { return false}
return latestNum != currentNum
}).distinctUntilChanged()
isPreviousEnabled = currentComic.asDriver().map({ (comic) -> Bool in
guard let num = comic?.num else { return false }
return num > 1
}).distinctUntilChanged()
}
func getLatestComic() {
service.getLatestComic().subscribe(onNext: { (comic) in
guard let comic = comic else { return }
self.latestComicNum.value = comic.num
self.updateViewModel(comic: comic)
}).disposed(by: disposeBag)
}
func getPreviousComic() {
guard let current = currentComic.value?.num, current > 0 else { return }
service.getComic(num: current - 1).subscribe(onNext: { (comic) in
guard let comic = comic else { return }
self.updateViewModel(comic: comic)
}).disposed(by: disposeBag)
}
func getNextComic() {
guard let current = currentComic.value?.num,
let latest = latestComicNum.value,
current < latest else { return }
service.getComic(num: current + 1).subscribe(onNext: { (comic) in
guard let comic = comic else { return }
self.updateViewModel(comic: comic)
}).disposed(by: disposeBag)
}
private func updateViewModel(comic: Comic) {
self.currentComic.value = comic
self.title.value = comic.title ?? ""
if let urlString = comic.img, let url = URL(string: urlString) {
self.imageUrl.value = url
}
if let date = comic.date {
self.date.value = formatter.string(from: date)
} else {
self.date.value = ""
}
}
}
| [
-1
] |
ebd580822d690828b9c18e4ff0931d1bdcb80986 | 913b991c973b74148e10e60b96fc09f0e4086ba6 | /SCKBase/SNKURLReponse.swift | 88949675c6b6bb6dc0e6eef8431836eea2258868 | [] | no_license | murphman300/SCKBase-iOS | fddf2fe37e3f5e90addd3d52e189e04d68211e69 | 232bd455d9d05bc07094676ec91f8aaa1a5ad339 | refs/heads/master | 2021-01-19T08:51:24.605891 | 2017-11-02T15:40:03 | 2017-11-02T15:40:03 | 87,688,372 | 0 | 0 | null | 2017-11-02T15:40:04 | 2017-04-09T06:35:02 | Swift | UTF-8 | Swift | false | false | 562 | swift | //
// SNKURLReponse.swift
// SCKBase
//
// Created by Jean-Louis Murphy on 2017-10-25.
// Copyright © 2017 Jean-Louis Murphy. All rights reserved.
//
import Foundation
public protocol SNKURLResponse : Decodable {
var resultCode : Double { get set }
var message : String { get set }
}
open class BadURLResponse : SNKURLResponse {
public var resultCode: Double
public var message: String
public init(code : Double, message: String) {
self.resultCode = code
self.message = message
}
}
| [
-1
] |
37fe29ae5c41a5e060dc2cfa033ad233a8c9789a | 2df0de7987a634853295d46be875aeedf6a45027 | /LearniatTeacher/LearniatTeacher/ClassView/TopicsView/QuestionsView.swift | 448498f6aa537df5f9cf56d17c63300209e77144 | [] | no_license | rashmimehrotra/Learniat-swift- | 0ff8bc4d0d815c5e38f58c9af3298be7728d1efb | 7ae0fe6820a518a4ef031a9385b2303b452ddf7c | refs/heads/master | 2021-03-19T17:24:59.804876 | 2017-09-15T10:38:45 | 2017-09-15T10:38:45 | 54,357,756 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 21,853 | swift | //
// QuestionsView.swift
// LearniatTeacher
//
// Created by Deepak MK on 25/04/16.
// Copyright © 2016 Mindshift. All rights reserved.
//
import Foundation
@objc protocol QuestionsViewDelegate
{
@objc optional func delegateQuestionSentWithQuestionDetails(_ questionDetails:AnyObject)
@objc optional func delegateQuestionBackButtonPressed(_ mainTopicId:String, withMainTopicName mainTopicName:String)
@objc optional func delegateDoneButtonPressed()
@objc optional func delegateScribbleQuestionWithSubtopicId(_ subTopicID:String)
@objc optional func delegateTopicsSizeChangedWithHeight(_ height:CGFloat)
@objc optional func delegateQuizmodePressedwithQuestions(_ questionArray:NSMutableArray)
@objc optional func delegateMtcQuestionWithSubtopicId(_ subTopicId:String)
@objc optional func delegateMRQQuestionWithSubtopicId(_ subTopicId:String)
}
class QuestionsView: UIView,QuestionCellDelegate,SSTeacherDataSourceDelegate,UIPopoverControllerDelegate
{
var _delgate: AnyObject!
var currentSessionDetails :AnyObject!
var mTopicsContainerView = UIScrollView()
var mActivityIndicator = UIActivityIndicatorView(activityIndicatorStyle:.gray)
var mSubTopicName = UILabel()
var currentSubTopicId = ""
var currentMainTopicID = ""
var currentMainTopicName = ""
var isCurrentSubtopicStarted :Bool = false
var currentMainTopicsViewHeight :CGFloat = 0
var questionButtonsView = UIView()
var questionsDetailsDictonary:Dictionary<String, NSMutableArray> = Dictionary()
var touchLocation :CGPoint!
func setdelegate(_ delegate:AnyObject)
{
_delgate = delegate;
}
func delegate()->AnyObject
{
return _delgate;
}
override init(frame: CGRect)
{
super.init(frame:frame)
let mTopbarImageView = UIImageView(frame: CGRect(x: 0, y: 0,width: self.frame.size.width, height: 44))
mTopbarImageView.backgroundColor = UIColor.white
self.addSubview(mTopbarImageView)
mTopbarImageView.isUserInteractionEnabled = true
mTopicsContainerView.frame = CGRect(x: 0, y: 44, width: self.frame.size.width, height: self.frame.size.height - 44)
mTopicsContainerView.backgroundColor = UIColor.white
self.addSubview(mTopicsContainerView)
mTopicsContainerView.isHidden = true
let seperatorView = UIView(frame: CGRect(x: 0 ,y: mTopbarImageView.frame.size.height - 1 , width: mTopbarImageView.frame.size.width,height: 1))
seperatorView.backgroundColor = LineGrayColor;
mTopbarImageView.addSubview(seperatorView)
let mDoneButton = UIButton(frame: CGRect(x: mTopbarImageView.frame.size.width - 210, y: 0, width: 200 ,height: mTopbarImageView.frame.size.height))
mTopbarImageView.addSubview(mDoneButton)
mDoneButton.addTarget(self, action: #selector(QuestionsView.onDoneButton), for: UIControlEvents.touchUpInside)
mDoneButton.setTitleColor(standard_Button, for: UIControlState())
mDoneButton.setTitle("Done", for: UIControlState())
mDoneButton.contentHorizontalAlignment = UIControlContentHorizontalAlignment.right
mDoneButton.titleLabel?.font = UIFont(name: helveticaMedium, size: 20)
let mBackButton = UIButton(frame: CGRect(x: 10, y: 0, width: 200 ,height: mTopbarImageView.frame.size.height))
mTopbarImageView.addSubview(mBackButton)
mBackButton.addTarget(self, action: #selector(QuestionsView.onBackButton), for: UIControlEvents.touchUpInside)
mBackButton.setTitleColor(standard_Button, for: UIControlState())
mBackButton.setTitle("Back", for: UIControlState())
mBackButton.contentHorizontalAlignment = UIControlContentHorizontalAlignment.left
mBackButton.titleLabel?.font = UIFont(name: helveticaMedium, size: 20)
mSubTopicName.frame = CGRect(x: (mTopbarImageView.frame.size.width - 400)/2, y: 0 , width: 400, height: mTopbarImageView.frame.size.height)
mSubTopicName.font = UIFont(name:helveticaMedium, size: 20)
mTopbarImageView.addSubview(mSubTopicName)
mSubTopicName.textColor = UIColor.black
mSubTopicName.text = "Questions"
mSubTopicName.textAlignment = .center
mSubTopicName.lineBreakMode = .byTruncatingMiddle
mActivityIndicator.frame = CGRect(x: 100, y: 0, width: mTopbarImageView.frame.size.height,height: mTopbarImageView.frame.size.height)
mTopbarImageView.addSubview(mActivityIndicator)
mActivityIndicator.hidesWhenStopped = true
mActivityIndicator.isHidden = true
questionButtonsView.frame = CGRect(x: 0, y: mTopicsContainerView.frame.size.height + mTopicsContainerView.frame.origin.y, width: mTopicsContainerView.frame.size.width, height: 44)
self.addSubview(questionButtonsView)
questionButtonsView.backgroundColor = UIColor.white
let seperatorView1 = UIView(frame: CGRect(x: 0 ,y: 0 , width: questionButtonsView.frame.size.width,height: 1))
seperatorView1.backgroundColor = LineGrayColor;
questionButtonsView.addSubview(seperatorView1)
let mScribbleButton = UIButton(frame: CGRect(x: 0, y: 0, width: questionButtonsView.frame.size.width ,height: mTopbarImageView.frame.size.height))
questionButtonsView.addSubview(mScribbleButton)
mScribbleButton.addTarget(self, action: #selector(QuestionsView.onScribbleButton), for: UIControlEvents.touchUpInside)
mScribbleButton.setTitleColor(standard_Button, for: UIControlState())
mScribbleButton.setTitle("Scribble", for: UIControlState())
mScribbleButton.contentHorizontalAlignment = UIControlContentHorizontalAlignment.center
mScribbleButton.titleLabel?.font = UIFont(name: helveticaMedium, size: 20)
// let mMatchColumn = UIButton(frame: CGRectMake(mScribbleButton.frame.origin.x + mScribbleButton.frame.size.width, 0, questionButtonsView.frame.size.width / 3 ,mTopbarImageView.frame.size.height))
// questionButtonsView.addSubview(mMatchColumn)
// mMatchColumn.addTarget(self, action: #selector(QuestionsView.onMTCButton), forControlEvents: UIControlEvents.TouchUpInside)
// mMatchColumn.setTitleColor(standard_Button, forState: .Normal)
// mMatchColumn.setTitle("MTC", forState: .Normal)
// mMatchColumn.contentHorizontalAlignment = UIControlContentHorizontalAlignment.Center
// mMatchColumn.titleLabel?.font = UIFont(name: helveticaMedium, size: 20)
let mMRQ = UIButton(frame: CGRect(x: mScribbleButton.frame.origin.x + mScribbleButton.frame.size.width , y: 0, width: questionButtonsView.frame.size.width / 2 ,height: mTopbarImageView.frame.size.height))
// questionButtonsView.addSubview(mMRQ)
mMRQ.addTarget(self, action: #selector(QuestionsView.onMRQButton), for: UIControlEvents.touchUpInside)
mMRQ.setTitleColor(standard_Button, for: UIControlState())
mMRQ.setTitle("MRQ", for: UIControlState())
mMRQ.contentHorizontalAlignment = UIControlContentHorizontalAlignment.center
mMRQ.titleLabel?.font = UIFont(name: helveticaMedium, size: 20)
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setSessionDetails(_ details:AnyObject)
{
currentSessionDetails = details
}
func setPreferredSize(_ size:CGSize, withSessionDetails details:AnyObject)
{
currentSessionDetails = details
}
func clearQuestionTopicId(_ subTopicId:String)
{
if (questionsDetailsDictonary[subTopicId] != nil)
{
questionsDetailsDictonary.removeValue(forKey: subTopicId)
}
}
func getQuestionsDetailsWithsubTopicId(_ subTopicId:String, withSubTopicName subTopicName:String, withMainTopicId mainTopicId:String, withMainTopicName mainTopicName:String, withSubtopicStarted isStarted:Bool)
{
let subViews = mTopicsContainerView.subviews.flatMap{ $0 as? QuestionCell }
for subview in subViews
{
if subview.isKind(of: QuestionCell.self)
{
subview.removeFromSuperview()
}
}
currentMainTopicID = mainTopicId
currentMainTopicName = mainTopicName
currentSubTopicId = subTopicId
isCurrentSubtopicStarted = isStarted
mSubTopicName.text = subTopicName
if let currentMainTopicDetails = questionsDetailsDictonary[currentSubTopicId]
{
if currentMainTopicDetails.count > 0
{
addTopicsWithDetailsArray(currentMainTopicDetails)
}
else
{
if let ClassId = currentSessionDetails.object(forKey: "ClassId") as? String
{
if let SubjectId = currentSessionDetails.object(forKey: "SubjectId") as? String
{
let subViews = mTopicsContainerView.subviews.flatMap{ $0 as? SubTopicCell }
for subview in subViews
{
if subview.isKind(of: SubTopicCell.self)
{
subview.removeFromSuperview()
}
}
mActivityIndicator.isHidden = false
mActivityIndicator.startAnimating()
SSTeacherDataSource.sharedDataSource.getAllNodesWithClassId(ClassId, withSubjectId: SubjectId, withTopicId: currentSubTopicId, withType: onlyQuestions, withDelegate: self)
}
}
}
}
else
{
if let ClassId = currentSessionDetails.object(forKey: "ClassId") as? String
{
if let SubjectId = currentSessionDetails.object(forKey: "SubjectId") as? String
{
let subViews = mTopicsContainerView.subviews.flatMap{ $0 as? SubTopicCell }
for subview in subViews
{
if subview.isKind(of: SubTopicCell.self)
{
subview.removeFromSuperview()
}
}
mActivityIndicator.isHidden = false
mActivityIndicator.startAnimating()
SSTeacherDataSource.sharedDataSource.getAllNodesWithClassId(ClassId, withSubjectId: SubjectId, withTopicId: currentSubTopicId, withType: onlyQuestions, withDelegate: self)
}
}
}
}
// MARK: - datasource delegate functions
func didGetAllNodesWithDetails(_ details: AnyObject) {
if let statusString = details.object(forKey: "Status") as? String
{
if statusString == kSuccessString
{
var mMaintopicsDetails = NSMutableArray()
if let classCheckingVariable = (details.object(forKey: "Questions")! as AnyObject).object(forKey: "Question") as? NSMutableArray
{
mMaintopicsDetails = classCheckingVariable
}
else
{
mMaintopicsDetails.add((details.object(forKey: "Questions")! as AnyObject).object(forKey: "Question")!)
}
questionsDetailsDictonary[currentSubTopicId] = mMaintopicsDetails
addTopicsWithDetailsArray(mMaintopicsDetails)
}
}
}
func addTopicsWithDetailsArray(_ mMaintopicsDetails:NSMutableArray)
{
if mMaintopicsDetails.count <= 0
{
mTopicsContainerView.isHidden = true
}
else
{
mTopicsContainerView.isHidden = false
}
var height :CGFloat = 44
var positionY :CGFloat = 0
for index in 0 ..< mMaintopicsDetails.count
{
let currentTopicDetails = mMaintopicsDetails.object(at: index)
print(currentTopicDetails)
let topicCell = QuestionCell(frame: CGRect(x: 0 , y: positionY, width: mTopicsContainerView.frame.size.width, height: 60))
topicCell.setdelegate(self)
topicCell.frame = CGRect(x: 0 , y: positionY, width: mTopicsContainerView.frame.size.width, height: topicCell.getCurrentCellHeightWithDetails(currentTopicDetails as AnyObject, WIthCountValue: index + 1))
if isCurrentSubtopicStarted == true
{
topicCell.mSendButton.isHidden = false
}
else
{
topicCell.mSendButton.isHidden = true
}
mTopicsContainerView.addSubview(topicCell)
height = height + (topicCell.frame.size.height*2)
positionY = positionY + topicCell.frame.size.height
}
if height > UIScreen.main.bounds.height - 100
{
height = UIScreen.main.bounds.height - 100
}
UIView.animate(withDuration: 0.5, animations:
{
self.frame = CGRect(x: self.frame.origin.x, y: self.frame.origin.y, width: 600, height: height)
})
currentMainTopicsViewHeight = height
mTopicsContainerView.frame = CGRect(x: 0, y: 44, width: mTopicsContainerView.frame.size.width, height: height - 88)
mTopicsContainerView.contentSize = CGSize(width: 0, height: positionY)
questionButtonsView.frame = CGRect(x: 0, y: mTopicsContainerView.frame.size.height + mTopicsContainerView.frame.origin.y, width: mTopicsContainerView.frame.size.width, height: 44)
mTopicsContainerView.scrollToTop()
mActivityIndicator.stopAnimating()
if delegate().responds(to: #selector(QuestionsViewDelegate.delegateTopicsSizeChangedWithHeight(_:)))
{
delegate().delegateTopicsSizeChangedWithHeight!(height)
}
}
func onDoneButton()
{
if delegate().responds(to: #selector(SubTopicsViewDelegate.delegateDoneButtonPressed))
{
delegate().delegateDoneButtonPressed!()
}
}
func onBackButton()
{
if delegate().responds(to: #selector(QuestionsViewDelegate.delegateQuestionBackButtonPressed(_:withMainTopicName:)))
{
delegate().delegateQuestionBackButtonPressed!(currentMainTopicID, withMainTopicName: currentMainTopicName)
}
}
func onScribbleButton()
{
if isCurrentSubtopicStarted == true
{
if delegate().responds(to: #selector(QuestionsViewDelegate.delegateScribbleQuestionWithSubtopicId(_:)))
{
delegate().delegateScribbleQuestionWithSubtopicId!(currentSubTopicId)
}
}
else
{
}
}
func onQuizmode()
{
if isCurrentSubtopicStarted == true
{
if let currentMainTopicDetails = questionsDetailsDictonary[currentSubTopicId]
{
if delegate().responds(to: #selector(QuestionsViewDelegate.delegateQuizmodePressedwithQuestions(_:)))
{
delegate().delegateQuizmodePressedwithQuestions!(currentMainTopicDetails)
}
}
}
}
func onMTCButton()
{
if isCurrentSubtopicStarted == true
{
if delegate().responds(to: #selector(QuestionsViewDelegate.delegateMtcQuestionWithSubtopicId(_:)))
{
delegate().delegateMtcQuestionWithSubtopicId!(currentSubTopicId)
}
}
}
func onMRQButton()
{
if isCurrentSubtopicStarted == true
{
if delegate().responds(to: #selector(QuestionsViewDelegate.delegateMRQQuestionWithSubtopicId(_:)))
{
delegate().delegateMRQQuestionWithSubtopicId!(currentSubTopicId)
}
}
}
// MARK: - Question delegate functions
func delegateSendQuestionDetails(_ questionDetails: AnyObject)
{
if delegate().responds(to: #selector(QuestionsViewDelegate.delegateQuestionSentWithQuestionDetails(_:)))
{
delegate().delegateQuestionSentWithQuestionDetails!(questionDetails)
}
}
func delegateOnInfoButtonWithDetails(_ questionDetails: AnyObject, withButton infoButton: UIButton) {
let buttonPosition :CGPoint = infoButton.convert(CGPoint.zero, to: self)
if let questionType = questionDetails.object(forKey: kQuestionType) as? String
{
if questionType == kOverlayScribble
{
let questionInfoController = ScribbleQuestionInfoScreen()
questionInfoController.setdelegate(self)
questionInfoController.setScribbleInfoDetails(questionDetails)
questionInfoController.preferredContentSize = CGSize(width: 400,height: 317)
let classViewPopOverController = UIPopoverController(contentViewController: questionInfoController)
questionInfoController.setPopover(classViewPopOverController)
classViewPopOverController.contentSize = CGSize(width: 400,height: 317);
classViewPopOverController.delegate = self;
classViewPopOverController.present(from: CGRect(
x:buttonPosition.x ,
y:buttonPosition.y + infoButton.frame.size.height / 2,
width: 1,
height: 1), in: self, permittedArrowDirections: .right, animated: true)
}
else if questionType == kMRQ || questionType == kMCQ || questionType == TextAuto
{
let questionInfoController = SingleResponceOption()
questionInfoController.setQuestionDetails(questionDetails)
questionInfoController.preferredContentSize = CGSize(width: 400,height: 317)
let classViewPopOverController = UIPopoverController(contentViewController: questionInfoController)
questionInfoController.setPopover(classViewPopOverController)
classViewPopOverController.contentSize = CGSize(width: 400,height: 317);
classViewPopOverController.delegate = self;
classViewPopOverController.present(from: CGRect(
x:buttonPosition.x ,
y:buttonPosition.y + infoButton.frame.size.height / 2,
width: 1,
height: 1), in: self, permittedArrowDirections: .right, animated: true)
}
else if questionType == kMatchColumn
{
let questionInfoController = MatchColumnOption()
questionInfoController.setdelegate(self)
questionInfoController.setQuestionDetails(questionDetails)
questionInfoController.preferredContentSize = CGSize(width: 400,height: 317)
let classViewPopOverController = UIPopoverController(contentViewController: questionInfoController)
questionInfoController.setPopover(classViewPopOverController)
classViewPopOverController.contentSize = CGSize(width: 400,height: 317);
classViewPopOverController.delegate = self;
classViewPopOverController.present(from: CGRect(
x:buttonPosition.x ,
y:buttonPosition.y + infoButton.frame.size.height / 2,
width: 1,
height: 1), in: self, permittedArrowDirections: .right, animated: true)
}
}
}
}
extension UIScrollView
{
func scrollToTop()
{
let desiredOffset = CGPoint(x: 0, y: -contentInset.top)
setContentOffset(desiredOffset, animated: true)
}
}
| [
-1
] |
9ceb31934d5b42e1a2bf63c7d09b6944b4e13739 | 03280c62007c9773a05e4784fb9038333c60c1bf | /Sources/Controllers/Stream/CalculatedCellHeights.swift | 61c34ab4509c565a870d6887109408f30547846c | [
"MIT"
] | permissive | turlodales/ello-ios | 7aaa5f65214a69465149a035bfe59f694ab3a5ef | 55cb128f2785b5896094d5171c65a40dc0304d5f | refs/heads/master | 2022-01-25T18:00:25.713444 | 2022-01-17T00:40:16 | 2022-01-17T00:40:16 | 230,545,872 | 0 | 0 | MIT | 2022-01-17T05:56:35 | 2019-12-28T02:11:07 | Swift | UTF-8 | Swift | false | false | 240 | swift | ////
/// CalculatedCellHeights.swift
//
typealias OnCalculatedCellHeightsMismatch = (CalculatedCellHeights) -> Void
struct CalculatedCellHeights {
var oneColumn: CGFloat?
var multiColumn: CGFloat?
var webContent: CGFloat?
}
| [
-1
] |
2c2524b290c110055e00ba9ed785b91e83628fe8 | 183e92522d1394c44862708d148805057a81e268 | /Marvel/Features/Character/View/TableViewCell/CharactersTableViewCell.swift | 0fcad535d13dbcdf4870d1a66ea2199836a5f82f | [] | no_license | yusuftogtay/Marvel-API-Samples | 1d16f3b67e8d41ed69901f9f08ddc1e264be7d0c | 3b9ee4c54e7302c3f978fecafb9e3ec8c181856c | refs/heads/main | 2023-06-11T19:21:41.875742 | 2021-07-13T09:50:44 | 2021-07-13T09:50:44 | 385,554,096 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 814 | swift | //
// CharactersTableViewCell.swift
// Marvel
//
// Created by Ahmet Yusuf TOĞTAY on 12.07.2021.
//
import UIKit
class CharactersTableViewCell: UITableViewCell {
override func awakeFromNib() {
super.awakeFromNib()
}
enum Identifier: String {
case custom = "characterCell"
}
@IBOutlet weak var customImageView: UIImageView!
@IBOutlet weak var nameLabel: UILabel!
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
}
func generateItem(item: Character) {
nameLabel?.text = item.name ?? ""
customImageView?.af.setImage(withURL: URL(string: (customImageView.imagePath(thumbnail: item.thumbnail!, size: ImageSizeConstant.PORTRAIT_FANTASTIC)))!)
}
}
| [
-1
] |
00532cb807081487d38ce0105a2d265c3c653714 | a9ecab855bdc6289a4a6fab3928725b46e4f3fc8 | /WonderOZ/WonderOZ/AppDelegate.swift | 1c937db6cf5c56615c6149c61ce3710924c5ddc4 | [] | no_license | JasonKZhuang/iOS_Projects | e2aad7dc37a09a0d674d8db83623247668b1d540 | 4f16964b6d7373085136afa2925bad22883d8c26 | refs/heads/master | 2020-03-22T19:05:26.389702 | 2018-07-26T10:25:39 | 2018-07-26T10:25:39 | 140,503,944 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,757 | swift | //
// AppDelegate.swift
// WonderOZ
//
// Created by Jason-Zhuang on 19/1/18.
// Copyright © 2018 iOSWorld. All rights reserved.
//
// ================================= Kaizhi Zhuang 25/1/18 =======================================//
// If you don't already have the CocoaPods tool, install it on macOS by running the following command from the terminal.
// #sudo gem install cocoapods
// Create a Podfile for the Google Maps SDK for iOS and use it to install the API and its dependencies
// Create a file named Podfile in your project directory. This file defines your project's dependencies.
// Edit the Podfile and add your dependencies. Here is an example which includes the dependencies you need for the Google Maps SDK for iOS and Places API for iOS (optional):
// *****************************************************//
// source 'https://github.com/CocoaPods/Specs.git' //
// target 'YOUR_APPLICATION_TARGET_NAME_HERE' do //
// pod 'GoogleMaps' //
// pod 'GooglePlaces' //
// end //
// *****************************************************//
// Open a terminal and go to the directory containing the Podfile:
// Run the pod install command.
// This will install the APIs specified in the Podfile, along with any dependencies they may have.
// #pod install
// Close Xcode, and then open (double-click) your project's .xcworkspace file to launch Xcode.
// From this time onwards, you must use the .xcworkspace file to open the project.
// error:
//The app's Info.plist must contain both NSLocationAlwaysAndWhenInUseUsageDescription and NSLocationWhenInUseUsageDescription keys with string values explaining to the user how the app uses this data
// Error: Failed to load optimized model - GoogleMaps SDK IOS
// If you have already double-checked the basic setup for the "google maps ios-sdk" with an APIkey for your app's bundle identifier here and still have the same problem
// then probably you have not enabled the google maps API. Go to your app-project's dashboard on https://console.developers.google.com and click the "ENABLE APIS AND SERVICES". There, under the MAPS section select "the Google maps sdk for ios" and enable it.
import UIKit
import GoogleMaps
import GooglePlaces
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate
{
var window: UIWindow?
static let myGoogleMapKey:String = "AIzaSyBP7COU_obgA6MWVBIl5z6MSxhM2ochPTw"
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool
{
// Override point for customization after application launch.
var _: AdventureDB = AdventureDB.dbInstance
//Google Place
GMSPlacesClient.provideAPIKey(AppDelegate.myGoogleMapKey)
//google map
GMSServices.provideAPIKey(AppDelegate.myGoogleMapKey)
print("The WonderOZ app has been started!")
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:.
}
}
| [
-1
] |
59bb575f408940ac4a60379de3f6c8b504f97724 | 5662bd2155318dc0b901e97ca3b179f902fa1452 | /Stampede/Stampede/Common/Route.swift | 550c079663588e591104439ac1c528c0213f1e44 | [
"MIT"
] | permissive | levous/stampede-app | 793d1f74cf5cee6efa86efea7199d58cf167ed7c | f85a26adf3c320a8bf4ea6799e65022bad4bc387 | refs/heads/main | 2023-06-17T00:16:29.411227 | 2021-02-28T19:55:52 | 2021-02-28T19:55:52 | 386,008,945 | 0 | 0 | MIT | 2021-07-14T16:41:20 | 2021-07-14T16:41:20 | null | UTF-8 | Swift | false | false | 310 | swift | //
// Route.swift
// Stampede
//
// Created by David House on 10/11/20.
// Copyright © 2020 David House. All rights reserved.
//
import Foundation
import UIKit
enum RouteMethod {
case push
case present
}
protocol Route {
func makeFeature(_ dependencies: Dependencies) -> UIViewController
}
| [
-1
] |
7774ffd0da6de57c699932536c618890fdf8665e | 282bec3a91747d4175f317fed5bf4d151d77e431 | /Examples/Example/Kit/Table/Director/TableDirector+Rx.swift | 4e7e7542eb8d0afa7a5a9d33c0e38af2327b1ce2 | [
"MIT"
] | permissive | MasterWatcher/RxDataSources | f7f6df98fdb1d797ba440c00dc503afae66992d6 | 71a0839dc0bbdd33fe6c198f44d0f5f0ef071fb5 | refs/heads/master | 2020-12-04T14:35:54.158663 | 2020-01-10T11:48:33 | 2020-01-10T11:48:33 | 231,802,606 | 2 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,196 | swift | //
// TableDirector+Rx.swift
// Example
//
// Created by Goncharov Anton on 05/01/2020.
// Copyright © 2020 kzaher. All rights reserved.
//
import UIKit
import RxSwift
extension Reactive where Base: TableDirector {
func cellCreated<T: DisposableCell,
U,
O: ObservableType>
(_ cellType: T.Type, closure: @escaping (T) -> O) -> Observable<U>
where O.E == U {
return base.cellConfigured
.map { $0.cell }
.filterCast(T.self)
.flatMapAndDisposeInCell(closure)
}
func cellCreated<T: ConfigurableCell,
U,
O: ObservableType>(_ cellType: T.Type, closure: @escaping (T, T.ViewModel) -> O) -> Observable<U>
where O.E == U {
return base.cellConfigured
.filterCast(T.self)
.flatMapAndDisposeInCell { closure($0.cell, $0.item) }
}
func cellSizeChanged<T: DisposableCell & SizeChangeableCell>(_ cellType: T.Type) -> Observable<IndexPath> {
return base.cellConfigured
.flatMap { data -> Observable<IndexPath> in
Observable.just(data.cell)
.filterCast(T.self)
.flatMapAndDisposeInCell { $0.didChangeSize }
.map { data.indexPath }
}
}
func nestedCellCreated<T: DisposableCell,
U,
O: ObservableType>
(_ cellType: T.Type, closure: @escaping (T) -> O) -> Observable<U>
where O.E == U {
base.collectionDirector.rx.cellCreated(T.self, closure: closure)
}
func nestedCellCreated<T: ConfigurableCell,
U,
O: ObservableType>
(_ cellType: T.Type, closure: @escaping (T, T.ViewModel) -> O) -> Observable<U>
where O.E == U {
base.collectionDirector.rx.cellCreated(T.self, closure: closure)
}
func nestedViewModelSelected<T, C: CollectionContainableCell>(_ modelType: T.Type, in cellType: C.Type) -> Observable<T> {
return base.cellConfigured
.map { $0.cell }
.filterCast(C.self)
.flatMapAndDisposeInCell { $0.collectionView.rx.viewModelSelected(T.self) }
}
}
| [
-1
] |
03b88866f5d19399440e010affa30ffc13e268b7 | 9195bc208db46177b38f43e51b369436d58a5947 | /EditorExtension/Extension/XCSourceTextBuffer+SwiftFormat.swift | 3e630b2e20e42c47f57b05bfd228358a330ae2f7 | [
"MIT"
] | permissive | nicklockwood/SwiftFormat | 7586152dd6dd3173ee5715b68ca5a5e467e27670 | 1c1bf3b72a020cabe39ce7cd31fc47a3fdc90b44 | refs/heads/main | 2023-09-03T04:05:28.514479 | 2023-09-02T08:14:14 | 2023-09-02T08:14:14 | 66,302,557 | 7,228 | 748 | MIT | 2023-09-01T18:13:39 | 2016-08-22T19:39:05 | Swift | UTF-8 | Swift | false | false | 1,231 | swift | //
// XCSourceTextBuffer+SwiftFormat.swift
// SwiftFormat
//
// Created by Nick Lockwood on 21/10/2016.
// Copyright © 2016 Nick Lockwood. All rights reserved.
//
import Foundation
import XcodeKit
extension XCSourceTextPosition {
init(_ offset: SourceOffset) {
self.init(line: offset.line - 1, column: offset.column - 1)
}
}
extension SourceOffset {
init(_ position: XCSourceTextPosition) {
line = position.line + 1
column = position.column + 1
}
}
extension XCSourceTextBuffer {
/// Calculates the indentation string representation for a given source text buffer
var indentationString: String {
if usesTabsForIndentation {
let tabCount = indentationWidth / tabWidth
if tabCount * tabWidth == indentationWidth {
return String(repeating: "\t", count: tabCount)
}
}
return String(repeating: " ", count: indentationWidth)
}
func newPosition(for position: XCSourceTextPosition,
in tokens: [Token]) -> XCSourceTextPosition
{
let offset = newOffset(for: SourceOffset(position), in: tokens, tabWidth: tabWidth)
return XCSourceTextPosition(offset)
}
}
| [
-1
] |
fc001a29cee85944bc4fbeba1e62e3dbf8033f4f | 8db78ae88e626c35fe3374e4d77f971fb81c2a15 | /DummySchProject/Views/SignUp/SignUpViewController.swift | 749ff01c358e6dffb3cd7400fe574ae1cb51bc2a | [] | no_license | Abdullah8888/DummySchProject | b2d9ab6ee1cfa8d4fa3ac3d6423cc54284c556cf | a4dd9924026e196e1feda438cb477a04cdeba024 | refs/heads/main | 2023-05-29T02:41:40.488203 | 2021-06-14T20:38:36 | 2021-06-14T20:38:36 | 375,848,294 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 298 | swift | //
// SignUpViewController.swift
// DummySchProject
//
// Created by babatundejimoh on 13/06/2021.
//
import UIKit
class SignUpViewController: BaseViewController {
override func viewDidLoad() {
super.viewDidLoad()
self.setupNavigationBar(style: .ViewHasNoNavbar)
}
}
| [
-1
] |
a2e80f5387888198ff3227b9c499d7367fff73f2 | 4be0af6ebb2682d87331ada1d0bd60059684592a | /OpenMarket/OpenMarket/JsonData/ItemAfterDelete.swift | f217ecfae960afd40e4629c48d8baf8aba3231d8 | [] | no_license | hcooch2ch3/ios-open-market | 4cfc478622a497f36667aad509f65c069cf61dbb | 30e04786f5b3274b929bf04ae03c0010d9d0b17a | refs/heads/main | 2023-07-16T21:11:14.952172 | 2021-09-02T06:02:14 | 2021-09-02T06:02:14 | 372,765,565 | 1 | 0 | null | 2021-09-02T06:02:15 | 2021-06-01T09:00:09 | null | UTF-8 | Swift | false | false | 164 | swift | //
// ItemAfterDelete.swift
// OpenMarket
//
// Created by 임성민 on 2021/01/26.
//
import Foundation
struct ItemAfterDelete: Decodable {
let id: Int
}
| [
-1
] |
0441d7f95110bcfbdeabf3e356bf53b0b6a8dee0 | 66c6dafdd2326acc0fd8d19bffdf8bf5bcd6cc21 | /CharacterViewer/Controllers/MasterTableViewController.swift | 85c8b5d5b3aa7b383840e27735936f69ce84a8a1 | [] | no_license | ayeberel/Characters | 1400b34cd1a7e464965a3ccd2452646958c0eecc | f9e27b26ef41d8ec9af872af098ce934948ffb33 | refs/heads/master | 2023-04-24T01:04:52.384224 | 2021-05-09T17:13:31 | 2021-05-09T17:13:31 | 365,807,005 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,018 | swift | // Created by ayu on 05/08/21.
import UIKit
class MasterListViewController: UITableViewController {
private var detailNavigationVCIdentifier = "DetailNavVCIdentifier"
var viewModel: CharacterViewModelable!
override func viewDidLoad() {
super.viewDidLoad()
#if SIMPSONS
viewModel = SimpsonsListViewModel()
#else
viewModel = WiresListViewModel()
#endif
viewModel.fetchData()
viewModel.onCompletion = {
DispatchQueue.main.async {
self.tableView.reloadData()
}
}
}
// MARK: - Table view data source
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// #warning Incomplete implementation, return the number of rows
return viewModel.numberOfCharacters()
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
cell.textLabel?.text = viewModel.getTitle(at: indexPath.row)
return cell
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
#if SIMPSONS
let row = viewModel.getCharacters(at: indexPath.row) as? SimpsonsViewModel
#else
let row = viewModel.getCharacters(at: indexPath.row) as? WiresViewModel
#endif
let viewController = storyboard?.instantiateViewController(identifier: detailNavigationVCIdentifier)
guard
let navigationViewController = viewController as? UINavigationController,
let detailViewController = navigationViewController.viewControllers.first as? DetailViewController
else { return }
detailViewController.viewModel = row
//detailViewController.configure(with: viewModel.getProduct(for: indexPath))
showDetailViewController(navigationViewController, sender: self)
}
}
| [
-1
] |
1cdef5de62bebffd626ab32d09f3acb568a5ef1a | e7d1532dfb91a4948d1364438bc6a5f8adf79b92 | /iList Ambassador/ProfileViewController.swift | ce11117912f87c59ff38a5c0cdc8944d841fe153 | [] | no_license | dreamanimators25/merged-CB | fb464569324c332f7f4d66d69c13584f216b0a25 | abfc1beaef9036d3116b3ecb7dca1636248ac7fb | refs/heads/master | 2022-12-21T10:17:31.868620 | 2020-09-19T13:42:05 | 2020-09-19T13:42:05 | 290,741,302 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 12,870 | swift | //
// ProfileViewController.swift
// iList Ambassador
//
// Created by Pontus Andersson on 06/03/16.
// Copyright © 2016 iList AB. All rights reserved.
//
import UIKit
import FontAwesomeKit
import Crashlytics
class ProfileViewController: BaseViewController, AmbassadorshipsCollectionViewControllerDelegate, ProfilePictureImageViewDelegate, UINavigationControllerDelegate, UIImagePickerControllerDelegate {
// MARK: Views
@IBOutlet weak var nameLabel: ShadowLabel!
@IBOutlet weak var profilePictureImageView: ProfilePictureImageView!
@IBOutlet weak var profilePictureAddIndicator: UIImageView!
@IBOutlet weak var backgroundImageView: BackgroundImageView!
@IBOutlet weak var inboxButton: InfoButton!
@IBOutlet weak var connectionsButton: InfoButton!
@IBOutlet weak var activityButton: InfoButton!
@IBOutlet weak var sendContentButton: InfoButton!
@IBOutlet weak var connectButton: InfoButton!
var ambassadorshipsCollectionViewController: AmbassadorshipsCollectionViewController?
// MARK: Data
var user: User?
var userConnections: [Connection]?
var deleteIsActive = false
var tap: UITapGestureRecognizer!
// MARK: Managers
var profileContentTransitionManager: ProfileContentTransitionManager?
let imagePicker = UIImagePickerController()
// MARK: - View life cycle
override func viewDidLoad() {
super.viewDidLoad()
imagePicker.delegate = self
imagePicker.allowsEditing = false
imagePicker.sourceType = .photoLibrary
automaticallyAdjustsScrollViewInsets = false
profilePictureImageView.delegate = self
backgroundImageView.overlayViewAlpha = 0.6
// Hide all before loading
inboxButton.isHidden = true
activityButton.isHidden = true
connectionsButton.isHidden = true
sendContentButton.isHidden = true
connectButton.isHidden = true
tap = UITapGestureRecognizer(target: self, action: #selector(screenTapped(_:)))
tap.isEnabled = false
self.view.addGestureRecognizer(tap)
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
updateUserInfo()
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
hidedeletion()
}
override var prefersStatusBarHidden : Bool {
return false
}
@objc func screenTapped(_ sender: UITapGestureRecognizer) {
hidedeletion()
}
// MARK: - User
fileprivate func updateUserInfo() {
if user == nil {
user = UserManager.sharedInstance.user
}
guard let user = self.user else {
print("No user found in profile")
return
}
if user.isCurrentUser {
navigationItem.leftBarButtonItem = UIBarButtonItem(image: UIImage(named: "settings"), style: .plain, target: self, action: #selector(settingsButtonTapped(_:)))
} else {
navigationItem.leftBarButtonItem = UIBarButtonItem(image: UIImage(named: "close_small"), style: .plain, target: self, action: #selector(closeButtonTapped(_:)))
}
updateConnectionsForUser(user)
profilePictureImageView.setImageForUser(user)
backgroundImageView.setBackgroundForUser(user)
nameLabel.text = user.fullName
profilePictureImageView.allowSelection = user.isCurrentUser
profilePictureAddIndicator.isHidden = !(user.isCurrentUser && !user.hasProfilePicture)
ambassadorshipsCollectionViewController?.user = user
inboxButton.isHidden = !user.isCurrentUser
activityButton.isHidden = !user.isCurrentUser
connectionsButton.isHidden = !user.isCurrentUser
if user.isCurrentUser {
sendContentButton.isHidden = true
connectButton.isHidden = true
} else {
var isConnectedToUser = false
//var connectionRequestSentToUser = false
if let userConnections = UserManager.sharedInstance.connections {
isConnectedToUser = userConnections.filter({ $0.user.id == user.id }).count > 0
}
if let _ = UserManager.sharedInstance.connectionRequests {
// connectionRequestSentToUser = userConnectionRequests.filter({ $0.user.id == user.id }).count > 0
}
//sendContentButton.hidden = !isConnectedToUser
sendContentButton.isHidden = true
connectButton.isHidden = isConnectedToUser
// TODO: use connectionRequestSentToUser to set connectButton to highlighted if request has been sent
}
}
// MARK: - Connections
fileprivate func updateConnectionsForUser(_ user: User) {
UserManager.sharedInstance.getConnectionsForUser(user) { (connections, error) in
if let connections = connections {
self.userConnections = connections
} else if let error = error {
Crashlytics.sharedInstance().recordError(error)
}
}
}
fileprivate func alertConnectionRequestSent() {
let alertController = UIAlertController(title: NSLocalizedString("CONNECTION_REQUEST_SENT", comment: ""), message: nil, preferredStyle: UIAlertController.Style.alert)
alertController.addAction(UIAlertAction(title: NSLocalizedString("OK", comment: ""), style: UIAlertAction.Style.cancel, handler: { (alertAction: UIAlertAction) in
alertController.dismiss(animated: true, completion: nil)
}))
present(alertController, animated: true, completion: nil)
}
fileprivate func alertConnectionRequestAlreadySent() {
let alertController = UIAlertController(title: NSLocalizedString("CONNECTION_REQUEST_ALREADY_SENT", comment: ""), message: nil, preferredStyle: UIAlertController.Style.alert)
alertController.addAction(UIAlertAction(title: NSLocalizedString("OK", comment: ""), style: UIAlertAction.Style.cancel, handler: { (alertAction: UIAlertAction) in
alertController.dismiss(animated: true, completion: nil)
}))
present(alertController, animated: true, completion: nil)
}
// MARK: - Actions
@objc func settingsButtonTapped(_ sender: AnyObject?) {
performSegue(withIdentifier: "presentSettingsSegue", sender: sender)
}
@objc func closeButtonTapped(_ sender: AnyObject?) {
dismiss(animated: true, completion: nil)
}
@IBAction func activityButtonTapped(_ sender: AnyObject) {
performSegue(withIdentifier: "showActivitiesSegue", sender: sender)
}
@IBAction func inboxButtonPressed(_ sender: AnyObject) {
performSegue(withIdentifier: "presentContentInboxSegue", sender: sender)
}
@IBAction func sendContentButtonTapped(_ sender: AnyObject) {
performSegue(withIdentifier: "showSendContentSegue", sender: sender)
}
@IBAction func connectButtonTapped(_ sender: AnyObject) {
let button = sender as! UIButton;
guard let user = user, let currentUser = UserManager.sharedInstance.user else {
print("No current user found in profile")
return
}
if !user.isCurrentUser {
button.isEnabled = false
UserManager.sharedInstance.createConnectionRequestForUser(currentUser, targetUser: user, completion: { (success, error) in
if success {
self.alertConnectionRequestSent()
button.isEnabled = false
} else if let error = error {
if error._code == 400 {
self.alertConnectionRequestAlreadySent()
}
Crashlytics.sharedInstance().recordError(error)
button.isEnabled = true
}
})
}
}
@IBAction func connectionsButtonTapped(_ sender: AnyObject) {
performSegue(withIdentifier: "presentConnectionsSegue", sender: sender)
}
// MARK: - AmbassadorshipsCollectionViewControllerDelegate
func didTapAddButtonForAmbassadorshipsCollectionViewController(_ ambassadorshipsCollectionViewController: AmbassadorshipsCollectionViewController) {
let brandConnectViewController = BrandConnectViewController()
brandConnectViewController.delegate = ambassadorshipsCollectionViewController
present(brandConnectViewController, animated: true, completion: nil)
}
func ambassadorshipsCollectionViewController(didSelectCell cell: BrandCollectionViewCell, forAmbassadorship ambassadorship: Ambassadorship) {
let contentViewController = UIStoryboard(name: "Content", bundle: nil).instantiateViewController(withIdentifier: "ContentController") as! ContentSetupViewController
contentViewController.ambassadorship = ambassadorship
let logotypeImageViewRect = cell.convert(cell.logotypeImageView.frame, to: self.view)
let imageView = cell.logotypeImageView
if let image = imageView.image {
self.profileContentTransitionManager = ProfileContentTransitionManager(fromBrandImage: image, fromBrandImageViewFrameInViewController: logotypeImageViewRect)
contentViewController.transitioningDelegate = self.profileContentTransitionManager
}
present(contentViewController, animated: true, completion: nil)
imageView.alpha = 0
delay(1.0, closure: {
imageView.alpha = 1
})
}
func deletionIsActive(_ active:Bool) {
tap.isEnabled = active
deleteIsActive = active
}
func hidedeletion() {
if deleteIsActive {
deleteIsActive = false
tap.isEnabled = false
if let am = ambassadorshipsCollectionViewController {
am.shouldWiggle = false
am.toggleCellWiggle()
}
}
}
// MARK: - ProfilePictureImageViewDelegate
func didTapProfilePictureImageView(_ profilePictureImageView: ProfilePictureImageView) {
present(imagePicker, animated: true, completion: nil)
}
// MARK: - UIImagePickerControllerDelegate
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
var image: UIImage?
if info[UIImagePickerController.InfoKey.editedImage.rawValue] != nil {
image = info[UIImagePickerController.InfoKey.editedImage.rawValue] as? UIImage
} else if info[UIImagePickerController.InfoKey.originalImage.rawValue] != nil {
image = info[UIImagePickerController.InfoKey.originalImage.rawValue] as? UIImage
}
if let selectedImage = image {
didSelectProfilePicture(selectedImage)
}
picker.dismiss(animated: true, completion: nil)
}
func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
picker.dismiss(animated: true, completion: nil)
}
fileprivate func didSelectProfilePicture(_ image: UIImage) {
let newImage = image.resizeImage(profilePictureImageView.frame.size.width*3)
profilePictureImageView.startLoading()
if let user = self.user {
profilePictureImageView.updateImageForUser(user, image: newImage,completion: { (url) in
if let url = url, let user = self.user {
user.setProfilePicture(url)
self.profilePictureImageView.setImageForUser(user)
self.profilePictureImageView.allowSelection = false
self.profilePictureAddIndicator.isHidden = true
}
self.profilePictureImageView.stopLoading()
})
}
}
// MARK: - Navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "presentSettingsSegue" {
if let user = user {
let navVC = segue.destination as! UINavigationController
let vc = navVC.viewControllers.first as! SettingsViewController
vc.user = user
}
} else if segue.identifier == "ambassadorshipsCollectionViewControllerContainerSegue" {
if let ambassadorshipsCollectionViewController = segue.destination as? AmbassadorshipsCollectionViewController {
ambassadorshipsCollectionViewController.delegate = self
self.ambassadorshipsCollectionViewController = ambassadorshipsCollectionViewController
}
}
}
}
| [
-1
] |
1f47b08d6f744b313495e4bf041da50321cf094f | 968e64ebd14ebe1fe7184388343c6f456f2ae909 | /gift/Components/Configuration/Configuration.swift | f3546dfae5f8546598811b715b997f97894769ca | [] | no_license | giftapp/gift-ios | 332241de41bebe90fd2bee4fb2f6c672e8192419 | 54d2f63384de60b91b4e730a606f723cce42f9d3 | refs/heads/master | 2020-12-31T02:15:14.989364 | 2017-01-21T19:14:02 | 2017-01-21T19:14:02 | 59,519,262 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,576 | swift | //
// Created by Matan Lachmish on 12/11/2016.
// Copyright (c) 2016 GiftApp. All rights reserved.
//
import Foundation
enum ConfigurationScheme {
case development, developmentLocal, production
static func getConfigurationScheme(fromString: String) -> ConfigurationScheme{
switch fromString {
case "Development":
return .development
case "DevelopmentLocal":
return .developmentLocal
default:
return .production
}
}
}
private struct ConfigurationConstants{
static let currentConfigurationKey = "Configuration"
static let configurationFileName = "Configuration"
static let giftAPIEndpointURLKey = "giftAPIEndpointURL"
static let loggingLevelKey = "loggingLevel"
static let developmentToolsEnabledKey = "developmentToolsEnabled"
}
/**
* Represent the current built configuration (i.e Development/Production/etc.).
* This class is a singleton.
**/
class Configuration {
//Public Properties
static let sharedInstance = Configuration()
public private(set) var configurationScheme: ConfigurationScheme
//Private Properties
private var configuration: NSDictionary!
//-------------------------------------------------------------------------------------------
// MARK: - Initialization & Destruction
//-------------------------------------------------------------------------------------------
private init() {
let currentConfiguration = Bundle.main.object(forInfoDictionaryKey: ConfigurationConstants.currentConfigurationKey) as! String
configurationScheme = ConfigurationScheme.getConfigurationScheme(fromString: currentConfiguration)
let path = Bundle.main.path(forResource: ConfigurationConstants.configurationFileName, ofType: "plist")!
configuration = NSDictionary(contentsOfFile: path)!.object(forKey: currentConfiguration) as! NSDictionary
}
//-------------------------------------------------------------------------------------------
// MARK: - Public
//-------------------------------------------------------------------------------------------
var apiEndpoint: String {
return configuration.object(forKey: ConfigurationConstants.giftAPIEndpointURLKey) as! String
}
var loggingLevel: String {
return configuration.object(forKey: ConfigurationConstants.loggingLevelKey) as! String
}
var developmentToolsEnabled: Bool {
return configuration.object(forKey: ConfigurationConstants.developmentToolsEnabledKey) as! Bool
}
}
| [
-1
] |
6a072ce41b1d315187a1c79d419c260d63989d6d | fd5b91d41851dfe76f4c7692c0325d5ab7df7c20 | /iBeacon/iBeaconTests/iBeaconTests.swift | f6bffa9ae75bda865e84199ed0d72e5d94ba6090 | [] | no_license | mendirattanishant/iBeacon | 178816ab8bb8d2f75d3338f80957516f5ca1670a | 8216f9b322a594f8456770194d0d6ebef34f3cf0 | refs/heads/master | 2021-01-19T17:39:39.422975 | 2017-08-22T16:35:43 | 2017-08-22T16:35:43 | 101,082,549 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 983 | swift | //
// iBeaconTests.swift
// iBeaconTests
//
// Created by Nishant Mendiratta on 8/22/17.
// Copyright © 2017 Nishant Mendiratta. All rights reserved.
//
import XCTest
@testable import iBeacon
class iBeaconTests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measure {
// Put the code you want to measure the time of here.
}
}
}
| [
282633,
313357,
182296,
241692,
98333,
16419,
102437,
229413,
292902,
204840,
354345,
223274,
278570,
344107,
233517,
124975,
253999,
346162,
229430,
319542,
124984,
358456,
288833,
352326,
311372,
354385,
196691,
315476,
280661,
329814,
278615,
338007,
307289,
200794,
354393,
309345,
280675,
280677,
313447,
278634,
315498,
319598,
288879,
352368,
299121,
284788,
233589,
280694,
333940,
237689,
292988,
215164,
313469,
215166,
278655,
292992,
333955,
280712,
215178,
241808,
323729,
325776,
317587,
278677,
284826,
278685,
346271,
311458,
278691,
233636,
49316,
299174,
333991,
333992,
284842,
32941,
278704,
239793,
278708,
125109,
131256,
182456,
295098,
184505,
299198,
379071,
299203,
301251,
309444,
338119,
299209,
282831,
321745,
254170,
356576,
338150,
176362,
286958,
125169,
338164,
327929,
184570,
243962,
125183,
309503,
125188,
313608,
125193,
375051,
180493,
125198,
325905,
254226,
125203,
125208,
325912,
299293,
278816,
125217,
233762,
211235,
217380,
305440,
151847,
282919,
125235,
332085,
280887,
125240,
332089,
278842,
282939,
315706,
287041,
241986,
260418,
332101,
182598,
323916,
319821,
254286,
348492,
250192,
6481,
323920,
344401,
348500,
366929,
289110,
155990,
366930,
6489,
272729,
379225,
106847,
323935,
391520,
321894,
280939,
242029,
246127,
354676,
199029,
139640,
246136,
246137,
291192,
291198,
362881,
248194,
225670,
395659,
227725,
395661,
240016,
178582,
291224,
293274,
317852,
283038,
61857,
285090,
61859,
289189,
375207,
340398,
377264,
299441,
61873,
283064,
61880,
293306,
278970,
319930,
336317,
293310,
291265,
278978,
127427,
127428,
283075,
188871,
324039,
317901,
289232,
281040,
278993,
326100,
278999,
328152,
176601,
242139,
369116,
285150,
287198,
279008,
342498,
242148,
195045,
279013,
279018,
281072,
279029,
293367,
279032,
233978,
279039,
291333,
342536,
287241,
279050,
340490,
303636,
289304,
279065,
342553,
291358,
182817,
180771,
375333,
377386,
293419,
283184,
289332,
23092,
315960,
352829,
301638,
348742,
293448,
322120,
55881,
348749,
281166,
244310,
354911,
436832,
66150,
111208,
344680,
191082,
313966,
281199,
295536,
279164,
189057,
311941,
348806,
279177,
369289,
330379,
344715,
184973,
311949,
330387,
330388,
352917,
227990,
230040,
271000,
289434,
342682,
279206,
295590,
287404,
205487,
295599,
303793,
299699,
299700,
164533,
338613,
314040,
287417,
158394,
342713,
285373,
66242,
363211,
279252,
318173,
289502,
363230,
295652,
338662,
285415,
346858,
289518,
199414,
154359,
35583,
205568,
291585,
295682,
162561,
299776,
363263,
285444,
322319,
166676,
207640,
326429,
336671,
326433,
344865,
289576,
279336,
318250,
295724,
152365,
312108,
318252,
353069,
328499,
242485,
353078,
230199,
353079,
293693,
336702,
295746,
420677,
353094,
353095,
299849,
283467,
293711,
281427,
353109,
281433,
230234,
293730,
303972,
351077,
275303,
230248,
342887,
242541,
246641,
330609,
246648,
209785,
269178,
177019,
279417,
361337,
254850,
359298,
416646,
240518,
287622,
228233,
228234,
308107,
56208,
295824,
308112,
209817,
289690,
324506,
324507,
318364,
189348,
324517,
289703,
293800,
353195,
140204,
353197,
353216,
349121,
363458,
213957,
213960,
279498,
316364,
338899,
340955,
248797,
207838,
50143,
130016,
340961,
64485,
314342,
123881,
324586,
203757,
289774,
304110,
320494,
340974,
316405,
240630,
295927,
201720,
304122,
314362,
320507,
328700,
328706,
320516,
293893,
230410,
320527,
146448,
324625,
316437,
140310,
418837,
197657,
281626,
201755,
336929,
300068,
357414,
248872,
345132,
238639,
252980,
300084,
322612,
359478,
324666,
238651,
302139,
21569,
359495,
238664,
300111,
314448,
341073,
353367,
156764,
156765,
314467,
281700,
250981,
322663,
300136,
316520,
228458,
207979,
316526,
357486,
187506,
353397,
291959,
160891,
341115,
363644,
150657,
187521,
248961,
349316,
279685,
349318,
222343,
228491,
228493,
285838,
169104,
162961,
177296,
308372,
326804,
296086,
187544,
119962,
300187,
296092,
300188,
339102,
302240,
343203,
300201,
300202,
253099,
238765,
279728,
367799,
339130,
230588,
64700,
343234,
367810,
259268,
283847,
353479,
62665,
353481,
353482,
244940,
283852,
283853,
290000,
228563,
189652,
296153,
357595,
279774,
298212,
304356,
330984,
228588,
298221,
234733,
253167,
279792,
353523,
298228,
216315,
208124,
316669,
363771,
388349,
228609,
279814,
322824,
242954,
292107,
312587,
328971,
251153,
245019,
320796,
126237,
130338,
130343,
351537,
298291,
345396,
300343,
116026,
222524,
286018,
193859,
279875,
304456,
230729,
224586,
372043,
177484,
251213,
238927,
296273,
120148,
318805,
283991,
222559,
314720,
292195,
230756,
294243,
333160,
230765,
243056,
279920,
312689,
314739,
116084,
327025,
327031,
111993,
306559,
148867,
179587,
378244,
298374,
314758,
314760,
388487,
368011,
314766,
296335,
112017,
234898,
112018,
306579,
282007,
357786,
290207,
314783,
333220,
314789,
279974,
282024,
241066,
316842,
286129,
173491,
210358,
284089,
228795,
292283,
302529,
302531,
292292,
163268,
380357,
300487,
415171,
300489,
361927,
370123,
148940,
280013,
310732,
64975,
312782,
327121,
222675,
366037,
210390,
210391,
353750,
210393,
228827,
286172,
310757,
187878,
280041,
361963,
54765,
191981,
321009,
251378,
343542,
280055,
300536,
288249,
343543,
286205,
300542,
290301,
230913,
210433,
282114,
228867,
366083,
323080,
230921,
253452,
323087,
304656,
329232,
316946,
146964,
398869,
308764,
349726,
282146,
306723,
245287,
245292,
349741,
169518,
230959,
286254,
288309,
290358,
235070,
288318,
349763,
124485,
56902,
292423,
288326,
288327,
292425,
243274,
128587,
333388,
333393,
290390,
235095,
300630,
196187,
343647,
300644,
374372,
282213,
323178,
54893,
138863,
222832,
314998,
247416,
366203,
175741,
337535,
294529,
224901,
282245,
282246,
288392,
229001,
310923,
188048,
323217,
239250,
282259,
345752,
229020,
298654,
255649,
245412,
298661,
40613,
290471,
40614,
40615,
229029,
282280,
323236,
321207,
296632,
319162,
280251,
282303,
286399,
218819,
321219,
306890,
280267,
212685,
333517,
212688,
333520,
241361,
245457,
302802,
333521,
333523,
280278,
280280,
298712,
18138,
278234,
294622,
321247,
298720,
278240,
12010,
212716,
212717,
280300,
282348,
284401,
282358,
313081,
286459,
325371,
124669,
194303,
278272,
175873,
319233,
323331,
323332,
280329,
284429,
161554,
278291,
294678,
321302,
366360,
116505,
249626,
284442,
325404,
321310,
282400,
241441,
325410,
339745,
341796,
247590,
257830,
294700,
317232,
282417,
296755,
321337,
282427,
360252,
345919,
325439,
315202,
307011,
345929,
341836,
325457,
216918,
18262,
370522,
188251,
300894,
345951,
362337,
302946,
284514,
345955,
296806,
292712,
288619,
325484,
296814,
292720,
362352,
313203,
325492,
241528,
194429,
124798,
325503,
182144,
305026,
253829,
333701,
67463,
243591,
243597,
325518,
282518,
294807,
282519,
124824,
214937,
329622,
298909,
118685,
319392,
292771,
354212,
294823,
333735,
284587,
124852,
243637,
288697,
294843,
214977,
163781,
214984,
151497,
344013,
247757,
212946,
219101,
280541,
298980,
292836,
294886,
337895,
247785,
253929,
296941,
327661,
362480,
325619,
333817,
292858,
313339
] |
3daaa76e5851065f07f9a2b06e3dfb20e975ee40 | 104bada7e3ed9f26cf777a01695ce59372bb6f4b | /WeatherApp/Utils/Reachability.swift | 2873fef5aef71e618f6463cedaed3f20630702dc | [] | no_license | danielyang112/WeatherApp | dcad458b9c9a4c5021511a5a17f90a1780632c5d | e9de430553e714b44fed5571d3423c36ce5177f5 | refs/heads/master | 2021-04-27T20:09:08.676492 | 2018-02-21T18:00:49 | 2018-02-21T18:00:49 | 122,372,679 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,575 | swift | //
// Reachability.swift
// WeatherApp
//
// Created by Daniel Yang on 2018-02-22.
// Copyright © 2018 Daniel Yang. All rights reserved.
//
import SystemConfiguration
public class Reachability {
class func isConnectedToNetwork() -> Bool {
var zeroAddress = sockaddr_in(sin_len: 0, sin_family: 0, sin_port: 0, sin_addr: in_addr(s_addr: 0), sin_zero: (0, 0, 0, 0, 0, 0, 0, 0))
zeroAddress.sin_len = UInt8(MemoryLayout.size(ofValue: zeroAddress))
zeroAddress.sin_family = sa_family_t(AF_INET)
let defaultRouteReachability = withUnsafePointer(to: &zeroAddress) {
$0.withMemoryRebound(to: sockaddr.self, capacity: 1) {zeroSockAddress in
SCNetworkReachabilityCreateWithAddress(nil, zeroSockAddress)
}
}
var flags: SCNetworkReachabilityFlags = SCNetworkReachabilityFlags(rawValue: 0)
if SCNetworkReachabilityGetFlags(defaultRouteReachability!, &flags) == false {
return false
}
/* Only Working for WIFI
let isReachable = flags == .reachable
let needsConnection = flags == .connectionRequired
return isReachable && !needsConnection
*/
// Working for Cellular and WIFI
let isReachable = (flags.rawValue & UInt32(kSCNetworkFlagsReachable)) != 0
let needsConnection = (flags.rawValue & UInt32(kSCNetworkFlagsConnectionRequired)) != 0
let ret = (isReachable && !needsConnection)
return ret
}
}
| [
243718,
252071,
317578,
300203,
234700,
132365,
210845,
258319,
140084,
340280,
237596,
198205,
361279
] |
d1d5908ff24e12ebfee8120fb4234b48dbccb2c4 | fec77e74bb11821dfc2b2380df50787106fff261 | /I Bike CPH/CykelPlanen/StyleCykelPlanen.swift | d9c3881e447beb3545d50a73ce04873d34a627ff | [] | no_license | PaoloLongato/ibikecph-ios | 0c47b27c315c31f5463165db1d01776dc1192b8e | caab2a727bd6e8bf6360d39b64fb7a8c994f4e2a | refs/heads/master | 2021-01-15T08:16:10.876581 | 2015-12-09T14:15:45 | 2015-12-09T14:15:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 970 | swift | //
// StyleCykelPlanen.swift
// I Bike CPH
//
// Created by Tobias Due Munk on 30/11/14.
// Copyright (c) 2014 I Bike CPH. All rights reserved.
//
import UIKit
extension UIColor {
class func orange() -> UIColor {
return UIColor(red: 255/255, green: 102/255, blue: 0/255, alpha: 1)
}
}
@objc class Styler: StyleProtocol {
class func backgroundColor() -> UIColor {
return .whiteColor()
}
class func tintColor() -> UIColor {
return .orange()
}
class func foregroundColor() -> UIColor {
return .darkGrayColor()
}
class func foregroundSecondaryColor() -> UIColor {
return .lightGrayColor()
}
class func navigationBarTintColor() -> UIColor {
return .orange()
}
class func navigationBarContentTintColor() -> UIColor {
return .whiteColor()
}
class func logo() -> UIImage? {
return UIImage(named: "Logo")
}
} | [
-1
] |
a342553c80a4dfcd8c60a151792b2d423b4705b9 | e026030097e14de572f8005149109efcfb4c8a99 | /Assgn_7/Assgn_6/AppDelegate.swift | 2cf21640049715e358764c355865ce9121309415 | [] | no_license | chintankoticha/SWIFT_HOTEL_APP | 4f397105def02edff5d1431503961475a518c0b4 | 5c41a4003488fed66ddf614cccd17ff62cdc20ab | refs/heads/master | 2020-03-19T17:31:51.950067 | 2018-06-09T23:22:39 | 2018-06-09T23:22:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,627 | swift | //
// AppDelegate.swift
// Assgn_6
//
// Created by Chintan Dinesh Koticha on 3/1/18.
// Copyright © 2018 Chintan Dinesh Koticha. All rights reserved.
//
import UIKit
import CoreData
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
// Saves changes in the application's managed object context before the application terminates.
self.saveContext()
}
// MARK: - Core Data stack
lazy var persistentContainer: NSPersistentContainer = {
/*
The persistent container for the application. This implementation
creates and returns a container, having loaded the store for the
application to it. This property is optional since there are legitimate
error conditions that could cause the creation of the store to fail.
*/
let container = NSPersistentContainer(name: "Assgn_6")
container.loadPersistentStores(completionHandler: { (storeDescription, error) in
if let error = error as NSError? {
// Replace this implementation with code to handle the error appropriately.
// fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
/*
Typical reasons for an error here include:
* The parent directory does not exist, cannot be created, or disallows writing.
* The persistent store is not accessible, due to permissions or data protection when the device is locked.
* The device is out of space.
* The store could not be migrated to the current model version.
Check the error message to determine what the actual problem was.
*/
fatalError("Unresolved error \(error), \(error.userInfo)")
}
})
return container
}()
// MARK: - Core Data Saving support
func saveContext () {
let context = persistentContainer.viewContext
if context.hasChanges {
do {
try context.save()
} catch {
// Replace this implementation with code to handle the error appropriately.
// fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
let nserror = error as NSError
fatalError("Unresolved error \(nserror), \(nserror.userInfo)")
}
}
}
}
| [
294405,
243717,
163848,
313353,
320008,
320014,
313360,
288275,
289300,
322580,
290326,
329747,
139803,
103964,
322080,
306721,
229408,
229411,
322083,
296483,
306726,
309287,
308266,
292907,
217132,
322092,
40495,
316465,
288306,
322102,
324663,
164408,
308281,
322109,
286783,
313409,
315457,
313413,
349765,
320582,
309832,
288329,
242250,
215117,
196177,
241746,
344661,
231000,
212571,
300124,
287323,
309342,
325220,
306790,
290409,
311914,
296043,
310378,
152685,
239726,
307310,
334446,
322666,
292466,
307315,
314995,
314487,
291450,
314491,
222846,
288383,
318599,
312970,
311444,
239252,
294038,
311449,
323739,
300194,
233638,
298662,
233644,
313005,
286896,
300208,
286389,
234677,
125111,
294070,
321212,
309439,
235200,
284352,
296641,
242371,
302787,
284360,
321228,
319181,
298709,
284374,
189654,
182486,
320730,
241371,
311516,
357083,
179420,
322272,
317665,
298210,
165091,
311525,
288489,
290025,
229098,
307436,
304365,
323310,
125167,
313073,
286455,
306424,
322299,
302332,
319228,
319231,
184576,
309505,
241410,
311043,
366339,
309509,
318728,
125194,
234763,
321806,
125201,
296218,
313116,
326434,
237858,
300836,
313125,
295716,
289577,
125226,
133421,
317233,
241971,
316726,
318264,
201530,
313660,
159549,
287038,
218943,
182079,
292159,
288578,
301893,
234828,
292172,
300882,
379218,
321364,
243032,
201051,
230748,
258397,
298844,
294238,
300380,
291169,
199020,
293741,
319342,
316788,
313205,
244598,
292212,
124796,
317821,
305022,
303999,
313215,
314241,
196988,
243072,
242050,
325509,
293767,
316300,
306576,
322448,
308114,
319900,
298910,
313250,
308132,
316327,
306605,
316334,
324015,
324017,
200625,
316339,
300979,
322998,
67000,
296888,
316345,
300987,
319932,
310718,
292288,
317888,
323520,
312772,
214980,
298950,
306632,
310733,
289744,
310740,
235994,
286174,
315359,
240098,
323555,
236008,
319465,
248299,
311789,
326640,
203761,
320498,
188913,
314357,
288246,
309243,
300540,
310782
] |
7ada16216793cae6f0eea331c3ddc739459724e6 | 001c882f6ee5e91b9bda55d899d864daf2d8b728 | /FastMovie/FastMovie/Application/GenreList/Factories/Core/Interector/GenresInterectorFactory.swift | cd25b23c218fac9b680308e5d9a3544610deb220 | [] | no_license | lazaro10/FastMovie | 432cb6e0ad80b01861d844aced513588915fd125 | e6bfd27d6b6c8ed41ad775748b31a04a7b0c7a48 | refs/heads/master | 2021-05-12T02:04:04.876257 | 2018-01-19T21:13:08 | 2018-01-19T21:13:08 | 117,575,768 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 360 | swift | //
// GenresInterectorFactory.swift
// FastMovie
//
// Created by Lázaro Lima dos Santos on 17/01/18.
// Copyright © 2018 Lázaro Lima dos Santos. All rights reserved.
//
import Foundation
struct GenresInterectorFactory {
static func make() -> GenresInterector {
return GenresInterector(gateway: GenresNetworkGatewayFactory.make())
}
}
| [
-1
] |
bbeacb8e0db2f2a739214d73a4ef1c40df9af095 | ff77a99ccf3ff35e46c9c4fdd48643d8d881d9f4 | /Chapter08/swift_3_oop_chapter_08_09/Chapter8/Entity.swift | 5c7b2503a0c5bf0be8c42e579db657505caa0fe1 | [
"MIT"
] | permissive | PacktPublishing/Swift-3-Object-Oriented-Programming | 6fff0614fbe8e1d298df3424b5b36f2e5629537b | a8f5fa47b5a13be02d3f9f826750b8afbb8dd367 | refs/heads/master | 2023-02-07T00:43:46.468740 | 2023-01-30T04:16:00 | 2023-01-30T04:16:00 | 82,659,740 | 9 | 3 | null | null | null | null | UTF-8 | Swift | false | false | 374 | swift | // Book: Object-Oriented Programming with Swift 3
// Chapter 8: Extending and Building Object-Oriented Code
// Author: Gaston C. Hillar - Twitter.com/gastonhillar
// Publisher: Packt Publishing Ltd. - http://www.packtpub.com
//
// Entity.swift
import Foundation
open class Entity: Identifiable {
open let id: Int
init(id: Int) {
self.id = id
}
}
| [
-1
] |
9c46693a55d66a9dad28c538a00ae2a8c5920780 | ca2c6eb3d8ec5f85304149e294918fb03b560181 | /TPCollectionView/Color.swift | 999e3107c404e92648ab8a2b307600acf9059e43 | [] | no_license | ClementB01/TPCollectionView | cc743950011302e8289975dc7a51482522ad62b4 | 181ceea668c43307ace248cdfeb316c2441ede3a | refs/heads/master | 2022-08-26T06:59:04.949829 | 2020-05-26T14:48:02 | 2020-05-26T14:48:02 | 267,070,879 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 662 | swift | //
// Color.swift
// TPCollectionView
//
// Created by lpiem on 13/03/2020.
// Copyright © 2020 lpiem. All rights reserved.
//
import UIKit
enum Color: Int, CaseIterable {
case red
case orange
case yellow
case pea
case green
case turquoise
case cyan
case curellian
case blue
case purple
case magenta
case pink
var uiColor: UIColor {
return UIColor(hue: hue,
saturation: 1,
brightness: 1,
alpha: 1)
}
var hue: CGFloat {
return CGFloat(rawValue) / CGFloat(Color.allCases.count)
}
}
| [
-1
] |
9ea0bf576dcac0fffe77111478798bd35ec52e32 | 89fe17fd761dba3d468afa8d7743e152e090fefb | /Weather/Models/CachedCoord.swift | 03d978a81ef91f28e8a76ea72f5f8e7f7f0e151e | [] | no_license | Crabgore/Weather | 8c9c044e7f0f0e1ffbb073e5f25b5225481e8ba9 | e1bf912f093c2ad2163d03fde708ec7a46cdd2d9 | refs/heads/main | 2023-06-20T16:51:13.385035 | 2021-07-14T09:09:23 | 2021-07-14T09:09:23 | 375,407,165 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 378 | swift | //
// CachedCoord.swift
// Weather
//
// Created by Mihail on 11.06.2021.
//
import Foundation
import RealmSwift
@objcMembers class CachedCoord: Object {
dynamic var id: String = UUID().uuidString
dynamic var lat = RealmOptional<Double>()
dynamic var lon = RealmOptional<Double>()
override static func primaryKey() -> String? {
return "id"
}
}
| [
-1
] |
d0d12e68da5cb39e256d497fb46691a392b6e9ce | 7b25bd168dd6532f9ae084e278efc18129d91fbd | /CarLot/Document.swift | 2186c696cc8d24072fd4080a86ec31600e143067 | [] | no_license | sebnun/CarLot | ee7a5f56a38560dcd3d41679143fbfcfeb477e7d | 3795419907f8b705d1c89a0d2aced0ec302ba2b7 | refs/heads/master | 2021-01-10T04:09:41.383837 | 2016-03-30T22:44:35 | 2016-03-30T22:44:35 | 55,007,843 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 703 | swift | //
// Document.swift
// CarLot
//
// Created by Sebastian on 3/29/16.
// Copyright © 2016 Sebastian. All rights reserved.
//
import Cocoa
class Document: NSPersistentDocument {
override init() {
super.init()
// Add your subclass-specific initialization here.
}
override class func autosavesInPlace() -> Bool {
return true
}
override var windowNibName: String? {
// Returns the nib file name of the document
// If you need to use a subclass of NSWindowController or if your document supports multiple NSWindowControllers, you should remove this property and override -makeWindowControllers instead.
return "Document"
}
}
| [
278812
] |
232e65a15a19abfb904a39761e7303c74812c34b | f10d01789df79e33dacc6f04be38cc06d4a9dd68 | /Employers/Employers/SceneDelegate.swift | eccc1c076b0bc9c9f58afb6282b6a3dc829285ef | [] | no_license | Bishowjit-Ray/tableView | 7b655fa8bd359f40fed19c394e7770d5e4e4d873 | db9d6727ba772a22fb9364b762b0db12056b0848 | refs/heads/main | 2023-04-29T05:24:45.786320 | 2021-05-29T11:49:08 | 2021-05-29T11:49:08 | 371,958,387 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,292 | swift | //
// SceneDelegate.swift
// Employers
//
// Created by Bishowjit Ray on 21/3/21.
//
import UIKit
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
guard let _ = (scene as? UIWindowScene) else { return }
}
func sceneDidDisconnect(_ scene: UIScene) {
// Called as the scene is being released by the system.
// This occurs shortly after the scene enters the background, or when its session is discarded.
// Release any resources associated with this scene that can be re-created the next time the scene connects.
// The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead).
}
func sceneDidBecomeActive(_ scene: UIScene) {
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
}
func sceneWillResignActive(_ scene: UIScene) {
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).
}
func sceneWillEnterForeground(_ scene: UIScene) {
// Called as the scene transitions from the background to the foreground.
// Use this method to undo the changes made on entering the background.
}
func sceneDidEnterBackground(_ scene: UIScene) {
// Called as the scene transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
}
}
| [
393221,
163849,
393228,
393231,
393251,
352294,
344103,
393260,
393269,
213049,
376890,
385082,
393277,
376906,
327757,
254032,
368728,
180314,
254045,
180322,
376932,
286833,
286845,
286851,
417925,
262284,
360598,
286880,
377003,
377013,
164029,
327872,
180418,
377030,
377037,
377047,
418008,
418012,
377063,
327915,
205037,
393457,
393461,
393466,
418044,
385281,
336129,
262405,
180491,
336140,
164107,
262417,
368913,
262423,
377118,
377121,
262437,
254253,
336181,
262455,
393539,
262473,
344404,
213333,
418135,
270687,
262497,
418145,
262501,
213354,
246124,
262508,
262512,
213374,
385420,
393613,
262551,
262553,
385441,
385444,
262567,
385452,
262574,
393649,
385460,
262587,
344512,
262593,
360917,
369119,
328178,
328180,
328183,
328190,
254463,
328193,
164362,
328207,
410129,
393748,
262679,
377372,
188959,
385571,
377384,
197160,
33322,
352822,
270905,
197178,
418364,
188990,
369224,
385610,
270922,
352844,
385617,
352865,
262761,
352875,
344694,
352888,
336513,
377473,
385671,
148106,
213642,
377485,
352919,
98969,
344745,
361130,
336556,
385714,
434868,
164535,
336568,
164539,
328379,
328387,
352969,
344777,
418508,
385743,
385749,
139998,
189154,
369382,
361196,
418555,
344832,
336644,
344837,
344843,
328462,
361231,
394002,
336660,
418581,
418586,
434971,
369436,
262943,
369439,
418591,
418594,
336676,
418600,
418606,
369464,
361274,
328516,
336709,
328520,
336712,
361289,
328523,
336715,
361300,
213848,
426842,
361307,
197469,
361310,
254813,
361318,
344936,
361323,
361335,
328574,
369544,
361361,
222129,
345036,
115661,
386004,
345046,
386012,
386019,
386023,
328690,
435188,
328703,
328710,
418822,
377867,
328715,
361490,
386070,
271382,
336922,
345119,
377888,
214060,
345134,
345139,
361525,
386102,
361537,
377931,
345172,
189525,
156762,
402523,
361568,
148580,
345200,
361591,
386168,
361594,
410746,
214150,
345224,
386187,
345247,
361645,
345268,
402615,
361657,
337093,
402636,
328925,
165086,
66783,
165092,
328933,
222438,
328942,
386286,
386292,
206084,
328967,
345377,
345380,
353572,
345383,
263464,
337207,
345400,
378170,
369979,
386366,
337224,
337230,
337235,
263509,
353634,
337252,
402792,
271731,
378232,
337278,
271746,
181639,
353674,
181644,
361869,
181650,
181655,
230810,
181671,
181674,
181679,
181682,
337330,
181687,
370105,
181691,
181697,
361922,
337350,
181704,
337366,
271841,
329192,
361961,
329195,
116211,
337399,
402943,
337416,
329227,
419341,
419345,
329234,
419351,
345626,
419357,
345631,
419360,
370208,
394787,
419363,
370214,
419369,
394796,
419377,
419386,
206397,
214594,
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,
337601,
403139,
337607,
419528,
419531,
272083,
394967,
419543,
419545,
345819,
419548,
419551,
345829,
419560,
337643,
419564,
337647,
370416,
337671,
362249,
362252,
395022,
362256,
321300,
345888,
362274,
378664,
354107,
345916,
354112,
370504,
329545,
345932,
370510,
354132,
247639,
337751,
370520,
313181,
182110,
354143,
354157,
345965,
345968,
345971,
345975,
403321,
1914,
354173,
395148,
247692,
337809,
247701,
329625,
436127,
436133,
247720,
337834,
362414,
337845,
190393,
346059,
247760,
346064,
346069,
419810,
329699,
354275,
190440,
354314,
346140,
436290,
395340,
378956,
436307,
338005,
100454,
329833,
329853,
329857,
329868,
411806,
329886,
346273,
362661,
100525,
387250,
379067,
387261,
256193,
395467,
346317,
411862,
256214,
411865,
411869,
411874,
379108,
411877,
387303,
346344,
395496,
338154,
387307,
346350,
338161,
387314,
436474,
321787,
379135,
411905,
411917,
379154,
395539,
387350,
387353,
338201,
182559,
338212,
395567,
248112,
362823,
436556,
321880,
362844,
379234,
354674,
321911,
420237,
379279,
272787,
354728,
338353,
338382,
272849,
248279,
256474,
182755,
338404,
338411,
330225,
248309,
248332,
330254,
199189,
420377,
330268,
191012,
330320,
199250,
191069,
346722,
248427,
191085,
338544,
346736,
191093,
346743,
346769,
150184,
174775,
248505,
174778,
363198,
223936,
355025,
273109,
355029,
264919,
256735,
338661,
264942,
363252,
338680,
264965,
338701,
256787,
363294,
199455,
396067,
346917,
396070,
215854,
355123,
355141,
355144,
338764,
355151,
330581,
330585,
387929,
355167,
265056,
265059,
355176,
355180,
355185,
412600,
207809,
379849,
347082,
396246,
330711,
248794,
248799,
347106,
437219,
257009,
265208,
265215,
199681,
338951,
330761,
330769,
330775,
248863,
158759,
396329,
347178,
404526,
396337,
330803,
396340,
339002,
388155,
339010,
347208,
248905,
330827,
248915,
183384,
339037,
412765,
257121,
322660,
265321,
248952,
420985,
330886,
330890,
347288,
248986,
44199,
380071,
339118,
249018,
339133,
126148,
322763,
330959,
330966,
265433,
265438,
388320,
363757,
388348,
339199,
396552,
175376,
175397,
273709,
372016,
437553,
347442,
199989,
175416,
396601,
208189,
437567,
175425,
437571,
126279,
437576,
437584,
331089,
437588,
331094,
396634,
175451,
437596,
429408,
175458,
175461,
175464,
265581,
331124,
175478,
249210,
175484,
175487,
249215,
175491,
249219,
249225,
249228,
249235,
175514,
175517,
396703,
396706,
175523,
355749,
396723,
388543,
380353,
216518,
380364,
339406,
372177,
339414,
249303,
413143,
339418,
339421,
249310,
339425,
249313,
339429,
339435,
249329,
69114,
372229,
208399,
380433,
175637,
405017,
134689,
339504,
265779,
421442,
413251,
265796,
265806,
224854,
224858,
339553,
257636,
224871,
372328,
257647,
372338,
224885,
224888,
224891,
224895,
372354,
126597,
421509,
224905,
11919,
224911,
224914,
126611,
224917,
224920,
126618,
208539,
224923,
224927,
224930,
224933,
257705,
224939,
224943,
257713,
224949,
257717,
257721,
224954,
257725,
224960,
257733,
224966,
224970,
257740,
224976,
257745,
339664,
257748,
224982,
257752,
224987,
257762,
224996,
225000,
225013,
257788,
225021,
339711,
257791,
225027,
257796,
339722,
257802,
257805,
225039,
257808,
249617,
225044,
167701,
372500,
257815,
225049,
257820,
225054,
184096,
397089,
257825,
225059,
339748,
225068,
257837,
413485,
225071,
225074,
257843,
225077,
257846,
225080,
397113,
225083,
397116,
257853,
225088,
225094,
225097,
257869,
257872,
225105,
397140,
225109,
225113,
257881,
257884,
257887,
225120,
257891,
413539,
225128,
257897,
339818,
225138,
339827,
257909,
225142,
372598,
257914,
257917,
225150,
257922,
380803,
225156,
339845,
257927,
225166,
397201,
225171,
380823,
225176,
225183,
372698,
372704,
372707,
356336,
380919,
393215,
372739,
405534,
266295,
266298,
217158,
421961,
200786,
356440,
217180,
430181,
266351,
356467,
266365,
192640,
266375,
381069,
225425,
250003,
225430,
250008,
356507,
250012,
225439,
135328,
192674,
225442,
438434,
225445,
438438,
225448,
438441,
356521,
225451,
258223,
225456,
430257,
225459,
225462,
225468,
389309,
225472,
372931,
225476,
430275,
389322,
225485,
225488,
225491,
266454,
225494,
225497,
225500,
225503,
225506,
356580,
225511,
217319,
225515,
225519,
381177,
397572,
389381,
381212,
356638,
356641,
356644,
356647,
266537,
389417,
356650,
356656,
332081,
307507,
340276,
356662,
397623,
332091,
225599,
201030,
348489,
332107,
151884,
430422,
348503,
332118,
250201,
250203,
250211,
340328,
250217,
348523,
348528,
332153,
356734,
389503,
332158,
438657,
332162,
389507,
348548,
356741,
250239,
332175,
160152,
373146,
340380,
373149,
70048,
356783,
373169,
266688,
324032,
201158,
340452,
127473,
217590,
340473,
324095,
324100,
324103,
324112,
340501,
324118,
324122,
340512,
332325,
324134,
381483,
356908,
324141,
324143,
356917,
324150,
324156,
168509,
348734,
324161,
324165,
356935,
348745,
381513,
324171,
324174,
324177,
389724,
332381,
373344,
340580,
348777,
381546,
119432,
340628,
184983,
373399,
258723,
332455,
332460,
389806,
332464,
332473,
381626,
332484,
332487,
332494,
357070,
357074,
332512,
332521,
340724,
332534,
373499,
348926,
389927,
348979,
152371,
348983,
340792,
398141,
357202,
389971,
357208,
389979,
430940,
357212,
357215,
439138,
201580,
201583,
349041,
340850,
381815,
430967,
324473,
398202,
119675,
340859,
324476,
430973,
324479,
340863,
324482,
373635,
324485,
324488,
185226,
381834,
324493,
324496,
324499,
430996,
324502,
324511,
422817,
324514,
201638,
398246,
373672,
324525,
5040,
111539,
324534,
5047,
324539,
324542,
398280,
349129,
340940,
340942,
209874,
340958,
431073,
398307,
340964,
209896,
201712,
209904,
349173,
381947,
201724,
349181,
431100,
431107,
349203,
209944,
209948,
357411,
250915,
250917,
169002,
357419,
209966,
209969,
209973,
209976,
209980,
209988,
209991,
431180,
209996,
341072,
349268,
177238,
250968,
210011,
373853,
341094,
210026,
210028,
210032,
349296,
210037,
210042,
210045,
349309,
152704,
349313,
160896,
210053,
210056,
349320,
259217,
373905,
210068,
210072,
210078,
210081,
210085,
210089,
210096,
210100,
324792,
210108,
357571,
210116,
210128,
210132,
333016,
210139,
210144,
218355,
218361,
275709,
128254,
275713,
242947,
275717,
275723,
333075,
349460,
333079,
251161,
349486,
349492,
415034,
210261,
365912,
259423,
374113,
251236,
374118,
333164,
234867,
390518,
357756,
374161,
112021,
349591,
357793,
333222,
259516,
415168,
366035,
415187,
366039,
415192,
415194,
415197,
415200,
333285,
415208,
366057,
366064,
415217,
415225,
423424,
415258,
415264,
366118,
415271,
382503,
349739,
144940,
415279,
415282,
415286,
210488,
415291,
415295,
349762,
333396,
374359,
333400,
366173,
423529,
423533,
210547,
415354,
333440,
267910,
267929,
333512,
259789,
366301,
333535,
153311,
366308,
366312,
431852,
399086,
366319,
210673,
366322,
399092,
366326,
333566,
268042,
210700,
366349,
210707,
399129,
333595,
210720,
366384,
358192,
210740,
366388,
358201,
325441,
366403,
325447,
341831,
341835,
341839,
341844,
415574,
358235,
341852,
350046,
399200,
399208,
268144,
358256,
358260,
341877,
399222,
325494,
333690,
325505,
333699,
399244,
333709,
333725,
333737,
382891,
382898,
350153,
358348,
333777,
219094,
399318,
358372,
350190,
350194,
333819,
350204,
350207,
325633,
325637,
350214,
219144,
268299,
333838,
350225,
186388,
350232,
333851,
350238,
350241,
374819,
350245,
350249,
350252,
178221,
350257,
350260,
350272,
243782,
350281,
350286,
374865,
342113,
252021,
342134,
374904,
268435,
333998,
334012,
260299,
350411,
350417,
350423,
211161,
350426,
350449,
375027,
358645,
350459,
350462,
350465,
350469,
268553,
350477,
268560,
350481,
432406,
350487,
325915,
350491,
325918,
350494,
325920,
350500,
194854,
350505,
358701,
391469,
350510,
358705,
358714,
358717,
383307,
358738,
334162,
383331,
383334,
391531,
383342,
334204,
268669,
194942,
391564,
366991,
334224,
268702,
342431,
375209,
375220,
334263,
326087,
358857,
195041,
334312,
104940,
375279,
416255,
350724,
186898,
342546,
350740,
342551,
334359,
342555,
334364,
416294,
350762,
252463,
358962,
334386,
334397,
358973,
252483,
219719,
399957,
334425,
326240,
375401,
334466,
334469,
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,
326417,
375572,
375575,
375580,
162592,
334633,
326444,
383794,
326452,
326455,
375613,
244542,
260925,
375616,
326463,
326468,
342857,
326474,
326479,
326486,
416599,
342875,
244572,
326494,
433001,
400238,
326511,
211826,
211832,
392061,
351102,
359296,
252801,
260993,
351105,
400260,
211846,
342921,
342931,
252823,
400279,
392092,
400286,
252838,
359335,
211885,
252846,
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,
343132,
384099,
384102,
384108,
367724,
187503,
343155,
384115,
212095,
351366,
384136,
384140,
384144,
351382,
384152,
384158,
384161,
351399,
384169,
367795,
244917,
384182,
367801,
384189,
384192,
351424,
343232,
367817,
244938,
384202,
253132,
326858,
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,
376111,
245042,
326970,
384324,
343366,
212296,
212304,
367966,
343394,
367981,
343410,
155000,
327035,
245121,
245128,
253321,
155021,
384398,
245137,
245143,
245146,
245149,
343453,
245152,
245155,
155045,
245158,
40358,
245163,
114093,
327090,
343478,
359867,
384444,
146878,
327108,
327112,
384457,
359887,
359891,
368093,
155103,
343535,
343540,
368120,
343545,
409092,
253445,
359948,
359951,
245295,
359984,
343610,
400977,
400982,
179803,
155241,
245358,
155255,
155274,
368289,
245410,
425639,
425652,
425663,
155328,
245463,
155352,
155356,
212700,
155364,
245477,
155372,
245487,
212723,
409336,
155394,
155404,
245528,
155423,
360224,
155439,
204592,
155444,
155448,
417596,
384829,
384831,
360262,
155463,
155477,
376665,
155484,
261982,
425823,
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,
393170,
155604,
155620,
253924,
155622,
253927,
327655,
360432,
393204,
360439,
253944,
393209,
155647
] |
d3d6c33494dc777e42f8ca8b5f4ec71a7d3cb4c6 | 8514c1de7400fa154fd327d64c67801aa064a5dd | /tic tac toe/ViewController.swift | 068efd7d1614c0d3ab5e7d69662d3495a717b3e6 | [] | no_license | Sreenivassreee/tic-tac-toe-Swift--ios | 03e6e8f5c0da2f466e20418a5531c12993ce9ac9 | 11d00073ba38659850450e668e3a9aa92645ca03 | refs/heads/main | 2023-04-12T20:53:59.790688 | 2021-05-09T17:32:06 | 2021-05-09T17:32:06 | 365,810,063 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,372 | swift | //
// ViewController.swift
// tic tac toe
//
// Created by Sreenivas k on 09/05/21.
//
import UIKit
class ViewController: UIViewController {
var isGameOver = false
var player=1
override func viewDidLoad() {
super.viewDidLoad()
refreshView()
}
@IBOutlet weak var WinnerLable: UILabel!
@IBOutlet weak var One: UIButton!
@IBOutlet weak var Two: UIButton!
@IBOutlet weak var Three: UIButton!
@IBOutlet weak var Four: UIButton!
@IBOutlet weak var Five: UIButton!
@IBOutlet weak var Six: UIButton!
@IBOutlet weak var Seven: UIButton!
@IBOutlet weak var Eight: UIButton!
@IBOutlet weak var Nine: UIButton!
@IBOutlet weak var resetButton: UIButton!
@IBAction func resetPressed(_ sender: UIButton) {
viewDidLoad()
print("Reset")
}
@IBAction func One(_ sender: UIButton) {
print("Here")
placeingObject(with: sender)
checkWinner()
}
func placeingObject(with sender:UIButton){
if isGameOver{}else{
if sender.titleLabel?.text == nil {
if self.player==1{
sender.setTitleColor(.white, for: .normal)
sender.setTitle("X", for: .normal)
player = 2
}else{
sender.setTitleColor(.white, for: .normal)
sender.setTitle("O", for: .normal)
player = 1
}
}else{
print("already Exist")
}
}
}
func refreshView(){
self.isGameOver = false
self.One.setTitle("", for: .normal)
self.Two.setTitle("", for: .normal)
self.Three.setTitle(nil, for: .normal)
self.Four.setTitle(nil, for: .normal)
self.Five.setTitle(nil, for: .normal)
self.Six.setTitle(nil, for: .normal)
self.Seven.setTitle(nil, for: .normal)
self.Eight.setTitle(nil, for: .normal)
self.Nine.setTitle(nil, for: .normal)
self.WinnerLable.text=""
self.player=1
self.resetButton.isHidden=true
}
func checkWinner() {
var one = One.titleLabel?.text
let two = Two.titleLabel?.text
let three = Three.titleLabel?.text
let four = Four .titleLabel?.text
let five = Five.titleLabel?.text
let six = Six.titleLabel?.text
let seven = Seven.titleLabel?.text
let eight = Eight.titleLabel?.text
let nine = Nine.titleLabel?.text
if !isGameOver{
if (one == "X" && two == "X" && three == "X") || (four == "X" && five == "X" && six == "X") || (seven == "X" && eight == "X" && nine == "X") || (one == "X" && four == "X" && seven == "X") || (two == "X" && five == "X" && eight == "X") || (three == "X" && six == "X" && nine == "X"){
WinnerLable.text="Winner : X"
resetButton.isHidden=false
isGameOver=true
}else if(one == "X" && five == "X" && nine == "X") || (three == "X" && five == "X" && seven == "X"){
WinnerLable.text="Winner : X"
resetButton.isHidden=false
isGameOver=true
}else if (one == "O" && two == "O" && three == "O") || (four == "O" && five == "O" && six == "O") || (seven == "O" && eight == "O" && nine == "O") || (one == "O" && four == "O" && seven == "O") || (two == "O" && five == "O" && eight == "O") || (three == "O" && six == "O" && nine == "O"){
WinnerLable.text="Winner : O"
resetButton.isHidden=false
isGameOver=true
}else if(one == "O" && five == "O" && nine == "O") || (three == "O" && five == "O" && seven == "O"){
WinnerLable.text="Winner : O"
resetButton.isHidden=false
isGameOver=true
}else if one != nil && two != nil && three != nil && four != nil && five != nil && six != nil && seven != nil && eight != nil && nine != nil{
WinnerLable.text="Match Draw"
resetButton.isHidden=false
}
}
}
}
| [
-1
] |
e405ec8afadb3a179b0845594a5760f9f8e45315 | 455cddd806cf8232422c39f91a7a7bac6f03936d | /Logging/PageController.swift | d4a12f68b2927d23dcf14d95314c88cd59898c8e | [
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-public-domain"
] | permissive | bmorris-revacomm/Logging-iOS | 63ef2fe98f3535ac5e69f5238bb0b519b40768a7 | d62b0984d7752682acb9305580a248880f62df08 | refs/heads/bethMaster | 2023-01-18T18:19:07.219579 | 2020-11-25T18:10:34 | 2020-11-25T18:10:34 | 302,386,563 | 0 | 0 | NOASSERTION | 2020-11-30T22:35:02 | 2020-10-08T15:36:14 | Swift | UTF-8 | Swift | false | false | 215 | swift | //
// PageController.swift
// Logging
//
// Created by Pete Misik on 9/24/20.
// Copyright © 2020 Christian Brechbuhl. All rights reserved.
//
import Foundation
class PageController: UIViewController{
}
| [
-1
] |
c4fe505a7ff71f5cc305651f029c59f0b24bc152 | b8b3c93862165b0e1ed28dbab54f5a4732e670c3 | /Snapchat/ViewControllers/ViewController.swift | 045f742dcb4cbfb409aff284f363dc9697b66572 | [] | no_license | rodrigosabreu/Snapchat | 2234ac8e58e1df50c085894dfdfefc01cb9f6701 | 0f0bd8bcb5d78c84909bafd8abf378cabb298d75 | refs/heads/master | 2021-08-24T03:11:01.682829 | 2017-12-07T20:14:25 | 2017-12-07T20:14:25 | 112,781,968 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,332 | swift | //
// ViewController.swift
// Snapchat
//
// Created by Rodrigo Abreu on 01/12/2017.
// Copyright © 2017 Rodrigo Abreu. All rights reserved.
//
import UIKit
import FirebaseAuth
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
//verificar se o usuario ja esta autenticado no firebase
let autenticacao = Auth.auth()
/*
//deslogar o usuario para testes
do{
try autenticacao.signOut()
}catch{
print("Erro ao deslogar usuario")
}
*/
//redireciona para a tela principal caso esteja logado no firebase
autenticacao.addStateDidChangeListener { (autenticacao, usuario) in
if let usuarioLogado = usuario{
self.performSegue(withIdentifier: "loginAutomaticoSegue", sender: nil)
}
}
}
override func viewWillAppear(_ animated: Bool) {
self.navigationController?.setNavigationBarHidden(true, animated: false)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
| [
-1
] |
5caf484b2b40d84638d00cd297865f39eb5a92f0 | 9ba9afafb8e3e83763c16c77df02b364fcece1e1 | /Yep/ViewControllers/Chat/CellNodes/ChatRightLocationCellNode.swift | dbb104f26ded055c6d9d66d2bd20dcd0c1575c8b | [
"MIT"
] | permissive | jlancer/Yep | c02f917f68a3628c77fe963d2bf767770b86f569 | 4797131e3dc155a33f38078672294f4336c4dec2 | refs/heads/master | 2021-07-23T11:47:36.956962 | 2021-01-05T08:54:56 | 2021-01-05T08:54:56 | 55,777,584 | 0 | 0 | MIT | 2021-01-05T08:54:57 | 2016-04-08T12:32:35 | Swift | UTF-8 | Swift | false | false | 3,681 | swift | //
// ChatRightLocationCellNode.swift
// Yep
//
// Created by NIX on 16/7/13.
// Copyright © 2016年 Catch Inc. All rights reserved.
//
import UIKit
import YepKit
import AsyncDisplayKit
class ChatRightLocationCellNode: ChatRightBaseCellNode {
private static let mapSize = CGSize(width: 192, height: 108)
private static let nameAttributes = [
NSForegroundColorAttributeName: UIColor.whiteColor(),
NSFontAttributeName: UIFont.systemFontOfSize(12),
]
var tapMapAction: ((message: Message) -> Void)?
private lazy var imageNode: ASImageNode = {
let node = ASImageNode()
node.contentMode = .ScaleAspectFill
let tap = UITapGestureRecognizer(target: self, action: #selector(ChatRightLocationCellNode.tapMap(_:)))
node.userInteractionEnabled = true
node.view.addGestureRecognizer(tap)
return node
}()
private lazy var locationNameNode: ASTextNode = {
let node = ASTextNode()
node.layerBacked = true
node.maximumNumberOfLines = 1
return node
}()
private lazy var borderNode: ASImageNode = {
let node = ASImageNode()
node.contentMode = .ScaleAspectFill
let image = UIImage(named: "right_tail_image_bubble_border")?.resizableImageWithCapInsets(UIEdgeInsets(top: 24, left: 20, bottom: 20, right: 27), resizingMode: .Stretch)
node.image = image
return node
}()
private var message: Message?
override init() {
super.init()
addSubnode(imageNode)
addSubnode(locationNameNode)
addSubnode(borderNode)
}
func configure(withMessage message: Message) {
self.user = message.fromFriend
self.message = message
do {
let locationName = message.textContent
locationNameNode.attributedText = NSAttributedString(string: locationName, attributes: ChatRightLocationCellNode.nameAttributes)
ImageCache.sharedInstance.mapImageOfMessage(message, withSize: ChatRightLocationCellNode.mapSize, tailDirection: .Right, bottomShadowEnabled: !locationName.isEmpty) { [weak self] mapImage in
self?.imageNode.image = mapImage
}
}
}
override func calculateSizeThatFits(constrainedSize: CGSize) -> CGSize {
let nameMaxWidth = ChatRightLocationCellNode.mapSize.width - (10 + 10)
locationNameNode.measure(CGSize(width: nameMaxWidth, height: CGFloat.max))
return CGSize(width: constrainedSize.width, height: ChatRightLocationCellNode.mapSize.height + ChatBaseCellNode.verticalPadding)
}
override func layout() {
super.layout()
let size = ChatRightLocationCellNode.mapSize
let x = calculatedSize.width - (size.width + 5 + ChatBaseCellNode.avatarSize.width + 15)
let y = ChatBaseCellNode.topPadding
let origin = CGPoint(x: x, y: y)
imageNode.frame = CGRect(origin: origin, size: size)
borderNode.frame = imageNode.frame
do {
let offsetX = (ChatRightLocationCellNode.mapSize.width - locationNameNode.calculatedSize.width) / 2
let y = ChatBaseCellNode.topPadding + ChatRightLocationCellNode.mapSize.height - 20
let offsetY = (20 - locationNameNode.calculatedSize.height) / 2
let origin = CGPoint(x: x + offsetX, y: y + offsetY)
locationNameNode.frame = CGRect(origin: origin, size: locationNameNode.calculatedSize)
}
}
// MARK: Selectors
@objc private func tapMap(sender: UITapGestureRecognizer) {
if let message = message {
tapMapAction?(message: message)
}
}
}
| [
-1
] |
ac3b2b345c7d5376309dfd776f80008194d4e923 | 8714f90eac6321cbee9c94c244c92833009ac77f | /Sources/AnyImageKit/Editor/View/Video/VideoEditorCropProgressView.swift | 7442fc417b422e078e7e58e86ee0940431401784 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | wanqingrongruo/AnyImageKit | 29e8d426d3546fac0a7d3533d4e0360f1bcf50ac | da9535b8102a9b6115514989f31dca894afa6d80 | refs/heads/master | 2022-08-11T11:40:24.938702 | 2022-07-21T03:43:59 | 2022-07-21T03:43:59 | 241,833,137 | 0 | 0 | MIT | 2020-02-20T08:38:46 | 2020-02-20T08:38:46 | null | UTF-8 | Swift | false | false | 10,489 | swift | //
// VideoEditorCropProgressView.swift
// AnyImageKit
//
// Created by 蒋惠 on 2019/12/19.
// Copyright © 2019-2022 AnyImageKit.org. All rights reserved.
//
import UIKit
protocol VideoEditorCropProgressViewDelegate: AnyObject {
func cropProgress(_ view: VideoEditorCropProgressView, didUpdate progress: CGFloat)
func cropProgressDurationOfVideo(_ view: VideoEditorCropProgressView) -> CGFloat
}
final class VideoEditorCropProgressView: UIView {
public weak var delegate: VideoEditorCropProgressViewDelegate?
private let options: EditorVideoOptionsInfo
private(set) var left: CGFloat = 0
private(set) var right: CGFloat = 1
public var progress: CGFloat {
let x = contentView.frame.origin.x + progressView.frame.origin.x
return x / (bounds.width - 20)
}
private var videoDuration: CGFloat = 0
private lazy var contentView: UIView = {
let view = UIView(frame: .zero)
view.layer.cornerRadius = 5
return view
}()
private lazy var progressContentView: UIView = {
let view = UIView(frame: .zero)
let pan = UIPanGestureRecognizer(target: self, action: #selector(progressViewPan(_:)))
view.addGestureRecognizer(pan)
return view
}()
private lazy var progressView: UIView = {
let view = UIView(frame: .zero)
view.layer.cornerRadius = 2.5
view.backgroundColor = UIColor.white
return view
}()
private lazy var leftButton: UIButton = {
let view = UIButton(type: .custom)
view.setImage(options.theme[icon: .videoCropLeft], for: .normal)
let pan = UIPanGestureRecognizer(target: self, action: #selector(leftButtonPan(_:)))
view.addGestureRecognizer(pan)
return view
}()
private lazy var rightButton: UIButton = {
let view = UIButton(type: .custom)
view.setImage(options.theme[icon: .videoCropRight], for: .normal)
let pan = UIPanGestureRecognizer(target: self, action: #selector(rightButtonPan(_:)))
view.addGestureRecognizer(pan)
return view
}()
private lazy var contentLayer: CAShapeLayer = {
let layer = CAShapeLayer()
layer.isHidden = true
layer.frame = bounds
layer.fillRule = .evenOdd
layer.fillColor = options.theme[color: .primary].cgColor
return layer
}()
private lazy var darkLayer: CAShapeLayer = {
let layer = CAShapeLayer()
layer.frame = bounds
layer.fillRule = .evenOdd
layer.fillColor = UIColor.black.withAlphaComponent(0.6).cgColor
return layer
}()
private lazy var timeline: UIView = {
let view = UIView(frame: .zero)
view.isHidden = true
view.backgroundColor = UIColor.white
return view
}()
private lazy var timelineLabel: UILabel = {
let view = UILabel(frame: .zero)
view.isHidden = true
view.textColor = UIColor.white
view.font = UIFont.systemFont(ofSize: 12)
return view
}()
/// 预览图
private var previews: [UIImageView] = []
init(frame: CGRect, options: EditorVideoOptionsInfo) {
self.options = options
super.init(frame: frame)
layer.cornerRadius = 5
setupView()
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func layoutSubviews() {
super.layoutSubviews()
layout(updateProgress: false)
}
private func setupView() {
layer.addSublayer(darkLayer)
contentView.layer.addSublayer(contentLayer)
addSubview(contentView)
addSubview(progressContentView)
contentView.addSubview(leftButton)
contentView.addSubview(rightButton)
progressContentView.addSubview(progressView)
progressContentView.addSubview(timeline)
progressContentView.addSubview(timelineLabel)
contentView.snp.makeConstraints { maker in
maker.top.bottom.equalToSuperview()
maker.left.equalToSuperview()
maker.right.equalToSuperview()
}
leftButton.snp.makeConstraints { maker in
maker.top.bottom.equalToSuperview()
maker.left.equalToSuperview()
maker.width.equalTo(20)
}
rightButton.snp.makeConstraints { maker in
maker.top.bottom.equalToSuperview()
maker.right.equalToSuperview()
maker.width.equalTo(20)
}
progressContentView.snp.makeConstraints { maker in
maker.top.bottom.equalToSuperview()
maker.left.equalTo(leftButton.snp.right)
maker.right.equalTo(rightButton.snp.left)
}
progressView.snp.makeConstraints { maker in
maker.top.bottom.equalToSuperview().inset(3)
maker.width.equalTo(5)
maker.left.equalToSuperview()
}
timeline.snp.makeConstraints { maker in
maker.bottom.equalTo(progressView.snp.top).offset(-8)
maker.centerX.equalTo(progressView)
maker.width.equalTo(1)
maker.height.equalTo(15)
}
timelineLabel.snp.makeConstraints { maker in
maker.bottom.equalTo(timeline.snp.top).offset(-8)
maker.centerX.equalTo(timeline)
}
options.theme.labelConfiguration[.videoTimeline]?.configuration(timelineLabel)
options.theme.buttonConfiguration[.videoCropLeft]?.configuration(leftButton)
options.theme.buttonConfiguration[.videoCropRight]?.configuration(rightButton)
}
private func layout(updateProgress: Bool) {
let isSelected = right - left != 1
leftButton.isSelected = isSelected
rightButton.isSelected = isSelected
contentLayer.isHidden = !isSelected
contentView.snp.updateConstraints { maker in
maker.left.equalToSuperview().offset(left*bounds.width)
maker.right.equalToSuperview().offset(-((1-right)*(bounds.width)))
}
if updateProgress {
progressView.snp.updateConstraints { maker in
maker.left.equalToSuperview()
}
}
contentLayer.frame = contentView.bounds
updateContentLayer()
updateDarkLayer()
}
private func updateContentLayer() {
let contentPath = UIBezierPath(roundedRect: contentView.bounds, cornerRadius: 5)
var rect = contentView.bounds
rect.origin.x += 20
rect.origin.y += 5
rect.size.width -= 40
rect.size.height -= 10
let rectPath = UIBezierPath(rect: rect)
contentPath.append(rectPath)
contentLayer.path = contentPath.cgPath
}
private func updateDarkLayer() {
let darkPath = UIBezierPath(rect: bounds)
let rectPath = UIBezierPath(rect: contentView.frame)
darkPath.append(rectPath)
darkLayer.path = darkPath.cgPath
}
}
// MARK: - Public
extension VideoEditorCropProgressView {
public func setupProgressImages(_ count: Int, image: UIImage?) {
previews = (0..<count).map{ _ in UIImageView(image: image) }
let stackView = UIStackView(arrangedSubviews: previews)
stackView.spacing = 0
stackView.axis = .horizontal
stackView.distribution = .fillEqually
stackView.alignment = .fill
insertSubview(stackView, at: 0)
stackView.snp.makeConstraints { maker in
maker.top.bottom.equalToSuperview().inset(5)
maker.left.right.equalToSuperview().inset(20)
}
}
public func setProgressImage(_ image: UIImage, idx: Int) {
guard idx < previews.count else { return }
self.previews[idx].setImage(image, animated: true)
}
public func setProgress(_ progress: CGFloat) {
var progress = progress < 0 ? 0 : (progress > 1 ? 1 : progress)
progress = progress < left ? left : (progress > right ? right : progress)
let offset = (progress - left) / (right - left) * (progressContentView.frame.width - progressView.frame.width)
progressView.snp.updateConstraints { maker in
maker.left.equalToSuperview().offset(offset)
}
// Label
if videoDuration == 0 {
videoDuration = delegate?.cropProgressDurationOfVideo(self) ?? 0.0
}
if videoDuration != 0 && !timeline.isHidden {
let time = Int(videoDuration*progress)
let min = time / 60
let sec = time % 60
timelineLabel.text = String(format: "%02ld:%02ld", min, sec)
}
}
}
// MARK: - Target
extension VideoEditorCropProgressView {
@objc private func progressViewPan(_ pan: UIPanGestureRecognizer) {
let point = pan.location(in: self)
let progress = point.x / bounds.width
setProgress(progress)
if progress < left || progress > right {
return
}
delegate?.cropProgress(self, didUpdate: progress)
setTimeline(hidden: pan.state != .changed)
}
@objc private func leftButtonPan(_ pan: UIPanGestureRecognizer) {
let point = pan.location(in: self)
let x = point.x < 0 ? 0 : point.x
let tmpLeft = x / bounds.width
if right - tmpLeft < 0.2 {
return
}
left = tmpLeft
setProgress(left)
layout(updateProgress: false)
delegate?.cropProgress(self, didUpdate: left)
setTimeline(hidden: pan.state != .changed)
}
@objc private func rightButtonPan(_ pan: UIPanGestureRecognizer) {
let point = pan.location(in: self)
let x = point.x > bounds.width ? bounds.width : point.x
let tmpRight = x / bounds.width
if tmpRight - left < 0.2 {
return
}
right = tmpRight
setProgress(right)
layout(updateProgress: false)
delegate?.cropProgress(self, didUpdate: right)
setTimeline(hidden: pan.state != .changed)
if pan.state == .ended || pan.state == .cancelled {
setProgress(left)
delegate?.cropProgress(self, didUpdate: left)
}
}
}
// MARK: - Private
extension VideoEditorCropProgressView {
private func setTimeline(hidden: Bool) {
timeline.isHidden = hidden
timelineLabel.isHidden = hidden
}
}
| [
-1
] |
e023e26f343365be7eeb4fd547e03f25ae831dd2 | 212140491bacdea76b2105546c1eefec67d6c23c | /ThePaper/Model/DataBaseManager.swift | c4137fde6ed41b808d25687ac64d372552ee7daf | [] | no_license | swipip/ThePaperNews | f2556f137f5cabc0feea30673d7b0094a5fe855b | 6663eed29e040beeeb87cc278f9ba9cfd96d655c | refs/heads/master | 2021-04-17T19:02:45.642281 | 2020-04-08T13:50:20 | 2020-04-08T13:50:20 | 249,467,947 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,404 | swift | //
// dataBaseManager.swift
// ThePaper
//
// Created by Gautier Billard on 01/04/2020.
// Copyright © 2020 Gautier Billard. All rights reserved.
//
import Foundation
import Firebase
protocol DataBaseManagerDelegate {
func didFetchData(preferences: [String])
}
class DataBaseManager {
var delegate: DataBaseManagerDelegate?
static let shared = DataBaseManager()
func savePreferences(_ preferences: [String]) {
if let user = Auth.auth().currentUser {
let uid:String = user.email!
for preference in preferences {
var ref: DocumentReference? = nil
ref = db.collection("usersPreferences").addDocument(data: [
"user": uid,
"preference": preference,
]) { err in
if let err = err {
print("Error adding document: \(err)")
} else {
print("Document added with ID: \(ref!.documentID)")
}
}
}
}
}
func cleanDataForCurrentUser(completion: @escaping () -> Void){
if let user = Auth.auth().currentUser {
db.collection("usersPreferences").whereField("user", isEqualTo: user.email!)
.getDocuments() { (querySnapshot, err) in
if let err = err {
print("Error getting documents: \(err)")
} else {
let documents = querySnapshot?.documents
documents?.forEach({ (doc) in
doc.reference.delete()
})
completion()
}
}
}
}
func erasePreference(preference: String) {
if let user = Auth.auth().currentUser {
db.collection("usersPreferences").whereField("user", isEqualTo: user.email!).whereField("preference", isEqualTo: preference)
.getDocuments() { (querySnapshot, err) in
if let err = err {
print("Error getting documents: \(err)")
} else {
let documents = querySnapshot?.documents
documents?.forEach({ (doc) in
doc.reference.delete()
})
}
}
}
}
func loadDataForUser() {
var userPref = [String]()
if let user = Auth.auth().currentUser {
db.collection("usersPreferences").whereField("user", isEqualTo: user.email!)
.getDocuments() { (querySnapshot, err) in
if let err = err {
print("Error getting documents: \(err)")
} else {
for document in querySnapshot!.documents {
let data = document.data()
if let property = data["preference"] as? String {
userPref.append(property)
}
}
}
self.delegate?.didFetchData(preferences: userPref)
}
}
}
}
| [
-1
] |
bf785d088e215874583f5371d1fffe26f309200c | 8208c4938539feea4e1bce2d325c4e2ca5fc76dc | /Source/Views/WWZViewController.swift | c546ffe4fbb799cd50ee1d20394a897558d8f6f7 | [
"MIT"
] | permissive | ccwuzhou/WWZSwift | 6905105a5d4ae951749e2e4e7fb0bc264dd4fb36 | 7c381d024455a15941b89a387ff649639a129d19 | refs/heads/master | 2021-01-17T21:10:03.083663 | 2017-04-14T08:17:20 | 2017-04-14T08:17:20 | 84,163,841 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 896 | swift | //
// WWZViewController.swift
// wwz_swift
//
// Created by wwz on 17/2/28.
// Copyright © 2017年 tijio. All rights reserved.
//
import UIKit
open class WWZViewController: UIViewController {
override open func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = UIColor.white
self.automaticallyAdjustsScrollViewInsets = false
self.edgesForExtendedLayout = .all
self.extendedLayoutIncludesOpaqueBars = true
}
override open var shouldAutorotate: Bool{
return false
}
override open var supportedInterfaceOrientations: UIInterfaceOrientationMask{
return UIInterfaceOrientationMask.portrait
}
override open var preferredInterfaceOrientationForPresentation: UIInterfaceOrientation{
return UIInterfaceOrientation.portrait
}
}
| [
-1
] |
b51f599f2d0913ecc5b3fdcf73138c0814a60101 | 3bc6b88422f52156e798d051f04f2dca10f74cc2 | /BallinUITests/BallinUITests.swift | ba21aa5fd21d86db861a8effb8ce205db07de727 | [] | no_license | Huzi1/ios_Swift | e4042dc6e55be89535dcfaef4320c1976b7db40f | 678100587f0a1be85f5314eb8da5f87d0f22e205 | refs/heads/master | 2021-04-19T15:11:17.401856 | 2020-03-24T04:53:19 | 2020-03-24T04:53:19 | 249,615,738 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 6,838 | swift | //
// BallinUITests.swift
// BallinUITests
//
// Created by 茆大蔚 on 22/9/19.
// Copyright © 2019 茆大蔚. All rights reserved.
//
import XCTest
class BallinUITests: XCTestCase {
override func setUp() {
// Put setup code here. This method is called before the invocation of each test method in the class.
// In UI tests it is usually best to stop immediately when a failure occurs.
continueAfterFailure = false
// In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testExample() {
// UI tests must launch the application that they test.
let app = XCUIApplication()
app.launch()
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
// func testLaunchPerformance() {
// if #available(macOS 10.15, iOS 13.0, tvOS 13.0, *) {
// // This measures how long it takes to launch your application.
// measure(metrics: [XCTOSSignpostMetric.applicationLaunch]) {
// XCUIApplication().launch()
// }
// }
// }
func testGame(){
let app = XCUIApplication()
app.launch()
//Query collections or elements for values
let numButtons = app.buttons.count
let numLabels = app.staticTexts.count
XCTAssertEqual(numButtons, 6)
XCTAssertEqual(numLabels, 181)
}
func testTeam(){
let app = XCUIApplication()
app.launch()
app.tabBars.buttons["Team"].tap()
let numLabels = app.staticTexts.count
app.swipeUp()
app.swipeUp()
XCTAssertEqual(numLabels, 15)
let string = app.staticTexts.element(matching: .any, identifier: "Jazz").label
XCTAssertEqual(string, "Jazz")
}
func testProfileDetail(){
let app = XCUIApplication()
app.launch()
app.tabBars.buttons["Profile"].tap()
let cellsQuery = app.collectionViews.cells
cellsQuery.otherElements.containing(.staticText, identifier:"David").element.tap()
let numButtons = app.buttons.count
let numLabels = app.staticTexts.count
XCTAssertEqual(numButtons, 5)
XCTAssertEqual(numLabels, 7)
}
func testProfile(){
let app = XCUIApplication()
app.launch()
app.tabBars.buttons["Profile"].tap()
let numButtons = app.buttons.count
let numLabels = app.staticTexts.count
XCTAssertEqual(numButtons, 4)
XCTAssertEqual(numLabels, 4)
}
func testTeamDetail(){
let app = XCUIApplication()
app.launch()
app.tabBars.buttons["Team"].tap()
let cellsQuery = app.collectionViews.cells
cellsQuery.otherElements.containing(.staticText, identifier:"Rockets").element.tap()
let numButtons = app.buttons.count
let numLabels = app.staticTexts.count
XCTAssertEqual(numButtons, 5)
XCTAssertEqual(numLabels, 39)
}
func testRecord(){
// let app = XCUIApplication()
// app.launch()
// let tabBarsQuery = app.tabBars
// tabBarsQuery.buttons["Games"].tap()
// app.buttons["More Info"].tap()
// app.sheets.buttons["Ok"].tap()
// tabBarsQuery.buttons["Player"].tap()
// app.collectionViews.cells.otherElements.containing(.image, identifier:"hawks").element.tap()
// app.navigationBars["Ballin.TeamDetailView"].buttons["Back"].tap()
// let cellsQuery = app.collectionViews.cells
// cellsQuery.otherElements.containing(.image, identifier:"david").element.tap()
// app.children(matching: .window).element(boundBy: 0).children(matching: .other).element.children(matching: .other).element.children(matching: .other).element.children(matching: .other).element.children(matching: .other).element.children(matching: .other).element.children(matching: .other).element(boundBy: 0).children(matching: .other).element.children(matching: .collectionView).element.tap()
//
// tabBarsQuery.buttons["Team"].tap()
// cellsQuery.otherElements.containing(.image, identifier:"rockets").element.tap()
// XCUIDevice.shared.orientation = .landscapeRight
// tabBarsQuery.buttons["Games"].tap()
// app.buttons["Button"].tap()
let app = XCUIApplication()
app.buttons["More Info"].tap()
let tablesQuery = app.tables
tablesQuery.children(matching: .cell).element(boundBy: 1).staticTexts["Location: Laverton\nhome score: 100 \nAway score: 120"].swipeUp()
tablesQuery.children(matching: .cell).element(boundBy: 6).staticTexts["22.09.2019 23:36"].swipeUp()
let tabBarsQuery = app.tabBars
tabBarsQuery.buttons["Team"].tap()
let cellsQuery = app.collectionViews.cells
let nuggetsElement = cellsQuery.otherElements.containing(.image, identifier:"nuggets").element
nuggetsElement.swipeUp()
let backButton = app.navigationBars["Ballin.TeamDetailView"].buttons["Back"]
backButton.tap()
nuggetsElement.swipeUp()
backButton.tap()
let element = app.children(matching: .window).element(boundBy: 0).children(matching: .other).element.children(matching: .other).element.children(matching: .other).element.children(matching: .other).element.children(matching: .other).element.children(matching: .other).element.children(matching: .other).element
element.children(matching: .collectionView).element.swipeUp()
XCUIDevice.shared.orientation = .landscapeRight
cellsQuery.otherElements.containing(.image, identifier:"thunder").element.swipeLeft()
element.swipeLeft()
element.swipeLeft()
backButton.tap()
XCUIDevice.shared.orientation = .portrait
tabBarsQuery.buttons["Profile"].tap()
cellsQuery.otherElements.containing(.image, identifier:"huzaifa").element.swipeUp()
app.navigationBars["Profile Details"].buttons["Back"].tap()
tabBarsQuery.buttons["Player"].tap()
tablesQuery/*@START_MENU_TOKEN@*/.staticTexts["Milwaukee Bucks"]/*[[".cells.staticTexts[\"Milwaukee Bucks\"]",".staticTexts[\"Milwaukee Bucks\"]"],[[[-1,1],[-1,0]]],[0]]@END_MENU_TOKEN@*/.tap()
XCUIDevice.shared.orientation = .landscapeRight
app.navigationBars["Player Details"].buttons["Back"].tap()
XCUIDevice.shared.orientation = .portrait
}
}
| [
-1
] |
5c9118174e31828bcb8011ea7cf3a09ca2fcd4e6 | 8a5cbc89c22e336f0d1c37f0bbd884bace4d76fb | /SuperCrash/IndexViewController.swift | 25871814858b441f35dac2b053aaf613074ce22c | [] | no_license | oneway4545885/SpecialEffects | 33578df5052e17ac7230edbfabfb44c009716183 | 55a86fc1aebe1f1af25c703501216132082eb15c | refs/heads/master | 2020-07-09T13:16:10.439537 | 2019-08-29T08:11:45 | 2019-08-29T08:11:45 | 203,977,634 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 6,318 | swift | //
// IndexViewController.swift
// SuperCrash
//
// Created by 王偉 on 2017/1/5.
// Copyright © 2017年 王偉. All rights reserved.
//
import UIKit
import SpriteKit
extension SKNode {
class func unarchiveFromFile(_ file : NSString) -> SKNode? {
guard let path = Bundle.main.path(forResource: file as String, ofType: "sks") else {
return nil
}
do {
let sceneData = try Data(contentsOf: URL(fileURLWithPath: path), options: .mappedIfSafe)
let archiver = NSKeyedUnarchiver(forReadingWith: sceneData)
archiver.setClass(self.classForKeyedUnarchiver(), forClassName: "SKScene")
let scene = archiver.decodeObject(forKey: NSKeyedArchiveRootObjectKey) as! GameScene
archiver.finishDecoding()
return scene
}
catch {
print("Can't unarchive the scene.")
return nil
}
}
}
class IndexViewController: UIViewController {
let mode = arc4random()%2
var flakeLayer:CAEmitterLayer!
var unitColor:UIColor!
@IBOutlet weak var labelVersion: UILabel!
@IBOutlet weak var labelTitle: UILabel!
@IBOutlet weak var labelSubTitle: UILabel!
@IBOutlet weak var btnStart: UIButton!
@IBOutlet weak var viewTitle: UIView!
override func viewDidLoad() {
super.viewDidLoad()
let data = OpenClass.shared
data.screenWidth = self.view.bounds.width
data.screenHeight = self.view.bounds.height
self.view.backgroundColor = .black
switch mode {
// Thunder
case 0:
self.lightningEffect()
self.labelVersion.text = "THUNDER"
unitColor = .yellow
self.changeStyle(color: .yellow)
break
// Snow
case 1:
self.setFlakeLayer(view:self.view)
self.labelVersion.text = "ICE"
unitColor = UIColor.init(red:(210/255.0), green: (210/255.0), blue: (210/255.0), alpha: 1)
self.changeStyle(color:UIColor.init(red:(210/255.0), green: (210/255.0), blue: (210/255.0), alpha: 1))
break
case 2:
break
default:
break
}
}
// MARK: 打雷模式
func lightningEffect(){
if let scene = GameScene.unarchiveFromFile("GameScene") as? GameScene {
let skView = SKView(frame: self.view.bounds)
skView.ignoresSiblingOrder = true
scene.scaleMode = .aspectFill
skView.presentScene(scene)
self.view.addSubview(skView)
self.view.bringSubviewToFront(self.btnStart)
self.view.bringSubviewToFront(self.viewTitle)
self.view.bringSubviewToFront(self.labelVersion)
}
}
// MARK: 下雪模式
func setFlakeLayer(view:UIView){
flakeLayer = CAEmitterLayer()
let bounds = UIScreen.main.bounds
// 發射位置
flakeLayer.emitterPosition = CGPoint(x:bounds.width/2, y: -10)
// 發射源尺寸大小
flakeLayer.emitterSize = CGSize(width:bounds.width * 2.0,height:0.0)
// 發射模式
flakeLayer.emitterShape = CAEmitterLayerEmitterShape.line
flakeLayer.emitterMode = CAEmitterLayerEmitterMode.outline
flakeLayer.emitterCells = NSArray.init(object:self.flakeCell()) as? [CAEmitterCell]
view.layer.insertSublayer(flakeLayer, at: 0)
}
func flakeCell() -> CAEmitterCell {
let flakeCell = CAEmitterCell()
// 粒子圖片
flakeCell.contents = UIImage(named:"flake")?.cgImage
// 粒子生成速率
flakeCell.birthRate = 10
// 粒子生命週期
flakeCell.lifetime = 120.0
flakeCell.lifetimeRange = 0.5
// 速度設置
flakeCell.velocity = -5
flakeCell.velocityRange = 10
flakeCell.yAcceleration = 10
flakeCell.emissionLongitude = -CGFloat.pi/2.0
flakeCell.emissionRange = CGFloat.pi/4
flakeCell.spinRange = 0.25 * CGFloat.pi
flakeCell.scale = 0.5
flakeCell.scaleSpeed = 0.1
flakeCell.scaleRange = 1.0
// 顏色設定
// flakeCell.color = UIColor(colorLiteralRed:1, green:1, blue:1, alpha:1).cgColor
// flakeCell.redRange = 1.0
// flakeCell.redSpeed = 0.1
// flakeCell.blueRange = 1.0
// flakeCell.blueSpeed = 0.1
// flakeCell.greenRange = 1.0
// flakeCell.greenSpeed = 0.1
flakeCell.alphaSpeed = -0.08
return flakeCell
}
//
@IBAction func btn_Start(_ sender: Any) {
let vc = self.storyboard?.instantiateViewController(withIdentifier: "tapBoxVC") as! TapBoxViewController
vc.color = unitColor
self.present(vc, animated: false, completion: nil)
}
// MARK: change style
func changeStyle(color:UIColor){
self.labelVersion.textColor = color
self.labelTitle.textColor = color
self.labelSubTitle.textColor = color
self.btnStart.setTitleColor(color, for:.normal)
self.shineBtn(color:.white)
}
func shineBtn(color:UIColor){
UIView.animate(withDuration:1, delay: 0, options:.repeat, animations:{
self.btnStart.titleLabel?.layer.shadowColor = color.cgColor
self.btnStart.titleLabel?.layer.shadowRadius = 2.0;
self.btnStart.titleLabel?.layer.shadowOpacity = 0.9;
self.btnStart.titleLabel?.layer.shadowOffset = CGSize.zero;
self.btnStart.titleLabel?.layer.masksToBounds = false;
self.shineText(label:self.labelTitle, color: color)
self.shineText(label:self.labelSubTitle, color: color)
self.shineText(label:self.labelVersion, color: color)
}, completion:{ bool in
})
}
func shineText(label:UILabel,color:UIColor){
label.layer.shadowColor = color.cgColor
label.layer.shadowRadius = 2.0;
label.layer.shadowOpacity = 0.9;
label.layer.shadowOffset = CGSize.zero;
label.layer.masksToBounds = false;
}
}
| [
-1
] |
0ce7d6e5f1dd744b75469a9c641c7a30d03a576d | e7d248f0457daabb2f0cc6e9cd94958d91f91032 | /6rb/View/SentTextChatTableViewCell.swift | 2b02993777b87172a0e1fea40c87c72d18501140 | [] | no_license | bluekey630/6rb | 0e2a5e423905acbe9435ec7f5c2209c57f4edfdb | 63b98d5682cb2993c0d40eff4981c3a0e040dcc5 | refs/heads/main | 2023-07-09T10:22:19.504555 | 2021-08-10T15:01:36 | 2021-08-10T15:01:36 | 394,692,477 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,173 | swift | //
// SentTextChatTableViewCell.swift
// 6rb
//
// Created by PCH-37 on 2019/8/23.
// Copyright © 2019 6rb. All rights reserved.
//
import UIKit
class SentTextChatTableViewCell: UITableViewCell {
@IBOutlet weak var lblMessage: UILabel!
@IBOutlet weak var imgBubble: UIImageView!
@IBOutlet weak var imgAvatar: UIImageView!
@IBOutlet weak var lblName: UILabel!
@IBOutlet weak var lblTime: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
changeImage("bubble_sent")
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
func changeImage(_ name: String) {
guard let image = UIImage(named: name) else { return }
imgBubble.image = image
.resizableImage(withCapInsets:
UIEdgeInsets(top: 17, left: 21, bottom: 17, right: 21),
resizingMode: .stretch)
.withRenderingMode(.alwaysTemplate)
imgBubble.tintColor = UIColor(red: 207/255, green: 255/255, blue: 189/255, alpha: 1)
}
}
| [
-1
] |
8c7cbaa41c269b10f4343025a0adbadc97afe639 | 2601d9d664fbd042fd1bac2c6e819915402142f5 | /submodules/BrowserUI/Sources/BrowserSearchBarComponent.swift | df776d64d2c20a9dab8f2af7e6ce2b95a2e094be | [] | no_license | TelegramOrg/Telegram-iOS | 42ee56feadc910475cbdfc4a39a5dbeddf2bdde2 | c4ec7cf628fdf899a09fff03ea663e12ecba44f7 | refs/heads/master | 2023-08-31T10:23:14.591652 | 2023-08-18T20:08:55 | 2023-08-18T20:10:24 | 157,783,472 | 42 | 36 | null | 2018-11-15T23:02:36 | 2018-11-15T23:02:36 | null | UTF-8 | Swift | false | false | 15,337 | swift | import Foundation
import UIKit
import AsyncDisplayKit
import Display
import ComponentFlow
import TelegramPresentationData
import AccountContext
import BundleIconComponent
final class SearchBarContentComponent: Component {
let theme: PresentationTheme
let strings: PresentationStrings
let performAction: ActionSlot<BrowserScreen.Action>
init(
theme: PresentationTheme,
strings: PresentationStrings,
performAction: ActionSlot<BrowserScreen.Action>
) {
self.theme = theme
self.strings = strings
self.performAction = performAction
}
static func ==(lhs: SearchBarContentComponent, rhs: SearchBarContentComponent) -> Bool {
if lhs.theme !== rhs.theme {
return false
}
if lhs.strings !== rhs.strings {
return false
}
return true
}
final class View: UIView, UITextFieldDelegate {
private final class EmojiSearchTextField: UITextField {
override func textRect(forBounds bounds: CGRect) -> CGRect {
return bounds.integral
}
}
private struct Params: Equatable {
var theme: PresentationTheme
var strings: PresentationStrings
var size: CGSize
static func ==(lhs: Params, rhs: Params) -> Bool {
if lhs.theme !== rhs.theme {
return false
}
if lhs.strings !== rhs.strings {
return false
}
if lhs.size != rhs.size {
return false
}
return true
}
}
private let activated: (Bool) -> Void = { _ in }
private let deactivated: (Bool) -> Void = { _ in }
private let updateQuery: (String?) -> Void = { _ in }
private let backgroundLayer: SimpleLayer
private let iconView: UIImageView
private let clearIconView: UIImageView
private let clearIconButton: HighlightTrackingButton
private let cancelButtonTitle: ComponentView<Empty>
private let cancelButton: HighlightTrackingButton
private var placeholderContent = ComponentView<Empty>()
private var textFrame: CGRect?
private var textField: EmojiSearchTextField?
private var tapRecognizer: UITapGestureRecognizer?
private var params: Params?
private var component: SearchBarContentComponent?
public var wantsDisplayBelowKeyboard: Bool {
return self.textField != nil
}
init() {
self.backgroundLayer = SimpleLayer()
self.iconView = UIImageView()
self.clearIconView = UIImageView()
self.clearIconButton = HighlightableButton()
self.clearIconView.isHidden = true
self.clearIconButton.isHidden = true
self.cancelButtonTitle = ComponentView()
self.cancelButton = HighlightTrackingButton()
super.init(frame: CGRect())
self.layer.addSublayer(self.backgroundLayer)
self.addSubview(self.iconView)
self.addSubview(self.clearIconView)
self.addSubview(self.clearIconButton)
self.addSubview(self.cancelButton)
self.clipsToBounds = true
let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector(self.tapGesture(_:)))
self.tapRecognizer = tapRecognizer
self.addGestureRecognizer(tapRecognizer)
self.cancelButton.highligthedChanged = { [weak self] highlighted in
if let strongSelf = self {
if highlighted {
if let cancelButtonTitleView = strongSelf.cancelButtonTitle.view {
cancelButtonTitleView.layer.removeAnimation(forKey: "opacity")
cancelButtonTitleView.alpha = 0.4
}
} else {
if let cancelButtonTitleView = strongSelf.cancelButtonTitle.view {
cancelButtonTitleView.alpha = 1.0
cancelButtonTitleView.layer.animateAlpha(from: 0.4, to: 1.0, duration: 0.2)
}
}
}
}
self.cancelButton.addTarget(self, action: #selector(self.cancelPressed), for: .touchUpInside)
self.clearIconButton.highligthedChanged = { [weak self] highlighted in
if let strongSelf = self {
if highlighted {
strongSelf.clearIconView.layer.removeAnimation(forKey: "opacity")
strongSelf.clearIconView.alpha = 0.4
} else {
strongSelf.clearIconView.alpha = 1.0
strongSelf.clearIconView.layer.animateAlpha(from: 0.4, to: 1.0, duration: 0.2)
}
}
}
self.clearIconButton.addTarget(self, action: #selector(self.clearPressed), for: .touchUpInside)
}
required public init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
@objc private func tapGesture(_ recognizer: UITapGestureRecognizer) {
if case .ended = recognizer.state {
self.activateTextInput()
}
}
private func activateTextInput() {
if self.textField == nil, let textFrame = self.textFrame {
let backgroundFrame = self.backgroundLayer.frame
let textFieldFrame = CGRect(origin: CGPoint(x: textFrame.minX, y: backgroundFrame.minY), size: CGSize(width: backgroundFrame.maxX - textFrame.minX, height: backgroundFrame.height))
let textField = EmojiSearchTextField(frame: textFieldFrame)
textField.autocorrectionType = .no
textField.returnKeyType = .search
self.textField = textField
self.insertSubview(textField, belowSubview: self.clearIconView)
textField.delegate = self
textField.addTarget(self, action: #selector(self.textFieldChanged(_:)), for: .editingChanged)
}
guard !(self.textField?.isFirstResponder ?? false) else {
return
}
self.activated(true)
self.textField?.becomeFirstResponder()
}
@objc private func cancelPressed() {
self.updateQuery(nil)
self.clearIconView.isHidden = true
self.clearIconButton.isHidden = true
let textField = self.textField
self.textField = nil
self.deactivated(textField?.isFirstResponder ?? false)
self.component?.performAction.invoke(.updateSearchActive(false))
if let textField {
textField.resignFirstResponder()
textField.removeFromSuperview()
}
}
@objc private func clearPressed() {
self.updateQuery(nil)
self.textField?.text = ""
self.clearIconView.isHidden = true
self.clearIconButton.isHidden = true
}
func deactivate() {
if let text = self.textField?.text, !text.isEmpty {
self.textField?.endEditing(true)
} else {
self.cancelPressed()
}
}
public func textFieldDidBeginEditing(_ textField: UITextField) {
}
public func textFieldDidEndEditing(_ textField: UITextField) {
}
public func textFieldShouldReturn(_ textField: UITextField) -> Bool {
textField.endEditing(true)
return false
}
@objc private func textFieldChanged(_ textField: UITextField) {
let text = textField.text ?? ""
self.clearIconView.isHidden = text.isEmpty
self.clearIconButton.isHidden = text.isEmpty
self.placeholderContent.view?.isHidden = !text.isEmpty
self.updateQuery(text)
self.component?.performAction.invoke(.updateSearchQuery(text))
if let params = self.params {
self.update(theme: params.theme, strings: params.strings, size: params.size, transition: .immediate)
}
}
func update(component: SearchBarContentComponent, availableSize: CGSize, transition: Transition) -> CGSize {
self.component = component
self.update(theme: component.theme, strings: component.strings, size: availableSize, transition: transition)
self.activateTextInput()
return availableSize
}
public func update(theme: PresentationTheme, strings: PresentationStrings, size: CGSize, transition: Transition) {
let params = Params(
theme: theme,
strings: strings,
size: size
)
if self.params == params {
return
}
let isActiveWithText = true
if self.params?.theme !== theme {
self.iconView.image = generateTintedImage(image: UIImage(bundleImageName: "Components/Search Bar/Loupe"), color: .white)?.withRenderingMode(.alwaysTemplate)
self.iconView.tintColor = theme.rootController.navigationSearchBar.inputIconColor
self.clearIconView.image = generateTintedImage(image: UIImage(bundleImageName: "Components/Search Bar/Clear"), color: .white)?.withRenderingMode(.alwaysTemplate)
self.clearIconView.tintColor = theme.rootController.navigationSearchBar.inputClearButtonColor
}
self.params = params
let sideInset: CGFloat = 10.0
let inputHeight: CGFloat = 36.0
let topInset: CGFloat = (size.height - inputHeight) / 2.0
let sideTextInset: CGFloat = sideInset + 4.0 + 17.0
self.backgroundLayer.backgroundColor = theme.rootController.navigationSearchBar.inputFillColor.cgColor
self.backgroundLayer.cornerRadius = 10.5
let cancelTextSize = self.cancelButtonTitle.update(
transition: .immediate,
component: AnyComponent(Text(
text: strings.Common_Cancel,
font: Font.regular(17.0),
color: theme.rootController.navigationBar.primaryTextColor
)),
environment: {},
containerSize: CGSize(width: size.width - 32.0, height: 100.0)
)
let cancelButtonSpacing: CGFloat = 8.0
var backgroundFrame = CGRect(origin: CGPoint(x: sideInset, y: topInset), size: CGSize(width: size.width - sideInset * 2.0, height: inputHeight))
if isActiveWithText {
backgroundFrame.size.width -= cancelTextSize.width + cancelButtonSpacing
}
transition.setFrame(layer: self.backgroundLayer, frame: backgroundFrame)
transition.setFrame(view: self.cancelButton, frame: CGRect(origin: CGPoint(x: backgroundFrame.maxX, y: 0.0), size: CGSize(width: cancelButtonSpacing + cancelTextSize.width, height: size.height)))
let textX: CGFloat = backgroundFrame.minX + sideTextInset
let textFrame = CGRect(origin: CGPoint(x: textX, y: backgroundFrame.minY), size: CGSize(width: backgroundFrame.maxX - textX, height: backgroundFrame.height))
self.textFrame = textFrame
if let image = self.iconView.image {
let iconFrame = CGRect(origin: CGPoint(x: backgroundFrame.minX + 5.0, y: backgroundFrame.minY + floor((backgroundFrame.height - image.size.height) / 2.0)), size: image.size)
transition.setFrame(view: self.iconView, frame: iconFrame)
}
let placeholderSize = self.placeholderContent.update(
transition: transition,
component: AnyComponent(
Text(text: strings.Common_Search, font: Font.regular(17.0), color: theme.rootController.navigationSearchBar.inputPlaceholderTextColor)
),
environment: {},
containerSize: size
)
if let placeholderContentView = self.placeholderContent.view {
if placeholderContentView.superview == nil {
self.addSubview(placeholderContentView)
}
let placeholderContentFrame = CGRect(origin: CGPoint(x: textFrame.minX, y: backgroundFrame.midY - placeholderSize.height / 2.0), size: placeholderSize)
transition.setFrame(view: placeholderContentView, frame: placeholderContentFrame)
}
if let image = self.clearIconView.image {
let iconFrame = CGRect(origin: CGPoint(x: backgroundFrame.maxX - image.size.width - 4.0, y: backgroundFrame.minY + floor((backgroundFrame.height - image.size.height) / 2.0)), size: image.size)
transition.setFrame(view: self.clearIconView, frame: iconFrame)
transition.setFrame(view: self.clearIconButton, frame: iconFrame.insetBy(dx: -8.0, dy: -10.0))
}
if let cancelButtonTitleComponentView = self.cancelButtonTitle.view {
if cancelButtonTitleComponentView.superview == nil {
self.addSubview(cancelButtonTitleComponentView)
cancelButtonTitleComponentView.isUserInteractionEnabled = false
}
transition.setFrame(view: cancelButtonTitleComponentView, frame: CGRect(origin: CGPoint(x: backgroundFrame.maxX + cancelButtonSpacing, y: floor((size.height - cancelTextSize.height) / 2.0)), size: cancelTextSize))
}
if let textField = self.textField {
textField.textColor = theme.rootController.navigationSearchBar.inputTextColor
transition.setFrame(view: textField, frame: CGRect(origin: CGPoint(x: backgroundFrame.minX + sideTextInset, y: backgroundFrame.minY - UIScreenPixel), size: CGSize(width: backgroundFrame.width - sideTextInset - 32.0, height: backgroundFrame.height)))
}
}
}
func makeView() -> View {
return View()
}
func update(view: View, availableSize: CGSize, state: EmptyComponentState, environment: Environment<Empty>, transition: Transition) -> CGSize {
return view.update(component: self, availableSize: availableSize, transition: transition)
}
}
| [
-1
] |
9c51acbf3f75526c739ec1998b087be64b4ed3b2 | 2ee28d6b8e1fd7f57758adb4b874c258f718d773 | /Prancercise Tracker/WorkoutDataStore.swift | 572c49da7b894e74eec28921dd9b08a0b0081a0e | [] | no_license | ukcs485gFall18/midterm1-peer_training | 23083ebfdeba098e1c20215695d0d23a427b0121 | 109d8f0c1dd6241266c51b039f11a3674e6265da | refs/heads/master | 2020-03-29T00:30:14.137017 | 2018-10-09T16:58:33 | 2018-10-09T16:58:33 | 149,342,407 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 9,962 | swift | /**
* Copyright (c) 2017 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.
*
* 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 HealthKit
class WorkoutDataStore {
class func save(prancerciseWorkout: PrancerciseWorkout,
completion: @escaping ((Bool, Error?) -> Swift.Void)) {
// Set up the calorie quantity for the total energy burned
let calorieQuantity = HKQuantity(unit: HKUnit.kilocalorie(), doubleValue: prancerciseWorkout.totalEnergyBurned)
// Build the workout using data from your Prancercise workout
let workout = HKWorkout(activityType: .other, start: prancerciseWorkout.start, end: prancerciseWorkout.end, duration: prancerciseWorkout.duration, totalEnergyBurned: calorieQuantity, totalDistance: nil, device: HKDevice.local(), metadata: nil)
// Save workout to HealthKit
let healthStore = HKHealthStore()
let samples = self.samples(for: prancerciseWorkout)
healthStore.save(workout){ (success, error) in
guard error == nil else{
completion(false, error)
return
}
healthStore.add(samples, to: workout, completion: { (samples, error) in
guard error == nil else{
completion(false, error)
return
}
completion(true, nil)
})
}
}
private class func samples(for workout: PrancerciseWorkout) -> [HKSample]{
var samples = [HKSample]()
// Verify that the energy quantity type is still available to HealthKit
guard let energyQuantityType = HKSampleType.quantityType(forIdentifier: HKQuantityTypeIdentifier.activeEnergyBurned) else{
fatalError("Energy Burned Type is not available.")
}
// Create a sample for each PrancerciseWorkoutInterval
for interval in workout.intervals{
let calorieQuantity = HKQuantity(unit: HKUnit.kilocalorie(), doubleValue: interval.totalEnergyBurned)
let sample = HKQuantitySample(type: energyQuantityType, quantity: calorieQuantity, start: interval.start, end: interval.end)
samples.append(sample)
}
return samples
}
class func loadPrancerciseWorkouts(completion: @escaping (([HKWorkout]?, Error?) -> Swift.Void)){
// Get workouts using Other activity type
let workoutPredicate = HKQuery.predicateForWorkouts(with: .other)
// Get workouts from the Prancercise App
let sourcePredicate = HKQuery.predicateForObjects(from: HKSource.default())
// combine into a single predicate
let compound = NSCompoundPredicate(andPredicateWithSubpredicates: [workoutPredicate, sourcePredicate])
let sortDescriptor = NSSortDescriptor(key: HKSampleSortIdentifierEndDate, ascending: true)
let query = HKSampleQuery(sampleType: HKObjectType.workoutType(), predicate: compound, limit: 0, sortDescriptors: [sortDescriptor]) { (query, samples, error) in
DispatchQueue.main.async {
// Cast samples as HKWorkout
guard let samples = samples as? [HKWorkout], error == nil else{
completion(nil, error)
return
}
completion(samples, nil)
}
}
HKHealthStore().execute(query)
}
// The code below was added by Bryan Willis
class func saveRun(runningWorkout: RunningWorkout, completion: @escaping ((Bool, Error?) -> Swift.Void)) {
// Set up the calorie quantity for the total energy burned
let calorieQuantity = HKQuantity(unit: HKUnit.kilocalorie(), doubleValue: runningWorkout.totalEnergyBurned)
let workout = HKWorkout(activityType: .running, start: runningWorkout.end, end: runningWorkout.end, duration: runningWorkout.duration, totalEnergyBurned: calorieQuantity, totalDistance: nil, device: HKDevice.local(), metadata: nil)
// Save workout to HealthKit
let healthStore = HKHealthStore()
let samples = self.samples(for: runningWorkout)
healthStore.save(workout){ (success, error) in
guard error == nil else{
completion(false, error)
return
}
healthStore.add(samples, to: workout, completion: { (samples, error) in
guard error == nil else{
completion(false, error)
return
}
completion(true, nil)
})
}
}
/*
Retrieve ActivitySummaries from HealthKit - SQLoBue
This function sets a start date and an end date, and then converts those dates into date components
for use in HKQuery/HKActivitySummary Query.
*/
class func readActivitySummaries(completion: @escaping (([HKActivitySummary]?, Error?) -> Swift.Void)){
// set the date range for the query, currently hard coded for one week
guard let calendar = NSCalendar(identifier: .gregorian) else{
fatalError("Note: this is not expected to fail.")
}
let endDate = NSDate()
guard let startDate = calendar.date(byAdding: .day, value: -7, to: endDate as Date, options: []) else{
fatalError("Error calculating start date.")
}
// rebuild dates as date components
let units : NSCalendar.Unit = [.day, .month, .year, .era]
var startDateComps = calendar.components(units , from: startDate)
var endDateComps = calendar.components(units , from: endDate as Date)
startDateComps.calendar = calendar as Calendar
endDateComps.calendar = calendar as Calendar
// set datePredicate for query
let datePredicate = HKQuery.predicate(forActivitySummariesBetweenStart: startDateComps, end: endDateComps)
// build query
let query = HKActivitySummaryQuery(predicate: datePredicate) { (query, summaries, error) in
DispatchQueue.main.async {
// Cast samples as ActivitySummaries
guard let summaries = summaries, error == nil else{
completion(nil, error)
return
}
completion(summaries, nil)
}
}
HKHealthStore().execute(query)
}
private class func samples(for runningWorkout: RunningWorkout) -> [HKSample]{
var samples = [HKSample]()
// Verify that the energy quantity type is still available to HealthKit
guard let energyQuantityType = HKSampleType.quantityType(forIdentifier: HKQuantityTypeIdentifier.activeEnergyBurned) else{
fatalError("Energy Burned Type is not available")
}
// Create a sample for each RunningWorkout Interval
for interval in runningWorkout.intervals{
let calorieQuantity = HKQuantity(unit: HKUnit.kilocalorie(), doubleValue: interval.totalEnergyBurned)
let sample = HKQuantitySample(type: energyQuantityType, quantity: calorieQuantity, start: interval.start, end: interval.end)
samples.append(sample)
}
return samples
}
class func loadRunningWorkouts(completion: @escaping (([HKWorkout]?, Error?) -> Swift.Void)){
//Get workouts using .running activity type
let workoutPredicate = HKQuery.predicateForWorkouts(with: .running)
// Get workouts from the application
let sourcePredicate = HKQuery.predicateForObjects(from: HKSource.default())
// combine into a single predicate =
let compound = NSCompoundPredicate(andPredicateWithSubpredicates: [workoutPredicate, sourcePredicate])
let sortDescriptor = NSSortDescriptor(key: HKSampleSortIdentifierEndDate, ascending: true)
let query = HKSampleQuery(sampleType: HKObjectType.workoutType(), predicate: compound, limit: 0, sortDescriptors: [sortDescriptor]) { (query, samples, error) in
DispatchQueue.main.async {
// Cast samples as HKWorkout
guard let samples = samples as? [HKWorkout], error == nil else{
completion(nil, error)
return
}
completion(samples, nil)
}
}
HKHealthStore().execute(query)
}
}
| [
-1
] |
a8f4ea836a14da4d207d25f8de7aea08efb5d0bd | 2583a630c26798ab64ce5df6878aff684451e29a | /Tastebuds/SceneDelegate.swift | f424808a8610d444aaaf49514a8aadf358290c26 | [] | no_license | CODEDHQ/tastebuds | 486f71a4eb328fa9e8f1b34acce102be0a121f29 | bd3d6eda5a01d4cc75687c27a102b52766ae13dc | refs/heads/master | 2020-09-27T09:35:52.798212 | 2019-12-07T09:24:42 | 2019-12-07T09:24:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,339 | swift | //
// SceneDelegate.swift
// Tastebuds
//
// Created by iForsan on 12/6/19.
// Copyright © 2019 iForsan. 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,
385714,
434868,
164535,
336568,
164539,
328379,
328387,
352969,
418508,
385743,
385749,
189154,
369382,
361196,
418555,
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,
386070,
271382,
336922,
345119,
377888,
328747,
214060,
345134,
345139,
361525,
361537,
377931,
197708,
189525,
156762,
402523,
361568,
148580,
345200,
361591,
386168,
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,
214594,
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,
345916,
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,
256214,
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,
395567,
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,
256787,
363294,
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,
347178,
404526,
396337,
330803,
396340,
339002,
388155,
339010,
347208,
248905,
330827,
330830,
248915,
183384,
339037,
412765,
257121,
322660,
265321,
330869,
248952,
420985,
330886,
330890,
347288,
248986,
44199,
380071,
339118,
249018,
339133,
126148,
322763,
330959,
330966,
265433,
265438,
388320,
363757,
388348,
339199,
396552,
175376,
175397,
208167,
273709,
372016,
437553,
347442,
199989,
175416,
396601,
208189,
437567,
175425,
437571,
437576,
437584,
331089,
437588,
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,
405017,
134689,
339504,
265779,
421442,
413251,
265796,
265806,
224854,
224858,
339553,
257636,
224871,
372328,
257647,
372338,
339572,
224885,
224888,
224891,
224895,
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,
225448,
438441,
225451,
258223,
225456,
430257,
225459,
225462,
225468,
389309,
225472,
372931,
225476,
389322,
225485,
225488,
225491,
266454,
225494,
225497,
225500,
225503,
225506,
356580,
225511,
217319,
225515,
225519,
381177,
397572,
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,
250203,
332130,
250211,
340328,
250217,
348523,
348528,
332153,
356734,
389503,
332158,
438657,
332162,
389507,
348548,
356741,
250239,
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,
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,
398246,
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,
211161,
350426,
334047,
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,
358973,
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,
351382,
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
] |
0a7f52ebe9264f8cc30ab33217c323573dc8f1e4 | 7ab40420f17b3c93a49cc67fb68cfe828cbfb0bc | /iDineSwiftUI/OrderView.swift | 3aef1aaea31e8fc75b8a24ddb228ab7099567d11 | [] | no_license | haoict/iDineSwiftUI | fe093755b593559f01432cf2151e19c0f0f721e0 | ecd613ae041056e6720c3fe0e038056c00c14604 | refs/heads/master | 2022-11-13T03:05:04.075823 | 2020-07-08T06:53:47 | 2020-07-08T06:53:47 | 278,013,317 | 2 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,555 | swift | //
// OrderView.swift
// NextDictSwift
//
// Created by Nguyen, Hao | Hao | ECMD on 2020/07/08.
// Copyright © 2020 Hao Nguyen. All rights reserved.
//
import SwiftUI
struct OrderView: View {
@EnvironmentObject var order: Order
@State private var showingDeleteConfirmAlert = false
@State private var deleteOrderOffset: IndexSet?
var body: some View {
NavigationView {
List {
Section {
ForEach(order.items) { item in
HStack {
Text(item.name)
Spacer()
Text("$\(item.price)")
}
}.onDelete(perform: deleteItems)
}
Section {
NavigationLink(destination: CheckoutView()) {
Text("Place Order")
}
}.disabled(order.items.isEmpty)
}
.navigationBarTitle("Order")
.listStyle(GroupedListStyle())
.navigationBarItems(trailing: EditButton())
.alert(isPresented:$showingDeleteConfirmAlert) {
Alert(title: Text("Are you sure you want to delete this?"), message: Text("There is no undo"), primaryButton: .destructive(Text("Delete")) {
self.order.items.remove(atOffsets: self.deleteOrderOffset!)
}, secondaryButton: .cancel())
}
}
}
func deleteItems(at offsets: IndexSet) {
self.deleteOrderOffset = offsets
self.showingDeleteConfirmAlert = true
}
}
struct OrderView_Previews: PreviewProvider {
static let order = Order()
static var previews: some View {
OrderView().environmentObject(order)
}
}
| [
-1
] |
db1d4a5521ab5b46ffe98a4bc9534c75e3e75406 | 1130f75ea4973ca7e10f4af5e45356d3b6642445 | /OnTheHouse/UserAddressViewController.swift | 537b2f5a088b02fae8c9fb9b6599cecd535b40cb | [] | no_license | shailendrasajwan/OnTheHouse | 620dbc8ae80d6d3c55d529ce7e86d91228c2540d | baaee4418cd0fc5018d5786163a94ee8477fb02c | refs/heads/master | 2021-01-13T03:37:21.985687 | 2017-01-17T03:13:41 | 2017-01-17T03:13:41 | 77,306,401 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,499 | swift | //
// UserAddressViewController.swift
// OnTheHouse
//
// Created by Mitul Manish on 12/08/2016.
// Copyright © 2016 Mitul Manish. All rights reserved.
//
import UIKit
class UserAddressViewController: UIViewController, UIPickerViewDataSource, UIPickerViewDelegate, UITextFieldDelegate {
@IBOutlet weak var countryPickerView: UIPickerView!
@IBOutlet weak var statePickerView: UIPickerView!
@IBOutlet weak var pinCodeTextField: UITextField!
var pickerData: [String] = []
let statePickerDelegate = StatePickerDelegate()
override func viewDidLoad() {
super.viewDidLoad()
print("did load")
configureCountryPicker()
configureStatePicker()
configurePinCodeTextField()
}
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(true)
print("will appear")
self.countryPickerView.selectRow(12, inComponent: 0, animated: true)
self.statePickerView.selectRow(6, inComponent: 0, animated: true)
}
private func configurePinCodeTextField() {
pinCodeTextField.delegate = self
pinCodeTextField.text = ""
}
private func configureStatePicker() {
statePickerView.delegate = statePickerDelegate
statePickerView.dataSource = statePickerDelegate
self.statePickerView.selectRow(6, inComponent: 0, animated: true)
}
private func configureCountryPicker() {
countryPickerView.delegate = self
countryPickerView.dataSource = self
OTHService.sharedInstance.getDataFromOTH("countries") { (dictionary) in
self.pickerData = DataFormatter.getListOfCountries(dictionary)
self.countryPickerView.reloadAllComponents()
self.countryPickerView.selectRow(12, inComponent: 0, animated: true)
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction private func backToPreviousPage() {
self.dismissViewControllerAnimated(true, completion: nil)
}
override func prefersStatusBarHidden() -> Bool {
return true
}
func numberOfComponentsInPickerView(pickerView: UIPickerView) -> Int {
return 1
}
func pickerView(pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
return pickerData.count
}
//MARK: Delegates
func pickerView(pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
return pickerData[row]
}
func pickerView(pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
let countryCode = row + 1
OTHService.sharedInstance.getDataFromOTH("zones/\(countryCode)") { (dictionary) in
self.statePickerDelegate.pickerData = DataFormatter.getListOfStatesByCountryID(dictionary)
self.statePickerView.reloadAllComponents()
}
}
func textFieldShouldReturn(textField: UITextField) -> Bool {
textField.resignFirstResponder()
return true
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
NewMemberData.countryID = String(countryPickerView.selectedRowInComponent(0)+1)
NewMemberData.zoneID = String(statePickerView.selectedRowInComponent(0)+1)
NewMemberData.zip = String(pinCodeTextField.text!)
}
}
| [
-1
] |
2a3b7cfc1c53d8f6c61e5c4bfb367b253cb27992 | 8e70d7e05ae88727f13eae60bf934458a8d554de | /WorldFlags/SceneDelegate.swift | b0e744248bf398311ac4c9aa3649c850129ee3de | [] | no_license | reshetnikd/WorldFlags | 052a71c2df697f96a71a406749db16226b7d2248 | aacb5831ea17c7f7fbd2e92f9e9b4d57599b0411 | refs/heads/master | 2021-02-02T02:47:00.248228 | 2020-03-04T16:20:42 | 2020-03-04T16:20:42 | 243,525,631 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,385 | swift | //
// SceneDelegate.swift
// WorldFlags
//
// Created by Dmitry Reshetnik on 27.02.2020.
// Copyright © 2020 Dmitry Reshetnik. All rights reserved.
//
import UIKit
@available(iOS 13.0, *)
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,
393277,
376906,
327757,
254032,
368728,
254045,
180322,
376932,
286845,
286851,
417925,
262284,
360598,
377003,
377013,
164029,
327872,
180418,
377037,
377047,
418008,
418012,
377063,
327915,
205037,
393457,
393461,
393466,
418044,
385281,
262405,
180491,
336140,
262417,
368913,
262423,
377118,
377121,
262437,
254253,
336181,
262455,
393539,
262473,
344404,
213333,
418135,
270687,
262497,
418145,
262501,
213354,
246124,
262508,
262512,
213374,
385420,
262551,
262553,
385441,
262567,
385452,
262574,
393649,
385460,
262587,
344512,
262593,
360917,
369119,
328180,
328183,
328190,
254463,
328193,
328207,
410129,
393748,
377372,
188959,
385571,
377384,
197160,
33322,
352822,
270905,
197178,
418364,
188990,
369224,
270922,
352844,
385617,
352865,
262761,
352875,
344694,
352888,
336513,
377473,
385671,
148106,
377485,
352919,
98969,
344745,
361130,
336556,
385714,
434868,
164535,
164539,
328379,
328387,
352969,
418508,
385743,
385749,
189154,
369382,
361196,
418555,
344832,
336644,
344837,
344843,
328462,
361231,
394002,
336660,
418581,
418586,
434971,
369436,
262943,
369439,
418591,
418594,
336676,
418600,
418606,
369464,
361274,
328516,
336709,
328520,
336712,
361289,
328523,
336715,
361300,
213848,
426842,
361307,
197469,
361310,
361318,
344936,
361323,
361335,
328574,
369544,
361361,
222129,
345036,
386004,
345046,
386023,
328690,
435188,
328703,
328710,
418822,
377867,
328715,
386070,
336922,
345119,
377888,
214060,
345134,
345139,
361525,
361537,
377931,
189525,
402523,
361568,
148580,
345200,
361591,
386168,
361594,
410746,
214150,
345224,
386187,
345247,
361645,
337072,
345268,
402615,
361657,
402636,
328925,
165086,
165092,
328933,
222438,
328942,
386292,
206084,
328967,
345377,
345380,
353572,
345383,
263464,
337207,
345400,
378170,
369979,
386366,
337230,
337235,
263509,
353634,
337252,
402792,
271731,
337278,
271746,
181639,
353674,
181644,
361869,
181650,
181655,
230810,
181671,
181674,
181679,
181682,
337330,
181687,
370105,
181691,
181697,
361922,
337350,
181704,
337366,
271841,
329192,
361961,
329195,
116211,
337399,
402943,
337416,
329227,
419341,
419345,
329234,
419351,
345626,
419357,
345631,
419360,
370208,
394787,
419363,
370214,
419369,
394796,
419377,
419386,
214594,
419401,
353868,
419404,
173648,
419408,
214611,
419412,
403040,
345702,
370298,
353920,
403076,
345737,
198282,
403085,
403092,
345750,
419484,
345758,
345763,
419492,
345766,
419498,
419502,
370351,
419507,
337588,
419510,
419513,
403139,
337607,
419528,
419531,
272083,
394967,
419543,
419545,
345819,
419548,
419551,
345829,
419560,
337643,
419564,
337647,
370416,
337671,
362249,
362252,
395022,
362256,
321300,
345888,
362274,
378664,
354107,
345916,
354112,
370504,
329545,
345932,
370510,
247639,
337751,
370520,
313181,
182110,
354143,
354157,
345965,
345968,
345971,
345975,
403321,
1914,
354173,
395148,
247692,
337809,
247701,
436127,
436133,
247720,
337834,
362414,
337845,
190393,
247760,
346064,
346069,
329699,
354275,
190440,
354314,
346140,
436290,
395340,
378956,
436307,
338005,
100454,
329833,
329853,
329857,
329868,
411806,
329886,
346273,
362661,
100525,
387250,
379067,
387261,
256193,
395467,
346317,
411862,
256214,
411865,
411869,
411874,
379108,
411877,
387303,
346344,
395496,
338154,
387307,
346350,
338161,
436474,
379135,
411905,
411917,
379154,
395539,
387350,
387353,
338201,
338212,
395567,
248112,
362823,
436556,
321880,
362844,
379234,
354674,
321911,
420237,
379279,
272787,
354728,
338353,
338382,
272849,
248279,
256474,
182755,
338404,
338411,
248309,
248332,
330254,
199189,
420377,
330268,
191012,
330320,
199250,
191069,
346722,
248427,
338544,
191093,
346743,
346769,
150184,
248505,
363198,
223936,
355025,
273109,
264919,
338665,
264942,
363252,
338680,
264965,
338701,
256787,
363294,
396067,
346917,
396070,
215854,
355123,
355141,
355144,
338764,
330581,
330585,
387929,
355167,
265056,
265059,
355176,
355180,
355185,
330612,
412600,
207809,
379849,
347082,
396246,
330711,
248794,
248799,
347106,
437219,
257009,
265208,
199681,
338951,
330761,
330769,
330775,
248863,
396329,
347178,
404526,
396337,
330803,
396340,
339002,
388155,
339010,
347208,
248905,
330827,
248915,
183384,
339037,
412765,
257121,
265321,
248952,
420985,
330890,
347288,
248986,
44199,
380071,
339118,
249018,
339133,
126148,
330959,
330966,
265433,
265438,
388320,
363757,
388348,
339199,
396552,
175376,
175397,
273709,
372016,
437553,
347442,
199989,
175416,
396601,
208189,
437567,
175425,
437571,
437576,
437584,
437588,
396634,
175451,
437596,
429408,
175458,
175461,
175464,
265581,
331124,
175478,
175487,
249215,
175491,
249219,
249225,
249228,
249235,
175514,
175517,
396703,
396706,
175523,
355749,
396723,
388543,
380353,
216518,
380364,
339406,
372177,
339414,
249303,
413143,
339418,
339421,
249310,
339425,
249313,
339429,
339435,
249329,
69114,
372229,
208399,
175637,
405017,
134689,
265779,
421442,
413251,
265796,
265806,
224854,
224858,
339553,
257636,
224871,
372328,
257647,
372338,
224885,
224888,
224891,
224895,
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,
257805,
225039,
257808,
249617,
225044,
167701,
372500,
257815,
225049,
257820,
225054,
184096,
397089,
257825,
225059,
339748,
225068,
257837,
413485,
225071,
225074,
225077,
257846,
225080,
397113,
225083,
397116,
257853,
225088,
225094,
225097,
257869,
257872,
225105,
397140,
225109,
225113,
257881,
257884,
257887,
225120,
257891,
225128,
257897,
225138,
225142,
257914,
257917,
225150,
257922,
380803,
225156,
339845,
257927,
225166,
397201,
225171,
380823,
225176,
225183,
184245,
372698,
372704,
372707,
356336,
380919,
393215,
372739,
405534,
266295,
266298,
421961,
200786,
356440,
217180,
430181,
266351,
356467,
266365,
192640,
266375,
381069,
225425,
250003,
225430,
250008,
356507,
250012,
225439,
135328,
192674,
225442,
438434,
225445,
225448,
438441,
225451,
258223,
225456,
430257,
225459,
225462,
225468,
389309,
225472,
225476,
389322,
225485,
225488,
225491,
266454,
225494,
225497,
225500,
225503,
225506,
225511,
217319,
225515,
225519,
381177,
397572,
389381,
381212,
356638,
356641,
356644,
356647,
266537,
389417,
356650,
356656,
332081,
340276,
356662,
397623,
332091,
225599,
348489,
332107,
151884,
430422,
348503,
332118,
250211,
340328,
250217,
348523,
348528,
332153,
356734,
389503,
332158,
438657,
332162,
389507,
348548,
356741,
332175,
160152,
373146,
373149,
70048,
356783,
266688,
324032,
201158,
127473,
217590,
340473,
324095,
324100,
324103,
324112,
340501,
324118,
324122,
340512,
332325,
324134,
381483,
356908,
324141,
324143,
356917,
324150,
324156,
168509,
348734,
324161,
324165,
356935,
348745,
381513,
324171,
324174,
324177,
389724,
332381,
373344,
340580,
348777,
381546,
340628,
184983,
373399,
258723,
332455,
332460,
332464,
332473,
381626,
332484,
332487,
332494,
357070,
357074,
332512,
340724,
332534,
348926,
389927,
348979,
398141,
357202,
389971,
357208,
389979,
430940,
357212,
357215,
439138,
349041,
340850,
381815,
430967,
324473,
398202,
340859,
324476,
430973,
119675,
324479,
340863,
324482,
324485,
324488,
185226,
381834,
324493,
324496,
324499,
430996,
324502,
324511,
422817,
324514,
201638,
398246,
373672,
324525,
111539,
324534,
324539,
324542,
398280,
349129,
340942,
209874,
340958,
431073,
398307,
340964,
209896,
201712,
209904,
349173,
381947,
201724,
349181,
431100,
431107,
349203,
209944,
209948,
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,
160896,
349313,
152704,
210053,
210056,
349320,
259217,
373905,
210068,
210072,
210078,
210081,
210085,
210089,
210096,
210100,
324792,
210108,
357571,
210116,
210128,
333010,
210132,
333016,
210139,
210144,
218355,
218361,
275709,
128254,
275713,
242947,
275717,
275723,
333075,
349460,
349486,
349492,
415034,
210261,
365912,
259423,
374113,
251236,
374118,
390518,
357756,
374161,
112021,
349591,
357793,
333222,
259516,
415168,
366035,
415187,
366039,
415192,
415194,
415197,
415200,
333285,
415208,
366057,
366064,
415217,
210422,
415225,
423424,
415258,
415264,
366118,
415271,
382503,
349739,
144940,
415279,
415282,
415286,
210488,
415291,
415295,
333396,
333400,
366173,
423529,
423533,
210547,
415354,
333440,
267910,
267929,
333472,
259789,
366301,
333535,
366308,
366312,
431852,
399086,
366319,
210673,
366322,
399092,
366326,
333566,
268042,
210700,
366349,
210707,
399129,
333595,
210720,
366384,
358192,
210740,
366388,
358201,
325441,
366403,
325447,
341831,
341839,
341844,
415574,
358235,
350046,
399200,
399208,
268144,
358256,
358260,
399222,
325494,
186233,
333690,
325505,
399244,
333709,
333725,
333737,
382891,
382898,
358348,
333777,
219094,
399318,
358372,
153572,
350190,
350194,
333819,
350204,
350207,
325633,
325637,
350214,
333838,
350225,
350232,
333851,
350238,
350241,
374819,
350245,
350249,
350252,
178221,
350257,
350260,
350272,
243782,
350281,
350286,
374865,
252021,
342134,
374904,
268435,
333998,
334012,
260299,
211161,
375027,
358645,
268553,
268560,
432406,
325920,
358701,
391469,
358705,
358714,
358717,
383307,
358738,
383331,
383334,
391531,
383342,
334204,
268669,
194942,
391564,
366991,
334224,
342431,
375209,
334263,
326087,
358857,
195041,
334306,
334312,
104940,
375279,
162289,
350724,
186898,
342546,
350740,
342551,
342555,
416294,
350762,
252463,
358962,
334397,
358973,
252483,
219719,
399957,
334425,
326240,
375401,
334466,
334469,
162446,
342680,
342685,
260767,
342711,
244410,
260798,
334530,
260802,
350918,
154318,
342737,
391895,
154329,
416476,
64231,
113389,
203508,
375541,
342777,
391938,
391949,
375569,
375572,
375575,
375580,
162592,
334633,
326444,
383794,
375613,
244542,
375616,
342857,
416599,
342875,
244572,
433001,
400238,
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,
261109,
261112,
244728,
383999,
261130,
261148,
359452,
261155,
261160,
261166,
359471,
375868,
384099,
384102,
384108,
367724,
187503,
343155,
384115,
212095,
384136,
384140,
384144,
351382,
384152,
384158,
384161,
351399,
384169,
367795,
384182,
384189,
384192,
351424,
343232,
367817,
244938,
384202,
253132,
384209,
146644,
351450,
384225,
359650,
343272,
351467,
359660,
384247,
351480,
384250,
351483,
351492,
384270,
359695,
261391,
253202,
261395,
384276,
384284,
245021,
384290,
253218,
245032,
171304,
384299,
351535,
245042,
326970,
384324,
212296,
367966,
343394,
367981,
343410,
155000,
327035,
245121,
245128,
253321,
155021,
384398,
245137,
245143,
245146,
245149,
245152,
245155,
155045,
245158,
114093,
327090,
343478,
359867,
384444,
327108,
327112,
384457,
359887,
359891,
368093,
155103,
343535,
343540,
368120,
409092,
359948,
359951,
245295,
359984,
400977,
400982,
179803,
155255,
155274,
368289,
245410,
425639,
425652,
425663,
155328,
245463,
155352,
155356,
155364,
245477,
155372,
245487,
212723,
409336,
155394,
155404,
245528,
155423,
360224,
155439,
204592,
155444,
155448,
417596,
384829,
360262,
155463,
155477,
376665,
155484,
261982,
425823,
155488,
376672,
155492,
327532,
261997,
376686,
262000,
262003,
425846,
262006,
147319,
262009,
327542,
262012,
155517,
155523,
155526,
360327,
376715,
155532,
262028,
262031,
262034,
262037,
262040,
262043,
155550,
262046,
253854,
262049,
262052,
327590,
155560,
155563,
155566,
327613,
393152,
393170,
155604,
155620,
253924,
155622,
253927,
327655,
360432,
393204,
360439,
253944,
393209,
155647
] |
f4f5add11f4f1bbb3a32e5e3fb2034166c55e39e | d2b56c7fefb35e3305669c3b1528621f576110cd | /NPO Live/Controller/PlayerViewController.swift | 70fc8f2aec5275c4ade58a44665fa748d06eca59 | [
"MIT"
] | permissive | hollanderbart/NPO-Live | 3f41f9e73d8b6e04fa592a95d680d42a2bf58f79 | 6c46cb8480e5ced4c8a0b70bcfe2e8bc87643a52 | refs/heads/master | 2021-09-11T08:27:29.616459 | 2018-04-03T08:19:04 | 2018-04-06T11:16:49 | 109,369,954 | 7 | 2 | MIT | 2018-04-04T07:33:15 | 2017-11-03T08:15:52 | Swift | UTF-8 | Swift | false | false | 1,173 | swift | import UIKit
import AVKit
import NPOStream
class PlayerViewController: AVPlayerViewController {
var channel: Channel!
lazy var metadataItem: AVMutableMetadataItem = {
let logoMetadataItem = AVMutableMetadataItem()
logoMetadataItem.locale = Locale.current
logoMetadataItem.key = AVMetadataKey.commonKeyArtwork as NSCopying & NSObjectProtocol
logoMetadataItem.keySpace = AVMetadataKeySpace.common
return logoMetadataItem
}()
override func viewDidLoad() {
super.viewDidLoad()
guard let url = channel.url else { return }
let playerItem = AVPlayerItem(url: url)
if
let image = UIImage(named: channel.title),
let imagePNGData = UIImagePNGRepresentation(image) {
metadataItem.value = imagePNGData as NSCopying & NSObjectProtocol
playerItem.externalMetadata.append(metadataItem)
metadataItem.value = channel.title as NSCopying & NSObjectProtocol
playerItem.externalMetadata.append(metadataItem)
}
player = AVPlayer(playerItem: playerItem)
player?.play()
}
}
| [
-1
] |
10ee4eb8b677bf567c9e6e00bd52d77b8c2ff760 | 3725269d9b17a3271d375c3c1c439d2f12ed3ca3 | /myMealsTests/Controller/FoodItemListDataProviderTests.swift | b267a38b6eaa383d89021fd46ce92672bba7e94e | [] | no_license | drollig8/myMeals | a7cd4a7e2b660b225ecdc15e7868342c8fb3e672 | 22c88a98bae822f659ceb7b78db0b1effadcdd59 | refs/heads/master | 2021-01-10T12:19:06.077402 | 2016-03-01T13:13:00 | 2016-03-01T13:13:00 | 51,657,543 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,495 | swift | //
// FoodItemListDataProviderTests.swift
// myMeals
//
// Created by Marc Felden on 29.02.16.
// Copyright © 2016 madeTK.com. All rights reserved.
//
import XCTest
@testable import myMeals
class FoodItemListDataProviderTests: XCTestCase
{
var sut: FoodItemListDataProvider!
var tableView: UITableView!
var controller: FoodItemListViewController!
override func setUp()
{
super.setUp()
let storyboad = UIStoryboard(name: "Main", bundle: nil)
controller = storyboad.instantiateViewControllerWithIdentifier("FoodItemListViewController") as! FoodItemListViewController
sut = FoodItemListDataProvider()
_ = controller.view
tableView = controller.tableView
tableView.dataSource = sut
}
override func tearDown()
{
super.tearDown()
}
func testNumberOfSections_IsOne()
{
let section = tableView.numberOfSections
XCTAssertTrue(section == 1,"We want One Sections") // LogEntries have 6
}
// add itemManager Property to DataProvider
func testNumberOfRowsInFirstSection_IsFoodItemCount()
{
sut.foodItemManager = FoodItemManager()
sut.foodItemManager.addItem(FoodItem(name: "Test"))
print(sut.foodItemManager)
XCTAssertEqual(sut.tableView(tableView, numberOfRowsInSection: 0), 1, "")
}
/*
Zitat:
At this point, it is not clear who is going to set the item manager to itemManager. We will decide this in a later chapter when we put all the modules together to form a complete app. For the test, we will set itemManager in them.
*/
func testRow_ReturnsItemCell()
{
sut.foodItemManager = FoodItemManager()
sut.foodItemManager.addItem(FoodItem(name: "Test"))
tableView.reloadData()
let cell = tableView.cellForRowAtIndexPath(NSIndexPath(forItem: 0, inSection: 0))
XCTAssertTrue(cell is FoodItemCell)
}
func testCellForRow_DequeuesCell()
{
let mockTableView = MockTableView()
mockTableView.dataSource = sut
mockTableView.registerClass(FoodItemCell.self, forCellReuseIdentifier: "Cell")
sut.foodItemManager = FoodItemManager()
sut.foodItemManager.addItem(FoodItem(name: "Test"))
mockTableView.reloadData()
_ = mockTableView.cellForRowAtIndexPath(NSIndexPath(forItem: 0, inSection: 0))
XCTAssertTrue(mockTableView.cellGotDequeued)
}
func testConfigCell_GetsCalledInCellForRow()
{
let mockTableView = MockTableView(frame: CGRect(x: 0, y: 0, width: 320, height: 460), style: .Plain)
mockTableView.dataSource = sut
mockTableView.registerClass(MockFoodItemCell.self, forCellReuseIdentifier: "Cell")
sut.foodItemManager = FoodItemManager()
let foodItem = FoodItem(name: "Test")
sut.foodItemManager.addItem(foodItem)
mockTableView.reloadData()
let cell = mockTableView.cellForRowAtIndexPath(NSIndexPath(forItem: 0, inSection: 0)) as! MockFoodItemCell!
XCTAssertEqual(cell.foodItem, foodItem)
}
func testSelectingACell_SendsNotification()
{
let item = FoodItem(name: "First")
sut.foodItemManager?.addItem(item)
expectationForNotification("ItemSelectedNotification",
object: nil) { (notification) -> Bool in
guard let index = notification.userInfo?["index"] as? Int else { return false }
return index == 0
}
tableView.delegate?.tableView!(tableView, didSelectRowAtIndexPath: NSIndexPath(forRow: 0, inSection: 0))
waitForExpectationsWithTimeout(3, handler: nil)
}
}
extension FoodItemListDataProviderTests
{
class MockTableView: UITableView
{
var cellGotDequeued = false
override func dequeueReusableCellWithIdentifier(identifier: String, forIndexPath indexPath: NSIndexPath) -> UITableViewCell {
cellGotDequeued = true
return super.dequeueReusableCellWithIdentifier(identifier, forIndexPath: indexPath)
}
}
class MockFoodItemCell: FoodItemCell
{
var foodItem: FoodItem?
override func configCellWithItem(foodItem: FoodItem) {
self.foodItem = foodItem
}
}
}
| [
-1
] |
68abd2c29f73115b6c500f03849be425c2a202c6 | b376dc91ce39f2e2499cc2b319a27550fd9f2b7c | /WeatherAppSwiftUI/WeatherAppSwiftUIUITests/WeatherAppSwiftUIUITests.swift | ed76b35676dad64487bd931a8729d54bec09e3f4 | [] | no_license | Grzegorz1337/PUA-Swift | e33e14fce586579e402e54790d9c497221b21e56 | 4b00586f94fa789eb26c0e58232664d2c67407ca | refs/heads/master | 2023-07-16T00:23:14.734853 | 2021-09-09T15:19:41 | 2021-09-09T15:19:41 | 390,365,248 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,452 | swift | //
// WeatherAppSwiftUIUITests.swift
// WeatherAppSwiftUIUITests
//
// Created by Kamil Grzeczkowski on 30/07/2021.
//
import XCTest
class WeatherAppSwiftUIUITests: XCTestCase {
override func setUpWithError() throws {
// Put setup code here. This method is called before the invocation of each test method in the class.
// In UI tests it is usually best to stop immediately when a failure occurs.
continueAfterFailure = false
// In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
}
override func tearDownWithError() throws {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testExample() throws {
// UI tests must launch the application that they test.
let app = XCUIApplication()
app.launch()
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testLaunchPerformance() throws {
if #available(macOS 10.15, iOS 13.0, tvOS 13.0, *) {
// This measures how long it takes to launch your application.
measure(metrics: [XCTApplicationLaunchMetric()]) {
XCUIApplication().launch()
}
}
}
}
| [
274432,
372736,
415744,
182277,
354310,
354311,
403463,
43016,
354312,
436235,
399372,
346117,
360463,
419857,
153618,
358418,
376853,
436248,
178215,
430120,
346153,
344106,
253996,
430127,
405552,
272432,
403507,
378933,
163894,
358455,
378934,
249912,
352314,
385078,
436283,
32829,
376892,
225347,
352324,
436293,
403524,
352327,
385095,
399433,
163916,
368717,
333902,
436304,
176209,
329812,
381013,
53334,
254039,
104534,
411738,
426074,
368732,
272477,
356446,
438374,
32871,
176231,
352359,
438378,
221292,
395373,
385135,
422000,
432241,
376945,
249976,
266361,
385147,
127840,
346237,
374913,
374914,
422020,
381061,
168070,
168069,
415883,
426124,
381071,
333968,
436372,
196758,
430231,
200856,
49308,
422044,
192670,
192671,
378186,
65698,
362658,
49317,
258213,
333990,
377008,
377010,
104633,
266427,
260285,
268479,
377025,
395458,
133313,
356550,
338118,
374984,
377033,
164043,
417996,
254157,
436429,
346319,
372943,
266447,
368849,
368850,
139478,
258263,
385240,
254171,
379102,
147679,
147680,
334049,
356575,
387299,
268515,
18661,
379110,
383208,
205034,
254189,
149743,
379120,
254193,
260338,
372979,
436466,
260337,
381173,
395511,
436471,
135416,
411892,
344312,
356603,
436480,
375040,
260355,
147716,
272644,
266504,
385291,
338188,
368908,
338187,
180494,
375052,
325904,
395536,
262419,
254228,
272661,
368915,
338196,
379157,
61720,
381210,
178459,
377116,
389406,
338217,
254250,
358698,
260396,
325930,
418095,
438575,
336177,
358707,
332084,
178485,
180534,
368949,
438583,
362809,
379193,
358710,
127292,
155968,
268609,
438592,
395591,
270663,
368969,
383309,
254285,
180559,
377168,
344402,
348499,
348501,
368982,
389465,
272730,
436570,
383327,
215395,
366948,
383338,
110955,
270703,
362864,
160111,
354672,
272755,
250227,
354678,
432503,
438653,
432511,
385407,
385409,
436609,
266628,
395653,
340356,
436613,
395660,
106893,
270733,
385423,
264591,
420241,
225684,
373141,
252309,
373144,
385433,
213402,
39323,
385437,
389534,
397732,
254373,
436644,
385448,
385449,
375211,
115116,
272815,
436659,
129461,
342454,
385463,
338359,
358844,
336319,
326083,
336323,
436677,
188870,
416201,
129484,
154061,
373196,
262619,
256476,
377309,
377310,
184799,
432608,
369121,
369124,
391654,
270823,
420326,
432616,
334315,
213486,
360945,
375281,
139766,
393719,
254459,
410108,
410109,
262657,
377346,
324098,
166403,
377352,
334345,
340489,
410126,
393745,
397841,
385554,
342549,
420374,
254487,
258584,
410138,
188957,
397855,
416288,
385569,
342560,
348709,
348710,
350759,
350758,
358951,
358952,
385578,
197166,
393775,
418352,
397872,
219694,
330291,
219695,
438512,
33339,
266812,
340539,
352831,
33344,
385603,
348741,
381515,
385612,
375373,
416334,
426575,
348748,
385620,
416340,
369236,
244311,
430681,
270938,
332379,
191065,
436831,
416353,
260705,
375396,
268901,
184938,
373357,
184942,
176751,
389744,
420461,
346739,
346741,
352886,
352885,
356984,
344697,
356983,
209529,
244345,
420473,
356990,
422529,
373377,
152196,
166533,
369285,
348807,
385669,
201348,
356999,
344714,
356998,
375438,
377487,
326288,
336531,
363155,
346771,
426646,
264855,
180886,
352921,
363161,
377499,
275102,
344737,
436897,
176805,
340645,
422567,
176810,
352938,
418479,
383668,
164532,
160441,
342714,
377531,
355006,
377534,
377536,
422591,
39616,
385737,
135888,
385745,
369365,
369366,
385751,
361178,
363228,
352989,
352990,
383708,
436957,
264929,
295649,
385763,
338658,
418529,
436960,
369383,
361194,
346859,
269036,
330476,
373485,
373486,
432883,
21239,
203511,
275193,
348921,
342775,
383740,
344829,
432894,
359166,
375552,
133889,
197377,
162559,
35584,
430853,
346889,
383755,
430860,
326413,
62222,
434956,
418579,
197398,
207639,
426777,
326428,
363295,
344864,
430880,
197412,
336678,
342827,
355117,
189229,
328495,
197424,
152372,
191285,
197428,
336693,
377656,
160569,
355129,
426809,
197433,
430909,
273209,
273211,
355136,
160576,
355138,
416577,
377669,
348999,
420680,
355147,
355148,
197451,
369488,
355153,
385878,
387927,
385880,
244569,
363354,
363353,
197467,
375644,
252766,
381791,
435038,
420702,
363362,
357219,
412516,
355173,
355174,
385895,
342888,
439145,
363361,
197479,
207724,
385901,
355182,
351078,
207728,
197489,
420722,
381811,
201590,
392057,
164730,
211835,
398205,
336765,
340865,
260995,
254851,
369541,
330627,
392071,
172936,
387977,
424842,
396171,
349066,
349068,
252812,
400271,
355216,
381840,
224146,
390034,
392080,
224149,
256918,
256919,
256920,
430999,
377754,
400282,
7070,
211871,
381856,
185252,
359332,
359333,
398244,
256934,
422825,
140203,
172971,
326571,
252848,
381872,
377778,
326580,
261045,
261046,
273336,
326586,
398268,
273341,
377789,
330688,
349122,
379845,
363462,
359365,
273353,
373705,
127945,
211913,
345034,
342990,
252878,
433104,
359380,
418774,
386007,
433112,
433116,
359391,
207839,
398305,
340960,
347104,
386016,
340967,
123880,
398313,
418793,
187372,
412653,
343020,
257007,
383980,
435185,
222193,
347122,
248815,
127990,
271351,
349176,
201721,
383994,
349179,
435195,
437245,
328701,
257023,
125953,
171009,
386049,
357380,
384004,
396292,
410629,
189448,
328705,
330759,
377863,
418819,
347150,
361487,
433166,
435216,
330766,
384015,
386068,
433173,
254997,
326684,
252959,
384031,
336928,
398370,
336930,
357413,
330789,
248871,
375848,
410665,
357420,
345137,
361522,
412725,
386108,
410687,
257093,
398405,
261191,
404550,
377927,
218187,
250955,
361547,
250965,
339031,
156763,
375902,
375903,
392288,
439391,
361570,
253028,
257126,
214119,
404582,
250982,
402538,
396395,
265323,
404589,
62574,
357487,
173168,
187505,
138354,
273523,
398444,
119925,
351343,
377974,
349304,
363643,
66684,
392317,
343166,
384127,
248960,
392320,
377986,
349315,
349317,
402568,
363658,
140426,
373902,
386191,
224400,
326803,
410772,
359574,
265366,
347286,
429209,
222364,
351389,
339101,
418975,
429216,
265381,
380069,
124073,
367791,
367792,
373937,
373939,
367798,
402618,
421050,
339131,
218301,
343230,
367809,
265410,
183492,
253124,
113863,
402632,
259275,
402641,
419028,
259285,
351445,
357594,
339167,
222441,
414956,
421102,
253168,
386288,
66802,
351475,
251124,
271607,
386296,
363769,
369913,
419066,
386300,
369912,
412926,
52473,
386304,
351489,
437504,
52476,
439550,
369929,
439563,
414989,
349458,
380178,
429332,
259346,
259347,
367897,
367898,
245018,
115997,
222496,
382243,
412963,
382246,
257323,
369964,
353581,
116014,
130347,
273713,
382257,
345397,
382264,
212282,
386363,
333115,
193853,
347451,
359747,
359748,
257353,
257354,
337226,
251212,
353611,
406862,
353612,
259408,
437585,
353617,
331091,
150868,
378201,
374110,
372064,
429410,
437602,
114022,
253288,
388458,
265579,
163190,
421240,
382329,
384379,
357758,
357763,
253316,
384391,
388488,
263561,
353672,
370066,
9618,
411028,
112019,
398740,
370072,
396697,
253339,
253340,
343457,
148900,
396709,
245160,
333224,
374189,
380335,
355761,
251314,
359860,
359861,
421302,
343480,
259513,
134586,
380348,
380350,
216511,
216510,
54719,
200136,
273865,
361928,
339403,
425417,
372172,
337359,
329168,
413138,
327122,
353751,
425434,
437726,
429540,
3557,
361958,
3559,
271850,
271853,
411119,
116209,
259569,
251379,
253431,
386551,
359931,
398844,
210429,
375610,
216575,
343552,
366081,
372226,
271880,
198155,
359949,
208397,
329231,
253456,
413202,
253462,
388630,
370200,
175640,
431646,
349727,
146976,
216610,
157219,
157220,
372261,
394793,
245290,
245291,
347693,
431662,
323120,
396850,
200245,
323126,
343606,
163385,
210489,
134715,
421437,
425534,
235069,
138817,
396865,
147011,
413255,
265800,
273992,
147020,
128589,
421452,
333389,
265809,
333394,
353875,
349780,
396885,
265816,
396889,
179800,
196184,
343646,
396896,
155238,
415334,
388712,
388713,
204394,
271980,
138862,
206447,
54895,
403057,
188021,
366198,
42616,
339579,
337533,
210558,
210559,
415360,
396927,
370307,
419462,
149127,
149128,
415369,
419464,
214667,
224907,
431754,
210569,
415376,
405140,
274071,
425624,
345753,
259741,
208547,
153252,
405157,
208548,
388775,
245413,
210601,
364202,
255651,
399014,
202413,
421556,
384693,
376502,
224951,
337590,
224952,
370359,
415419,
409277,
259780,
409289,
267978,
403149,
425682,
333522,
345813,
370390,
272087,
224985,
245471,
155360,
325345,
159462,
337638,
181992,
345832,
372458,
345835,
333543,
141037,
325357,
397040,
212721,
12017,
431861,
163575,
274170,
175874,
161539,
173828,
360194,
249606,
395018,
395019,
409355,
155408,
372497,
395026,
366358,
169751,
435993,
345882,
421657,
431901,
341791,
339746,
255781,
257831,
167720,
362281,
378666,
399148,
202541,
431918,
153392,
403248,
421680,
378673,
345910,
182070,
182071,
384826,
274234,
409404,
436029,
360253,
431935,
415555,
325444,
337734,
339782,
409416,
325449,
323405,
341837,
415566,
272208,
272207,
337746,
431955,
325460,
376661,
341846,
339799,
345942,
368471,
345950,
362336,
259937,
382820,
255844,
368486,
384871,
415592,
40809,
368489,
409446,
425832,
214894,
362351,
274288,
372592,
214896,
325491,
417648,
341878,
276343,
274296,
333687,
417658,
350072,
360315,
112510,
182145,
253828,
325508,
243590,
333700,
350091,
350092,
372625,
425875,
350102,
337816,
253851,
329627,
376733,
350108,
333727,
354210,
436130,
118693,
436135,
10153,
438186,
362411,
253868,
370604,
362418,
128955,
188349,
151492,
362442,
380874,
346066,
212947,
212953,
372699,
354268,
436189,
403421,
219102,
329696,
354273,
403425,
360416,
6116,
354279,
436199,
253930,
354283,
174058,
337899,
380910,
247787,
247786,
436209,
432114,
385011,
380922,
380923,
415740,
268286
] |
b98b5c1bf889933a6963bda189f098642a7a2c91 | 9ec3e5568491ffc166e04214233d188544e5a62b | /Drifter/Line.swift | b9dccca64cfbc9b61567c05eb0851dce23c87d12 | [
"MIT"
] | permissive | voudeonibus/vdb-ios | b59092bb78a74a940864c52276b88046f27c3796 | 00c3ad01a4b9e919be86be94a75f51319034f3fb | refs/heads/master | 2021-01-10T01:31:11.431628 | 2016-03-09T04:14:08 | 2016-03-09T04:14:08 | 50,875,832 | 4 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 392 | swift | //
// Line.swift
// Drifter
//
// Created by Lucas da Silva on 2/1/16.
// Copyright © 2016 Vou de ônibus. All rights reserved.
//
import Foundation
import RealmSwift
class Line: Object {
dynamic var _id = ""
dynamic var route_long_name = ""
dynamic var route_short_name = ""
dynamic var country = ""
dynamic var state = ""
let trips = List<Trip>()
}
| [
-1
] |
e14e0865f1ffdc7944de0f98a43dba10b3def9d4 | 6302040486e54877569b4b21a77bf96241b7e713 | /Tests/ThemeParkIOSTests/ThemeParkIOSTests.swift | 0b8f5fd328ba8de705c74a5db3a140a3c134835f | [
"MIT"
] | permissive | eonist/ThemePark | fe0253367ce5d5cc6f8d337434d056825121fd09 | dc9f5a4bd50d6ac72dcdef7dde775b0666951d33 | refs/heads/master | 2021-06-25T04:03:41.844164 | 2020-10-23T14:14:38 | 2020-10-23T14:14:38 | 143,842,043 | 19 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 312 | swift | import XCTest
class ThemeParkIOSTests: XCTestCase {
override func setUp() {
super.setUp()
}
override func tearDown() {
super.tearDown()
}
func testExample() {
XCTAssertEqual("Hello, World!", "Hello, World!")
}
func testPerformanceExample() {
self.measure { }
}
}
| [
-1
] |
0e463a493f19426f59a418ac4570a3b58cdca8d4 | 7bbda7e9e79f76439cc75a40d12dafc8e5102482 | /DesignApp_iOS/PedalViewController.swift | 8d31d3f237db14e2ffa1b3032eb26e83be05ee18 | [] | no_license | pedrovieira/DesignApp_iOS | ff2d5a36625d655f31099867c7b3f08e7c3a1566 | 878599968506d7755077b4b0b8d3cf51124c2b0d | refs/heads/master | 2020-03-31T10:21:21.886828 | 2018-10-07T01:22:30 | 2018-10-07T01:22:30 | 152,131,688 | 0 | 0 | null | 2018-10-08T19:04:46 | 2018-10-08T19:04:46 | null | UTF-8 | Swift | false | false | 768 | swift | //
// SecondViewController.swift
// first_try
//
// Created by Dan Schmetterling on 9/4/18.
// Copyright © 2018 Dan Schmetterling. All rights reserved.
//
import UIKit
class PedalViewController: UIViewController
{
// label for slider value
@IBOutlet weak var sliderValue: UILabel!
@IBOutlet weak var sliderLabel: UILabel!
@IBOutlet weak var pedalName: UILabel!
// update text field with current value
@IBAction func sliderTime_changed(_ sender: UISlider)
{
let val = floorf(sender.value)
sliderValue.text = String(format: "%.0f", val)
}
override func viewDidLoad() // NOT CALLED BY TAB SWITCH!
{
super.viewDidLoad()
// update title
pedalName.text = currentPedal
}
}
| [
-1
] |
94cb832bab8a832f1296b3ee497b3c401b097ac6 | 674362daf6c7743aba1582d75db1ce947cb57c57 | /OnTheMap/Screens/MapViewController.swift | f87cb04a5c3ffe4579797a3c5d43ca85c4a97774 | [] | no_license | jagtapl/OnTheMap | 42a9b9a392ed7e2c2783b6c912b1af90676ade7e | d8ece58b91f9d3d6de63f283ebea8f971d418719 | refs/heads/master | 2022-05-27T01:03:28.200223 | 2020-04-27T22:02:07 | 2020-04-27T22:02:07 | 259,088,804 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,908 | swift | //
// MapViewController.swift
// OnTheMap
//
// Created by LALIT JAGTAP on 4/22/20.
// Copyright © 2020 LALIT JAGTAP. All rights reserved.
//
import UIKit
import MapKit
class MapViewController: DataLoadingViewController, MKMapViewDelegate {
var students: [StudentInformation] {
return NetworkManager.shared.studentArray
}
@IBOutlet weak var mapView: MKMapView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
getStudents()
}
@IBAction func reloadTapped(_ sender: Any) {
reloadStudents()
}
func reloadStudents() {
// remove from local
var annotations = [StudentAnnotation]()
for std in self.students {
let studentdAnnotation = StudentAnnotation(std)
annotations.append(studentdAnnotation)
}
self.mapView.removeAnnotations(annotations)
// remove from NetworkManager cache
NetworkManager.shared.studentArray.removeAll()
getStudents()
}
func getStudents() {
showLoadingView()
NetworkManager.shared.getLatestStudents() { [weak self] (result) in
guard let self = self else { return }
self.dismissLoadingView()
switch (result) {
case .success(let students):
if students.isEmpty {
self.mapView.isHidden = true
let message = "No student locations data found. Something is wrong."
self.presentAlertOnMainThread(title: "No student data", message: message)
} else {
var annotations = [StudentAnnotation]()
for std in self.students {
let studentdAnnotation = StudentAnnotation(std)
annotations.append(studentdAnnotation)
}
DispatchQueue.main.async {
self.mapView.isHidden = false
self.mapView.addAnnotations(annotations)
self.view.bringSubviewToFront(self.mapView)
}
}
case .failure(let error):
self.presentAlertOnMainThread(title: "No student data", message: error.rawValue)
}
}
}
// MARK: - MKMapViewDelegate
func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
let reuseId = "pin"
var pinView = mapView.dequeueReusableAnnotationView(withIdentifier: reuseId) as? MKPinAnnotationView
if pinView == nil {
pinView = MKPinAnnotationView(annotation: annotation, reuseIdentifier: reuseId)
pinView!.canShowCallout = true
pinView!.pinTintColor = .red
pinView!.rightCalloutAccessoryView = UIButton(type: .detailDisclosure)
}
else {
pinView!.annotation = annotation
}
return pinView
}
func mapView(_ mapView: MKMapView, annotationView view: MKAnnotationView, calloutAccessoryControlTapped control: UIControl) {
if control == view.rightCalloutAccessoryView {
if let mediaURL = view.annotation?.subtitle! {
guard let url = URL(string: mediaURL), (url.scheme != nil) else {
let message = "Student has invalid media url."
presentAlertOnMainThread(title: "Invalid URL", message: message)
return
}
// show media url using Safari VC
presentSafariVC(with: url)
}
}
}
}
| [
-1
] |
b2fc9c529bf706d7b9bdcc7045d88574edd7cf16 | 4ee09b42718623ff6dab1bf031ea5015d3f9eb30 | /ZBApp/Controller/Login/LoginViewController.swift | 8df254703d6e791cddf7d797b5618b5de0314b26 | [] | no_license | JakeyXing/ZBApp | 66f340c999444c314acb0afe5710730491f3cbea | 131f359fac40c67489398eda673ad6306e50090f | refs/heads/master | 2020-03-31T22:25:10.675025 | 2019-03-16T09:37:49 | 2019-03-16T09:37:49 | 152,617,687 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,128 | swift | //
// LoginViewController.swift
// ZBApp
//
// Created by xingjiehai on 2018/10/12.
// Copyright © 2018 ParentsChat. All rights reserved.
//
import UIKit
import BEMCheckBox
import Toast
import MBProgressHUD
class LoginViewController: UIViewController,BEMCheckBoxDelegate {
@IBOutlet weak var showPassLabel: UILabel!
@IBOutlet weak var navTitleLabel: UILabel!
@IBOutlet weak var areaCodeTitleLabel: UILabel!
@IBOutlet weak var areaDropdownView: JHDropdownView!
@IBOutlet weak var phoneTextfield: UITextField!
@IBOutlet weak var passwordTextfield: UITextField!
@IBOutlet weak var checkbox: BEMCheckBox!
@IBOutlet weak var loginButton: UIButton!
@IBOutlet weak var registerButton: UIButton!
@IBOutlet weak var resetPasswordButton: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
self.navigationController?.navigationBar.isHidden = true
self.navTitleLabel.text = LanguageHelper.getString(key: "login.nav.title")
self.areaCodeTitleLabel.text = LanguageHelper.getString(key: "login.pageItem.areaCode")
self.phoneTextfield.placeholder = LanguageHelper.getString(key: "login.pageItem.phone")
self.passwordTextfield.placeholder = LanguageHelper.getString(key: "login.pageItem.password")
self.registerButton.setTitle(LanguageHelper.getString(key: "login.pageItem.register"), for: .normal)
self.resetPasswordButton.setTitle(LanguageHelper.getString(key: "login.pageItem.resetPass"), for: .normal)
self.loginButton.setTitle(LanguageHelper.getString(key: "login.nav.title"), for: .normal)
self.showPassLabel.text = LanguageHelper.getString(key: "login.pageItem.showPassword")
self.checkbox.boxType = BEMBoxType.square
self.checkbox.onFillColor = kTintColorYellow
self.checkbox.onTintColor = kTintColorYellow
self.checkbox.onCheckColor = UIColor.white
self.checkbox.delegate = self
self.areaDropdownView.contentLabel.text = "+86"
self.areaDropdownView.contentLabel.textColor = kFontColorBlack
self.areaDropdownView.dataArray = ["+86","+81","+61"]
self.areaDropdownView.extraTop = 0
}
@IBAction func loginAction(_ sender: Any) {
if self.phoneTextfield.text?.count == 0 {
self.view.makeToast(LanguageHelper.getString(key: "login.pageItem.phoneTip"), duration: 2, position: CSToastPositionCenter)
return
}
if self.passwordTextfield.text?.count == 0 {
self.view.makeToast(LanguageHelper.getString(key: "login.pageItem.passwordTip"), duration: 2, position: CSToastPositionCenter)
return
}
let passMd5 = self.passwordTextfield.text?.md5WithSalt(salt: self.phoneTextfield.text!)
let str:String = self.areaDropdownView.contentLabel.text ?? ""
let countryCode :String = String(str[str.index(str.startIndex, offsetBy: 1)..<str.endIndex])
let params = ["countryCode":countryCode,"phone":self.phoneTextfield.text!,"password":passMd5!]
MBProgressHUD.showAdded(to: self.view, animated: true)
NetWorkManager.shared.loadNoTokenRequest(method: .post, url: LoginUrl, parameters: params as [String : Any], success: { (data) in
MBProgressHUD.hide(for: self.view, animated: true)
let resultDic = data as! Dictionary<String,AnyObject>
let accessToken = resultDic["accessToken"]
let refreshToken = resultDic["refreshToken"]
setAccessToken(token: accessToken as! String)
setRefreshToken(token: refreshToken as! String)
setUserInfo(info: resultDic["data"] as! Dictionary<String, Any>)
let sharedAppdelegate:AppDelegate = UIApplication.shared.delegate as! AppDelegate
if getUserStatus() == .review_pass{
sharedAppdelegate.resetRootController()
}else{
let reply = CertifApplyController()
let naviVC = UINavigationController(rootViewController: reply)
sharedAppdelegate.window?.rootViewController = naviVC
}
}) { (data, errMsg) in
MBProgressHUD.hide(for: self.view, animated: true)
self.view.makeToast(errMsg, duration: 2, position: CSToastPositionCenter)
}
}
@IBAction func registerAction(_ sender: Any) {
let registerVC = RegisterViewController()
self.navigationController?.pushViewController(registerVC, animated: true)
}
@IBAction func resetpasswordAction(_ sender: Any) {
let resetVC = RegisterViewController()
resetVC.pageTitle = "RestPassword"
self.navigationController?.pushViewController(resetVC, animated: true)
}
func didTap(_ checkBox: BEMCheckBox) {
self.passwordTextfield.isSecureTextEntry = !self.checkbox.on
}
}
| [
-1
] |
18caa751285da4c7227bdb91912cf672322f3ca7 | 5cda0d11b59ceaf39080b2051f0e7158b0f639c9 | /test1/AppDelegate.swift | 4a34418c3b982b8fcb8ae8217d5c1a529043568c | [] | no_license | Swarnabh/Todoey-App | 4a285241d0dfb9995e0b2d0fd66e4b03ebb00fa8 | 092c4504bf12785e606e51ef0b29753aac3a4df0 | refs/heads/master | 2020-04-09T12:08:26.433256 | 2018-12-14T10:52:02 | 2018-12-14T10:52:02 | 160,336,728 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,563 | swift | //
// AppDelegate.swift
// test1
//
// Created by BossmediaNT on 04/12/18.
// Copyright © 2018 swarnabh. All rights reserved.
//
import UIKit
import CoreData
import RealmSwift
@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.
print(Realm.Configuration.defaultConfiguration.fileURL)
return true
}
func applicationWillTerminate(_ application: UIApplication) {
self.saveContext()
}
// MARK: - Core Data stack
lazy var persistentContainer: NSPersistentContainer = {
let container = NSPersistentContainer(name: "DataModel")
container.loadPersistentStores(completionHandler: { (storeDescription, error) in
if let error = error as NSError? {
fatalError("Unresolved error \(error), \(error.userInfo)")
}
})
return container
}()
// MARK: - Core Data Saving support
func saveContext () {
let context = persistentContainer.viewContext
if context.hasChanges {
do {
try context.save()
} catch {
let nserror = error as NSError
fatalError("Unresolved error \(nserror), \(nserror.userInfo)")
}
}
}
}
| [
155044,
384007,
155603,
394872,
378847
] |
f71385e15bac0ec863ecea2503cdb4391620a61b | caf2784ee5b0dd81e9ccaa1b23846a5ab5f039a8 | /MarshrouteTests/Sources/PeekAndPopSupport/PeekAndPopUtilityImplTests/PeekAndPopUtilityImplTests_invokesPopAction.swift | afeb5506ea13e678aabddbf8a0a17aabf2f35266 | [
"MIT"
] | permissive | sng1996/Marshroute | 47b4e00dbe7f13560a92a563cf132cd7d82cafc8 | 00be922c507080636f8438af21686499cee9e91c | refs/heads/master | 2021-07-02T22:44:07.012538 | 2017-09-13T08:52:16 | 2017-09-13T08:52:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 8,451 | swift | import XCTest
@testable import Marshroute
final class PeekAndPopUtilityImplTests_invokesPopAction: BasePeekAndPopUtilityImplTestCase {
func testPeekAndPopUtility_invokesPopAction_ifSomeTransitionOccursNotDuringActivePeek() {
// Given
let expectation = self.expectation()
bindSourceViewControllerToWindow()
registerSourceViewControllerForPreviewing()
// When
invokeTransitionToPeekViewController(
popAction: {
expectation.fulfill()
}
)
// Then
waitForExpectations(timeout: asyncTimeout)
}
func testPeekAndPopUtility_invokesPopAction_ifPeekBeginsOnOffscreenRegisteredViewControllerAndSomeTransitionOccurs() {
// Given
let expectation = self.expectation()
unbindSourceViewControllerFromWindow()
registerSourceViewControllerForPreviewing()
// When
beginPeekOnRegisteredViewController()
invokeTransitionToPeekViewController(
popAction: {
expectation.fulfill()
}
)
// Then
waitForExpectations(timeout: asyncTimeout)
}
func testPeekAndPopUtility_invokesPopAction_ifPeekGetsCommitedOnOnscreenRegisteredViewController() {
// Given
let expectation = self.expectation()
bindSourceViewControllerToWindow()
registerSourceViewControllerForPreviewing(
onPeek: { _ in
self.invokeTransitionToPeekViewController(
popAction: {
expectation.fulfill()
}
)
}
)
// When
beginPeekOnRegisteredViewController()
commitPickOnRegisteredViewController()
// Then
waitForExpectations(timeout: asyncTimeout)
}
func testPeekAndPopUtility_invokesPopAction_ifSamePeekFailedToBeginAndNewPeekGetsCommitedOnOnscreenRegisteredViewController() {
// Given
let expectation = self.expectation()
bindSourceViewControllerToWindow()
bindSourceViewController2ToWindow()
registerSourceViewControllerForPreviewing()
registerSourceViewController2ForPreviewing(
onPeek: { _ in
self.invokeTransitionToPeekViewController(
popAction: {
expectation.fulfill()
}
)
}
)
// When
beginPeekOnRegisteredViewController()
beginPeekOnRegisteredViewController2()
commitPickOnRegisteredViewController2()
// Then
waitForExpectations(timeout: asyncTimeout)
}
func testPeekAndPopUtility_invokesNoPopAction_ifPeekBeginsOnOnscreenRegisteredViewController() {
// Given
let invertedExpectation = self.invertedExpectation()
bindSourceViewControllerToWindow()
registerSourceViewControllerForPreviewing(
onPeek: { _ in
self.invokeTransitionToPeekViewController(
popAction: {
invertedExpectation.fulfill()
}
)
}
)
// When
beginPeekOnRegisteredViewController()
// Then
waitForExpectations(timeout: asyncTimeout)
}
func testPeekAndPopUtility_invokesNoPopAction_ifPeekBeginsOnOnscreenRegisteredViewControllerWithNotNavigationParentViewController() {
// Given
let invertedExpectation = self.invertedExpectation()
bindSourceViewControllerToWindow()
bindPeekViewControllerToAnotherParent()
registerSourceViewControllerForPreviewing(
onPeek: { _ in
self.invokeTransitionToPeekViewController(
popAction: {
invertedExpectation.fulfill()
}
)
}
)
// When
beginPeekOnRegisteredViewController()
// Then
waitForExpectations(timeout: asyncTimeout)
}
func testPeekAndPopUtility_invokesNoPopAction_ifPeekGetsCommitedOnOnscreenRegisteredViewControllerWithNotPeekViewController() {
// Given
let invertedExpectation = self.invertedExpectation()
bindSourceViewControllerToWindow()
registerSourceViewControllerForPreviewing(
onPeek: { _ in
self.invokeTransitionToPeekViewController(
popAction: {
invertedExpectation.fulfill()
}
)
}
)
// When
beginPeekOnRegisteredViewController()
commitPickOnRegisteredViewControllerToNotPeekViewController()
// Then
waitForExpectations(timeout: asyncTimeout)
}
func testPeekAndPopUtility_invokesNoPopAction_ifPeekGetsInterruptedWithAnotherTransitionOnOnscreenRegisteredViewController() {
// Given
let invertedExpectation = self.invertedExpectation()
bindSourceViewControllerToWindow()
registerSourceViewControllerForPreviewing(
onPeek: { _ in
self.invokeTransitionToPeekViewController(
popAction: {
invertedExpectation.fulfill()
}
)
}
)
// When
beginPeekOnRegisteredViewController()
interruptPeekWithAnotherTransitionOnRegisteredViewController()
// Then
waitForExpectations(timeout: asyncTimeout)
}
func testPeekAndPopUtility_invokesNoPopAction_ifPeekGetsCancelledByUserOnOnscreenRegisteredViewController() {
// Given
let invertedExpectation = self.invertedExpectation()
bindSourceViewControllerToWindow()
registerSourceViewControllerForPreviewing(
onPeek: { _ in
self.invokeTransitionToPeekViewController(
popAction: {
invertedExpectation.fulfill()
}
)
}
)
// When
beginPeekOnRegisteredViewController()
cancelPeekOnRegisteredViewController()
// Then
waitForExpectations(timeout: asyncTimeout)
}
func testPeekAndPopUtility_invokesNoPopAction_ifSamePeekIsAlreadyBeganAndNewPeekBeginsOnOnscreenRegisteredViewController() {
// Given
let invertedExpectation = self.invertedExpectation()
bindSourceViewControllerToWindow()
bindSourceViewController2ToWindow()
registerSourceViewControllerForPreviewing(
onPeek: { _ in
self.invokeTransitionToPeekViewController()
}
)
registerSourceViewController2ForPreviewing(
onPeek: { _ in
invertedExpectation.fulfill()
}
)
// When
beginPeekOnRegisteredViewController()
beginPeekOnRegisteredViewController2()
// Then
waitForExpectations(timeout: asyncTimeout)
}
func testPeekAndPopUtility_invokesNoPopAction_ifSamePeekFailedToBeginAndNewPeekBeginsOnOnscreenRegisteredViewController() {
// Given
let invertedExpectation = self.invertedExpectation()
bindSourceViewControllerToWindow()
bindSourceViewController2ToWindow()
registerSourceViewControllerForPreviewing()
registerSourceViewController2ForPreviewing(
onPeek: { _ in
self.invokeTransitionToPeekViewController(
popAction: {
invertedExpectation.fulfill()
}
)
}
)
// When
beginPeekOnRegisteredViewController()
beginPeekOnRegisteredViewController2()
// Then
waitForExpectations(timeout: asyncTimeout)
}
}
| [
-1
] |
1988d93b0cceb985bce06cf10be68d894c82a459 | aa92dd67f108cb7aaa0be901d14d56b91c279981 | /GeoFencing/SceneDelegate.swift | ce04ecf2ee63116f9368da94c5934bd958b8c3bb | [] | no_license | mustiikhalil/GeoFencing | 31e6a878bc814fdc6b6413614a25865f3a846dc7 | 623a18aec2c0d14732f27368db571905afade8e9 | refs/heads/master | 2020-12-06T23:51:55.025259 | 2020-01-09T11:17:20 | 2020-01-09T11:17:20 | 232,585,133 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,350 | swift | //
// SceneDelegate.swift
// SomeApp
//
// Created by Mustafa Khalil on 1/7/20.
// Copyright © 2020 Mustafa Khalil. 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,
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,
164107,
336140,
262417,
368913,
262423,
377118,
377121,
262437,
254253,
336181,
262455,
393539,
262473,
344404,
213333,
418135,
270687,
262497,
418145,
262501,
213354,
246124,
262508,
262512,
213374,
385420,
262551,
262553,
385441,
385444,
262567,
385452,
262574,
393649,
385460,
262587,
344512,
262593,
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,
385714,
434868,
164535,
336568,
328379,
164539,
328387,
352969,
385743,
385749,
189154,
369382,
361196,
418555,
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,
328690,
435188,
328703,
328710,
418822,
328715,
377867,
361490,
386070,
271382,
336922,
345119,
377888,
328747,
345134,
345139,
361525,
361537,
377931,
197708,
189525,
156762,
402523,
361568,
148580,
345200,
361591,
386168,
410746,
361594,
214150,
345224,
386187,
337048,
345247,
361645,
337072,
345268,
337076,
402615,
361657,
402636,
328925,
165086,
165092,
222438,
386286,
328942,
386292,
206084,
115973,
328967,
345377,
353572,
345380,
345383,
337207,
345400,
378170,
369979,
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,
370208,
419360,
394787,
419363,
370214,
419369,
394796,
419377,
419386,
206397,
214594,
419401,
419404,
353868,
419408,
214611,
419412,
403040,
345702,
222831,
370298,
353920,
403073,
403076,
345737,
198282,
403085,
403092,
345750,
419484,
345758,
345763,
419492,
419498,
419502,
370351,
419507,
337588,
419510,
419513,
419518,
403139,
337607,
419528,
419531,
419536,
272083,
394967,
419545,
345819,
419548,
181982,
419551,
345829,
419560,
337643,
419564,
337647,
370416,
141052,
337661,
337671,
362249,
362252,
395022,
362256,
321300,
345888,
116512,
378664,
354107,
345916,
354112,
247618,
370504,
329545,
345932,
354124,
370510,
337751,
247639,
370520,
313181,
182110,
354143,
354157,
345965,
345968,
345971,
345975,
182136,
403321,
1914,
354173,
247692,
395148,
337809,
247701,
329625,
436127,
436133,
247720,
337834,
362414,
337845,
190393,
346064,
247760,
346069,
329699,
354275,
190440,
247790,
354314,
346140,
337980,
436290,
378956,
395340,
436307,
338005,
329816,
100454,
329833,
329853,
329857,
329868,
411806,
329886,
346273,
362661,
100525,
387250,
379067,
387261,
256193,
395467,
256214,
411862,
411865,
411869,
411874,
379108,
411877,
387303,
346344,
395496,
338154,
387307,
346350,
338161,
436474,
321787,
379135,
411905,
411917,
43279,
379154,
395539,
387350,
387353,
338201,
182559,
338212,
395567,
248112,
362823,
436556,
321880,
362844,
379234,
354674,
182642,
321911,
420237,
379279,
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,
338665,
264942,
330479,
363252,
338680,
207620,
264965,
191240,
338701,
256787,
363294,
199455,
396067,
346917,
396070,
215854,
355123,
355141,
355144,
338764,
330581,
330585,
387929,
355167,
265056,
265059,
355176,
355180,
330612,
330643,
412600,
207809,
379849,
396246,
330711,
248794,
248799,
437219,
257009,
265208,
330750,
199681,
338951,
330761,
330769,
330775,
248863,
158759,
396329,
347178,
404526,
396337,
330803,
396340,
339002,
388155,
339010,
248905,
330827,
330830,
248915,
183384,
339037,
412765,
257121,
322660,
265321,
330869,
248952,
420985,
330886,
330890,
347288,
248986,
44199,
380071,
339118,
249018,
339133,
126148,
322763,
330959,
330966,
265433,
265438,
388320,
363757,
388348,
339199,
396552,
175376,
175397,
208167,
273709,
372016,
437553,
347442,
199989,
175416,
396601,
208189,
437567,
175425,
437571,
437576,
437584,
331089,
437588,
396634,
175451,
437596,
429408,
175458,
208228,
175461,
175464,
265581,
331124,
175478,
249210,
175484,
249215,
175487,
249219,
175491,
249225,
249228,
249235,
175514,
175517,
396703,
396706,
175523,
355749,
396723,
380353,
216518,
339401,
380364,
339406,
372177,
339414,
413143,
249303,
339418,
339421,
249310,
339425,
249313,
339429,
339435,
249329,
69114,
372229,
339464,
249355,
208399,
380433,
175637,
405017,
134689,
339504,
265779,
421442,
413251,
265796,
265806,
224854,
224858,
339553,
257636,
224871,
372328,
257647,
372338,
339572,
224885,
224888,
224891,
224895,
372354,
421509,
126597,
224905,
11919,
224911,
224914,
126611,
224917,
224920,
126618,
208539,
224923,
224927,
224930,
224933,
257705,
224939,
224943,
257713,
224949,
257717,
257721,
224954,
257725,
224960,
257733,
224966,
224970,
257740,
224976,
257745,
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,
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,
372598,
257914,
257917,
225150,
257922,
380803,
225156,
339845,
257927,
225166,
397201,
225171,
380823,
225176,
225183,
184245,
372698,
372704,
372707,
356336,
380919,
372739,
405534,
266295,
266298,
217158,
421961,
200786,
356440,
217180,
430181,
266351,
356467,
266365,
266375,
381069,
225425,
250003,
225430,
250008,
356507,
250012,
225439,
135328,
225442,
438434,
192674,
225445,
438438,
225448,
438441,
225451,
258223,
225456,
430257,
225459,
225462,
225468,
389309,
225472,
372931,
225476,
430275,
389322,
225485,
225488,
225491,
266454,
225494,
225497,
225500,
225503,
225506,
356580,
225511,
217319,
225515,
225519,
381177,
397572,
389381,
356631,
356638,
356641,
356644,
356647,
266537,
356650,
389417,
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,
332162,
389507,
348548,
356741,
250239,
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,
381513,
348745,
324171,
324174,
324177,
389724,
332381,
373344,
340580,
348777,
381546,
119432,
340628,
184983,
373399,
340639,
258723,
332460,
389806,
332464,
332473,
381626,
332484,
332487,
332494,
357070,
357074,
332512,
332521,
340724,
332534,
155647,
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,
324476,
430973,
340859,
340863,
324479,
324482,
324485,
324488,
185226,
381834,
324493,
324496,
324499,
430996,
324502,
324511,
422817,
324514,
201638,
398246,
373672,
324525,
5040,
111539,
324534,
5047,
324539,
324542,
398280,
349129,
340940,
340942,
209874,
340958,
431073,
398307,
340964,
209896,
201712,
209904,
349173,
381947,
201724,
431100,
349181,
431107,
209944,
209948,
250915,
250917,
357419,
209966,
209969,
209973,
209976,
209980,
209988,
209991,
209996,
431180,
349268,
250968,
210011,
373853,
341094,
210026,
210028,
210032,
349296,
210037,
210042,
210045,
349309,
152704,
160896,
349313,
210053,
210056,
349320,
373905,
259217,
210068,
210072,
210078,
210081,
210085,
210089,
210096,
210100,
324792,
210108,
357571,
210116,
210128,
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,
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,
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,
210707,
399129,
333593,
333595,
210720,
358192,
366384,
210740,
366388,
358201,
399166,
325441,
366403,
325447,
341831,
341835,
341839,
341844,
415574,
358235,
341852,
350046,
399200,
399208,
358256,
268144,
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,
211161,
350426,
334047,
350449,
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,
194942,
391564,
366991,
334224,
342431,
375209,
326059,
375220,
342453,
334263,
326087,
358857,
195041,
334306,
334312,
104940,
375279,
162289,
350724,
186898,
342546,
350740,
342551,
334359,
342555,
334364,
416294,
350762,
252463,
358962,
334386,
334397,
358973,
252483,
219719,
399957,
244309,
334425,
326240,
375401,
334466,
334469,
391813,
162446,
326291,
342680,
342685,
260767,
342711,
244410,
260798,
260802,
350918,
154318,
342737,
391895,
154329,
416476,
64231,
113389,
342769,
203508,
375541,
342777,
391938,
391949,
375569,
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,
400279,
252823,
392092,
400286,
359335,
211885,
400307,
351169,
359362,
351172,
170950,
359367,
326599,
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,
351382,
384152,
384158,
384161,
351399,
384169,
367795,
244917,
384182,
384189,
351424,
384192,
343232,
244934,
367817,
244938,
384202,
253132,
326858,
343246,
384209,
146644,
351450,
384225,
359650,
343272,
351467,
384247,
351480,
384250,
351483,
351492,
343307,
384270,
261391,
359695,
253202,
261395,
384276,
384284,
245021,
384290,
253218,
245032,
171304,
384299,
351535,
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,
359984,
400977,
400982,
179803,
155241,
138865,
155255,
155274,
368289,
245410,
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,
376672,
155488,
155492,
327532,
261997,
376686,
262000,
262003,
327542,
147319,
262006,
262009,
425846,
262012,
155517,
155523,
155526,
360327,
376715,
155532,
262028,
262031,
262034,
262037,
262040,
262043,
155550,
253854,
262046,
262049,
262052,
327590,
155560,
155563,
155566,
327613,
393152,
311244,
212945,
393170,
155604,
155620,
253924,
155622,
327655,
253927,
360432,
393204,
360439,
253944,
393209,
393215
] |
7a09bfc5727e4dc83b446503868de908e639852f | 5961bc79668579d27197e359414b4e83287d2ad5 | /STransportLayer/Pods/BoxView/BoxViewLayout/BoxItem+Create.swift | 9cc2d70c73299d545b218ad0b77e0b5f9076ad65 | [
"MIT"
] | permissive | Alexx-git/STransportLayer | 0169c15d35e1694be77d24e48484cc4d602a6d26 | 26564a8f0fb9c504687a6e2e8465b8ee07326950 | refs/heads/main | 2023-04-10T04:57:31.495490 | 2020-11-30T13:39:27 | 2020-11-30T13:39:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 9,213 | swift | //
// BoxItem+Ccreate.swift
// BoxViewExample
//
// Created by Vlad on 6/24/20.
// Copyright © 2020 Vlad. All rights reserved.
//
import UIKit
// MARK: - Public -
extension BoxItem {
// Creates new BoxItem from existing, by setting exact left padding.
public func left(_ left: CGFloat) -> BoxItem {
return BoxItem(alObj: alObj, layout: layout.with(.left, ==left))
}
// Creates new BoxItem from existing, by setting left pin
public func left(_ leftPin: BoxLayout.Pin?) -> BoxItem {
return BoxItem(alObj: alObj, layout: layout.with(.left, leftPin))
}
// creates new BoxItem from existing, by setting right pin
public func right(_ rightPin: BoxLayout.Pin?) -> BoxItem {
return BoxItem(alObj: alObj, layout: layout.with(.right, rightPin))
}
// creates new BoxItem from existing, by setting exact right padding
public func right(_ right: CGFloat) -> BoxItem {
return BoxItem(alObj: alObj, layout: layout.with(.right, ==right))
}
// creates new BoxItem from existing, by setting top pin
public func top(_ topPin: BoxLayout.Pin?) -> BoxItem {
return BoxItem(alObj: alObj, layout: layout.with(.top, topPin))
}
// creates new BoxItem from existing, by setting exact top padding
public func top(_ top: CGFloat) -> BoxItem {
return BoxItem(alObj: alObj, layout: layout.with(.top, ==top))
}
// creates new BoxItem from existing, by setting bottom pin
public func bottom(_ bottomPin: BoxLayout.Pin?) -> BoxItem {
return BoxItem(alObj: alObj, layout: layout.with(.bottom, bottomPin))
}
// creates new BoxItem from existing, by setting exact bottom padding
public func bottom(_ bottom: CGFloat) -> BoxItem {
return BoxItem(alObj: alObj, layout: layout.with(.bottom, ==bottom))
}
// creates new BoxItem from existing, by setting all paddings to same value
public func all(_ value: CGFloat) -> BoxItem {
let pin = ==value
return BoxItem(alObj: alObj, layout: layout.withPins(top: pin, left: pin, bottom: pin, right: pin))
}
// creates new BoxItem from existing, by setting left and right paddings to same value
public func allX(_ value: CGFloat) -> BoxItem {
let pin = ==value
var newLayout = layout
newLayout.left = pin
newLayout.right = pin
return BoxItem(alObj: alObj, layout: newLayout)
}
// creates new BoxItem from existing, by setting top and bottom paddings to same value
public func allY(_ value: CGFloat) -> BoxItem {
let pin = ==value
var newLayout = layout
newLayout.top = pin
newLayout.bottom = pin
return BoxItem(alObj: alObj, layout: newLayout)
}
// creates new BoxItem from existing, by setting 4 edge values from insets
public func insets(_ insets: UIEdgeInsets) -> BoxItem {
return BoxItem(alObj: alObj, layout: layout.withPins(top: ==insets.top, left: ==insets.left, bottom: ==insets.bottom, right: ==insets.right))
}
// creates new BoxItem from existing, by adding alignment along X-axis
public func centerX(offset: CGFloat = 0.0, padding: CGFloat? = 0.0) -> BoxItem {
let alignedItem = BoxItem(alObj: alObj, layout: layout.with(.centerX, ==offset))
if let padding = padding {
let paddingPin = >=padding
return alignedItem.left(paddingPin).right(paddingPin)
}
else {
return alignedItem
}
}
// creates new BoxItem from existing, by adding alignment along Y-axis
public func centerY(offset: CGFloat = 0.0, padding: CGFloat? = 0.0) -> BoxItem {
let alignedItem = BoxItem(alObj: alObj, layout: layout.with(.centerY, ==offset))
if let padding = padding {
let paddingPin = >=padding
return alignedItem.top(paddingPin).bottom(paddingPin)
}
else {
return alignedItem
}
}
// returns nil from existing item if condition is false
public func useIf(_ condition: Bool) -> BoxItem? {
return condition ? self : nil
}
// returns nil from existing item if view is hidden
public var useIfVisible: BoxItem? {
return !(view?.isHidden ?? true) ? self : nil
}
// returns new guide item
public static func guide() -> BoxItem {
return BoxItem(alObj: UILayoutGuide())
}
// returns new guide item with specified width pin
public static func width(_ widthPin: BoxLayout.Pin) -> BoxItem {
BoxItem(alObj: UILayoutGuide(), layout: BoxLayout().withWidth(widthPin))
}
// returns new guide item with specified width
public static func width(_ value: CGFloat) -> BoxItem {
BoxItem(alObj: UILayoutGuide(), layout: BoxLayout().withWidth(==value))
}
// creates new BoxItem from existing, by setting specified width pin
public func width(_ widthPin: BoxLayout.Pin) -> BoxItem {
BoxItem(alObj: alObj, layout: layout.withWidth(widthPin))
}
// creates new BoxItem from existing, by setting specified width
public func width(_ value: CGFloat) -> BoxItem {
BoxItem(alObj: self.alObj, layout: layout.withWidth(==value))
}
// creates new guide item with specified width relative to own width
public static func relativeWidth(_ value: CGFloat) -> BoxItem {
BoxItem(alObj: UILayoutGuide(), layout: BoxLayout().withRelativeWidth(*value))
}
// creates new guide item with specified width pin relative to own width
public static func relativeWidth(_ widthPin: BoxLayout.MultiPin) -> BoxItem {
BoxItem(alObj: UILayoutGuide(), layout: BoxLayout().withRelativeWidth(widthPin))
}
// creates new BoxItem from existing, by setting specified width relative to own width
public func relativeWidth(_ value: CGFloat) -> BoxItem {
BoxItem(alObj: alObj, layout: layout.withRelativeWidth(*value))
}
// creates new BoxItem from existing, by setting specified width pin relative to own width
public func relativeWidth(_ widthPin: BoxLayout.MultiPin) -> BoxItem {
BoxItem(alObj: alObj, layout: layout.withRelativeWidth(widthPin))
}
// returns new guide item with specified height pin
public static func height(_ heightPin: BoxLayout.Pin) -> BoxItem {
BoxItem(alObj: UILayoutGuide(), layout: BoxLayout().withHeight(heightPin))
}
// returns new guide item with specified height
public static func height(_ value: CGFloat) -> BoxItem {
BoxItem(alObj: UILayoutGuide(), layout: BoxLayout().withHeight(==value))
}
// creates new BoxItem from existing, by setting specified height pin
public func height(_ heightPin: BoxLayout.Pin) -> BoxItem {
BoxItem(alObj: alObj, layout: layout.withHeight(heightPin))
}
// creates new BoxItem from existing, by setting specified height
public func height(_ value: CGFloat) -> BoxItem {
BoxItem(alObj: self.alObj, layout: layout.withHeight(==value))
}
// creates new guide item with specified height relative to own height
public static func relativeHeight(_ value: CGFloat) -> BoxItem {
BoxItem(alObj: UILayoutGuide(), layout: BoxLayout().withRelativeHeight(*value))
}
// creates new guide item with specified height pin relative to own height
public static func relativeHeight(_ heightPin: BoxLayout.MultiPin) -> BoxItem {
BoxItem(alObj: UILayoutGuide(), layout: BoxLayout().withRelativeHeight(heightPin))
}
// creates new BoxItem from existing, by setting specified height pin relative to own height
public func relativeHeight(_ heightPin: BoxLayout.MultiPin) -> BoxItem {
BoxItem(alObj: alObj, layout: layout.withRelativeHeight(heightPin))
}
// creates new BoxItem from existing, by setting specified height relative to own height
public func relativeHeight(_ value: CGFloat) -> BoxItem {
BoxItem(alObj: alObj, layout: layout.withRelativeHeight(*value))
}
// creates new BoxItem from existing, by setting specified size
public func size(_ size: CGSize) -> BoxItem {
self.width(size.width).height(size.height)
}
// creates new BoxItem from existing, by setting left ant top from specified point
public func point(_ point: CGPoint) -> BoxItem {
return self.left(point.x).top(point.y)
}
// creates new BoxItem from existing, by setting left ant top from specified rect origin and size from rect size
public func rect(_ rect: CGRect) -> BoxItem {
return self.point(rect.origin).size(rect.size).right(nil).bottom(nil)
}
// returns new guide flex item
public static func flex(_ value: CGFloat = 1.0) -> BoxItem {
let bl = BoxLayout.zero
return BoxItem(alObj: UILayoutGuide(), layout: bl.withFlex(value))
}
// creates new BoxItem from existing, by setting flex value
public func flex(_ value: CGFloat = 1.0) -> BoxItem {
BoxItem(alObj: self.alObj, layout: layout.withFlex(value))
}
}
| [
-1
] |
8060dd35ba0a0a9080afc2d737669cf3c3080ecf | f62698d50936de997a85950f3b2947ac9ceaa60b | /test/api-digester/Inputs/cake2.swift | a410da438bbb94db79073ce7af3b28e7d1b1d8c3 | [
"Apache-2.0",
"Swift-exception"
] | permissive | mustiikhalil/swift | 18b5da022e1ea5a4bfe4f31f179c344e3cda8ca5 | 4733bfc0a8d6755630f2465988c77056de858a82 | refs/heads/master | 2020-03-29T10:22:17.531973 | 2018-09-21T18:00:18 | 2018-09-21T18:00:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,313 | swift | import APINotesTest
public struct S1 {
public init(_ : Double) {}
mutating public func foo1() {}
mutating public func foo2() {}
public static func foo3() {}
public func foo4() {}
public func foo5(x : Int, y: Int, z: Int) {}
}
public class C0 {
public func foo4(a : Void?) {}
}
public class C1: C0 {
public func foo1() {}
public func foo2(_ : ()->()) {}
public var CIIns1 : C1?
public weak var CIIns2 : C1?
public func foo3(a : ()?) {}
public init(_ : C1) {}
}
public typealias C3 = C1
public struct NSSomestruct2 {
public static func foo1(_ a : C3) {}
}
public class C4: NewType {}
public class C5 {
@objc
public dynamic func dy_foo() {}
}
@_fixed_layout
public struct C6 {}
public enum IceKind {}
public protocol P1 {}
public protocol P2 {}
public extension P1 {
func P1Constraint() {}
}
@_fixed_layout
public struct fixedLayoutStruct {
public var a = 1
public func OKChange() {}
private static let constant = 0
public var b = 2
public func foo() {}
private var c = 3
private lazy var lazy_d = 4
}
@_frozen
public enum FrozenKind {
case Unchanged
case Rigid
case Fixed
case AddedCase
}
public class C7: P1 {
public func foo(_ a: Int, _ b: Int) {}
}
public protocol P3: P1, P4 {}
public protocol P4 {}
extension fixedLayoutStruct: P2 {}
| [
-1
] |
e75c4abda393efaa1dab9912af7fecad39a6de45 | ec75fd119d5345884ebcbcb82ab8eb98fac568b8 | /TypicodePhotoCollection/TypicodePhotoCollection/Modules/Extensions/UIView+Extensions.swift | 440ddbc0244d4779014005ebb62550fc31f983e7 | [] | no_license | oliver-perez/TypicodePhotoCollection | 1755d0203acd43250b358abcdebfd8afc265e83f | 41fac9e23c84434e4c8ff8fdae9dcbf038b54e6b | refs/heads/main | 2022-12-27T18:46:00.572162 | 2020-10-13T14:31:23 | 2020-10-13T14:31:23 | 303,171,103 | 0 | 0 | null | 2020-10-13T14:31:25 | 2020-10-11T17:05:39 | Swift | UTF-8 | Swift | false | false | 378 | swift | //
// UIView+Extensions.swift
// TypicodePhotoCollection
//
// Created by Oliver Jordy Pérez Escamilla on 12/10/20.
//
import UIKit
extension UIView {
func aspectRatio(_ ratio: CGFloat) -> NSLayoutConstraint {
return NSLayoutConstraint(item: self, attribute: .height, relatedBy: .equal, toItem: self, attribute: .width, multiplier: ratio, constant: 0)
}
}
| [
-1
] |
fc804a9ec0e78e8b103cae914f06927b49f83515 | 655e23f31e60d573db3da1d72b97f3db57a60562 | /Sources/zhaohu-sdk-ios/WebViewController.swift | 6b3bea6da4378d5a9693a7b4bab8349634a61fc4 | [
"MIT"
] | permissive | nadileaf/zhaohu-sdk-ios | f1d34944f150dedda4e0fc5227f5d0a4e5d7e6a0 | c28020a7300d9d3a4249376bde123b88b244cccd | refs/heads/master | 2020-07-11T05:17:48.589676 | 2019-10-23T04:30:13 | 2019-10-23T04:30:13 | 204,454,308 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,003 | swift | //
// WebViewController.swift
// zhaohu-sdk-ios
//
// Created by 明扬 on 2019/9/4.
//
import UIKit
import WebKit
public class WebViewController: UIViewController, WKUIDelegate, WKNavigationDelegate, WKScriptMessageHandler {
fileprivate let logger = Log(subsystem: Bundle(for: WebViewController.self).bundleIdentifier!, category: "WebViewBridge")
fileprivate let p: ZhaohuParameter
@IBOutlet weak var container: UIView!
public func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {
if let body = message.body as? [String: Any], let type = body["type"] as? String {
switch type {
case "USER_INFO_REQUEST":
if let callback = body["callback"] as? String {
p.requestUserInfoDelegate.requestUserInfo(callback: {
self.webView.evaluateJavaScript("\(callback)(\($0))") { (result, error) in
if let err = error {
self.logger.error(err.localizedDescription)
} else {
self.logger.debug(String(format: "pass success: %@", String(describing: result)))
}
}
})
} else {
logger.error("???callback???")
}
case "USER_INFO_REPLY":
logger.error(body.description)
case "USER_DENIED":
self.dismiss(animated: true)
default:
logger.error(String(format: "Unrecognizable type: %@\n%@", type, body.description))
}
} else {
logger.fatal(String(format: "老王坑我: %@", String(describing: message.body)))
}
}
public init(p: ZhaohuParameter) {
self.p = p
let selfBundle = Bundle(identifier: "org.cocoapods.zhaohu-sdk-ios")!
super.init(nibName: "WebViewController", bundle: selfBundle)
}
@objc public init(from: String, token: String, requestUserInfoDelegate: RequestUserInfoDelegate, env: String? = nil, version: String? = nil) {
self.p = ZhaohuParameter(from: from, token: token, requestUserInfoDelegate: requestUserInfoDelegate, env: env, version: version)
let selfBundle = Bundle(identifier: "org.cocoapods.zhaohu-sdk-ios")!
super.init(nibName: "WebViewController", bundle: selfBundle)
}
required public init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
var webView: WKWebView! {
didSet {
webView.translatesAutoresizingMaskIntoConstraints = false
self.container.addSubview(webView)
webView.topAnchor.constraint(equalTo: container.topAnchor).isActive = true
webView.rightAnchor.constraint(equalTo: container.rightAnchor).isActive = true
webView.leftAnchor.constraint(equalTo: container.leftAnchor).isActive = true
webView.bottomAnchor.constraint(equalTo: container.bottomAnchor).isActive = true
webView.heightAnchor.constraint(equalTo: container.heightAnchor).isActive = true
webView.uiDelegate = self
webView.navigationDelegate = self
// webView.scrollView.bounces = false
webView.configuration.userContentController.add(self, name: "agora")
}
}
override public func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
let webConfiguration = WKWebViewConfiguration()
let customFrame = CGRect.init(origin: CGPoint.zero, size: CGSize.init(width: 0.0, height: self.container.frame.size.height))
self.webView = WKWebView (frame: customFrame , configuration: webConfiguration)
var versionSpan = ""
if let version = p.version {
versionSpan = "version=\(version)"
}
let urlStr = "https://agora.\(p.env ?? "mesoor").com/?\(versionSpan)&token=\(p.token)&from=\(p.from)&platform=ios_sdk".addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)!
let url = URL(string: urlStr)
let req = URLRequest(url: url!)
if let webView = self.webView {
webView.load(req)
} else {
logger.fatal("webView not found! please check xib resource is exists.")
}
}
/*
// 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.
}
*/
}
enum SDKError: Error {
case FatalError(reason: String)
}
@objc public protocol RequestUserInfoDelegate {
func requestUserInfo(callback: @escaping (_ result: String) -> Void) -> Void
}
| [
-1
] |
0d5c9ae1dc222fa0b103a37e70ec59f477755fe5 | 878657be7d2895e19eba8f7031aac62a650f2ba8 | /LyftClone/View/Cell/RideCell.swift | d7440aec78ef6116459357c140b7f9ecf03defd4 | [] | no_license | josealarconchacon/LyftClone | 48ffb364165fbf2aac2c26baba67f7cc3ac6948a | 4fa6348c9b3ffbffb1986c3807353d1f9283b2a1 | refs/heads/master | 2023-03-31T06:55:24.644674 | 2021-04-01T16:43:39 | 2021-04-01T16:43:39 | 338,395,058 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,164 | swift | //
// RideCell.swift
// LyftClone
//
// Created by Jose Alarcon Chacon on 2/22/21.
//
import UIKit
class RideCell: UITableViewCell {
@IBOutlet weak var titleLabel: UILabel!
@IBOutlet weak var rideImage: UIImageView!
@IBOutlet weak var capacityLabel: UILabel!
@IBOutlet weak var priceLabel: UILabel!
@IBOutlet weak var timeLabel: UILabel!
func updateSelectedStatus(status: Bool) {
if status {
contentView.layer.cornerRadius = 5.0
contentView.layer.borderWidth = 2.0
contentView.layer.borderColor = UIColor(red: 149.0 / 255.0, green: 67.0 / 255, blue: 255.0 / 255.0, alpha: 1.0).cgColor
} else {
contentView.layer.borderWidth = 0.0
}
}
func update(ride: Ride) {
rideImage.image = UIImage(named: ride.thumbnail)
titleLabel.text = ride.name
capacityLabel.text = ride.capacity
priceLabel.text = String(format: "$%.2f", ride.price)
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "hh:mma"
timeLabel.text = dateFormatter.string(from: ride.time)
}
}
| [
-1
] |
3625d6e6d10eaa38eec82c69721c9b93a9ed74d1 | a0f428a8b4df2b7ad464895c537e320e9352effa | /RedditOs/Features/Subreddit/SubredditPostsListView.swift | 53b16a56b82c0cbc33826f95c5c7d61fd5088e81 | [
"Apache-2.0"
] | permissive | lor1x/RedditOS | 8f79a85b3d239948a9c3f61991de36e3b73ec453 | 6b8f256fa219aa79e4c0d7feca5c593b9ef9aee5 | refs/heads/master | 2022-12-24T06:05:30.132262 | 2020-09-22T14:22:55 | 2020-09-22T14:22:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,333 | swift | //
// SubredditPostsListView.swift
// RedditOs
//
// Created by Thomas Ricouard on 09/07/2020.
//
import SwiftUI
import Backend
import UI
import KingfisherSwiftUI
struct SubredditPostsListView: View {
let posts = Array(repeating: 0, count: 20)
private let loadingPlaceholders = Array(repeating: static_listing, count: 10)
@EnvironmentObject private var uiState: UIState
@EnvironmentObject private var localData: LocalDataStore
@StateObject private var viewModel: SubredditViewModel
@AppStorage(SettingsKey.subreddit_display_mode) private var displayMode = SubredditPostRow.DisplayMode.large
@State private var subredditAboutPopoverShown = false
init(name: String) {
_viewModel = StateObject(wrappedValue: SubredditViewModel(name: name))
}
var isDefaultChannel: Bool {
UIState.DefaultChannels.allCases.map{ $0.rawValue }.contains(viewModel.name)
}
var subtitle: String {
if isDefaultChannel {
return ""
}
if let subscribers = viewModel.subreddit?.subscribers, let connected = viewModel.subreddit?.accountsActive {
return "\(subscribers.toRoundedSuffixAsString()) members - \(connected.toRoundedSuffixAsString()) online"
}
return ""
}
var body: some View {
NavigationView {
PostsListView(posts: viewModel.listings,
displayMode: .constant(displayMode)) {
viewModel.fetchListings()
}.toolbar {
ToolbarItem(placement: .navigation) {
Group {
if isDefaultChannel {
EmptyView()
} else if let icon = viewModel.subreddit?.iconImg, let url = URL(string: icon) {
KFImage(url)
.resizable()
.frame(width: 20, height: 20)
.cornerRadius(10)
} else {
Image(systemName: "globe")
.resizable()
.frame(width: 20, height: 20)
}
}
.onTapGesture {
subredditAboutPopoverShown = true
}
.popover(isPresented: $subredditAboutPopoverShown,
content: { SubredditAboutPopoverView(viewModel: viewModel) })
}
ToolbarItem {
Picker("",
selection: $displayMode,
content: {
ForEach(SubredditPostRow.DisplayMode.allCases, id: \.self) { mode in
Image(systemName: mode.iconName())
.tag(mode)
}
}).pickerStyle(InlinePickerStyle())
}
ToolbarItem {
if isDefaultChannel {
Text("")
} else {
Picker(selection: $viewModel.sortOrder,
label: Text("Sorting"),
content: {
ForEach(SubredditViewModel.SortOrder.allCases, id: \.self) { sort in
Text(sort.rawValue.capitalized).tag(sort)
}
})
}
}
}
.onAppear(perform: viewModel.fetchListings)
PostNoSelectionPlaceholder()
.toolbar {
PostDetailToolbar(shareURL: viewModel.subreddit?.redditURL)
}
}
.navigationTitle(viewModel.name.capitalized)
.navigationSubtitle(subtitle)
.onAppear {
if !isDefaultChannel {
viewModel.fetchAbout()
}
uiState.selectedSubreddit = viewModel
}
}
}
struct Listing_Previews: PreviewProvider {
static var previews: some View {
SubredditPostsListView(name: "Best")
}
}
| [
-1
] |
d46097c327b5425997aefc1aa5ca3a1861871065 | 9ede21b787de408b089453d8183a2dd51d4e0d07 | /Trial/TrialTimer.swift | ebe32104590480d0f4d60add200ce4e4ad72cb88 | [
"MIT"
] | permissive | LocNguyenHuu/TrialLicensing | b5130435644d24ab4e855fd8e71a8e20ff9d5a0d | 1d39c84960fe73ef751667aef9d7ac8f619d33cd | refs/heads/master | 2023-05-28T13:08:55.704688 | 2021-06-23T17:26:10 | 2021-06-23T17:26:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,610 | swift | // Copyright (c) 2015-2019 Christian Tietze
//
// See the file LICENSE for copying permission.
import Foundation
public class TrialTimer {
let trialEndDate: Date
let trialExpirationBlock: () -> Void
public convenience init(trialPeriod: TrialPeriod, trialExpirationBlock: @escaping () -> Void) {
self.init(trialEndDate: trialPeriod.endDate, trialExpirationBlock: trialExpirationBlock)
}
public init(trialEndDate: Date, trialExpirationBlock: @escaping () -> Void) {
self.trialEndDate = trialEndDate
self.trialExpirationBlock = trialExpirationBlock
}
public var isRunning: Bool {
return hasValue(delayedBlock)
}
var delayedBlock: CancelableDispatchBlock?
public func start() {
guard !isRunning else {
assertionFailure("invalid re-starting of a running timer")
return
}
guard let delayedBlock = dispatch(cancelableBlock: timerDidFire, atDate: trialEndDate) else {
fatalError("Cannot create a cancellable timer.")
}
// NSLog("Starting trial timer for: \(trialEndDate)")
self.delayedBlock = delayedBlock
}
fileprivate func timerDidFire() {
trialExpirationBlock()
}
/// - note: Try to stop a non-running timer raises an assertion failure.
public func stop() {
guard isRunning else {
assertionFailure("attempting to stop non-running timer")
return
}
cancelBlock(delayedBlock)
}
}
| [
-1
] |
e938d4d7b0a188c4d58f65e32f6ba56c9a030578 | cca5a52cee73abe18b8eea6ad47051aede035e8b | /noteYandexPractice/noteYandexPractice/ColorPicker/SelectionFlag.swift | c4774c80694fecbe357d8d17c4466a4c3bdd4cf6 | [] | no_license | musamuss/noteYandexPractice | 6880d0e7f6ff0ee4126fffcf70e923cdbf1d7dce | 05e7eb0dc2094c438140f7a32323860c37661eca | refs/heads/master | 2021-07-11T21:42:35.840647 | 2020-08-14T10:41:42 | 2020-08-14T10:41:42 | 193,161,527 | 3 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 877 | swift | //
// SelectionFlag.swift
// noteYandexPractice
//
//// Created by Admin on 10/07/2019.
//// Copyright © 2019 musamuss. All rights reserved.
//
import UIKit
class SelectionFlag: UIView {
override func draw(_ rect: CGRect) {
// Drawing code
let shapeColor: UIColor = .red
shapeColor.setFill()
let path = UIBezierPath()
path.lineWidth = 3
path.move(to: CGPoint(x: rect.minX + 3, y: rect.minY + 3))
path.addLine(to: CGPoint(x: rect.midX, y: rect.maxY - 3))
path.addLine(to: CGPoint(x: rect.maxX - 3, y: rect.minY + 3))
path.addLine(to: CGPoint(x: rect.maxX * 0.8, y: rect.minY + 3))
path.addLine(to: CGPoint(x: rect.midX, y: rect.maxY * 0.7))
path.addLine(to: CGPoint(x: rect.maxX * 0.4, y: rect.minY + 3))
path.close()
path.stroke()
path.fill()
}
}
| [
-1
] |
3d54c7d61ec21ad40542cb74209e8285b17b6939 | 9548743aef26b4be9998f6e30af958e660dca28c | /MediaMagicTestUITests/MediaMagicTestUITests.swift | 473cde71ab800ab314c620a1e66c631769987347 | [] | no_license | mayurrangari358/AssignmentTest | 234e215cf834af9441b6bae94f43067138d5b70e | 7a1f01ace035c40d64f2afdf3b7d9fc986cc0684 | refs/heads/master | 2022-12-06T07:43:57.222920 | 2020-08-29T12:23:16 | 2020-08-29T12:23:16 | 291,260,296 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,457 | swift | //
// MediaMagicTestUITests.swift
// MediaMagicTestUITests
//
// Created by Mayur Rangari on 27/08/20.
// Copyright © 2020 Mayur Rangari. All rights reserved.
//
import XCTest
class MediaMagicTestUITests: XCTestCase {
override func setUp() {
// Put setup code here. This method is called before the invocation of each test method in the class.
// In UI tests it is usually best to stop immediately when a failure occurs.
continueAfterFailure = false
// In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testExample() {
// UI tests must launch the application that they test.
let app = XCUIApplication()
app.launch()
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testLaunchPerformance() {
if #available(macOS 10.15, iOS 13.0, tvOS 13.0, *) {
// This measures how long it takes to launch your application.
measure(metrics: [XCTOSSignpostMetric.applicationLaunch]) {
XCUIApplication().launch()
}
}
}
}
| [
360463,
155665,
237599,
229414,
344106,
278571,
253996,
229425,
229431,
180279,
213051,
376892,
286787,
237638,
368717,
311373,
196687,
278607,
311377,
254039,
368732,
180317,
278637,
319599,
376945,
278642,
131190,
131199,
278676,
311447,
327834,
278684,
278690,
311459,
278698,
278707,
180409,
278713,
295099,
139459,
131270,
254157,
368849,
368850,
229591,
385240,
254171,
147679,
311520,
147680,
319719,
286957,
344312,
368908,
368915,
319764,
254228,
278805,
311582,
278817,
254250,
311596,
336177,
98611,
180534,
287040,
155968,
319812,
311622,
254285,
180559,
344402,
229716,
287089,
139641,
311679,
311692,
106893,
213402,
156069,
254373,
311723,
311739,
319931,
278974,
336319,
311744,
278979,
336323,
188870,
278988,
278992,
279000,
369121,
279009,
369124,
279014,
319976,
279017,
311787,
360945,
319986,
279030,
311800,
279033,
279042,
287237,
377352,
279053,
303634,
303635,
279060,
279061,
254487,
279066,
197166,
279092,
377419,
303693,
115287,
189016,
295518,
287327,
279143,
279150,
287345,
287348,
352885,
352886,
189054,
287359,
303743,
369285,
164487,
279176,
311944,
344714,
311950,
311953,
336531,
287379,
295575,
352921,
221853,
205469,
344737,
279207,
295591,
295598,
279215,
279218,
164532,
336565,
287418,
303802,
66243,
287434,
287438,
279249,
303826,
369365,
369366,
230105,
361178,
295653,
230120,
361194,
312046,
230133,
344829,
205566,
279293,
295688,
312076,
295698,
221980,
344864,
336678,
262952,
262953,
279337,
262957,
189229,
164655,
328495,
303921,
336693,
230198,
222017,
295745,
377669,
279379,
295769,
230238,
230239,
279393,
303973,
279398,
295797,
295799,
279418,
336765,
254851,
369541,
279434,
320394,
189327,
189349,
304050,
189373,
345030,
213961,
345034,
279499,
304086,
304104,
123880,
320495,
287730,
214009,
312313,
328701,
312317,
328705,
418819,
230411,
320526,
361487,
238611,
254997,
140311,
238617,
197658,
336930,
189487,
345137,
361522,
312372,
238646,
238650,
320571,
336962,
238663,
361547,
205911,
296023,
156763,
361570,
230500,
214116,
214119,
279659,
173168,
279666,
312435,
230514,
238706,
279686,
222344,
337037,
296091,
238764,
148674,
312519,
279752,
148687,
189651,
279766,
189656,
279775,
304352,
304353,
279780,
222441,
279789,
369912,
369913,
279803,
320769,
369929,
312588,
320795,
115997,
320802,
304422,
353581,
116014,
66863,
312628,
345397,
345398,
222523,
181568,
279872,
279874,
304457,
345418,
337226,
230730,
296269,
337228,
222542,
238928,
353617,
296274,
230757,
296304,
312688,
337280,
296328,
296330,
9618,
279955,
370072,
148899,
279980,
173492,
361928,
370122,
337359,
329168,
312785,
329170,
222674,
280020,
353751,
280025,
239069,
329181,
320997,
361958,
280042,
280043,
329198,
337391,
296434,
288248,
288252,
312830,
230922,
198155,
329231,
304655,
230933,
370200,
222754,
157219,
157220,
312879,
230960,
288305,
239159,
157246,
288319,
288322,
280131,
124486,
288328,
239192,
99937,
345697,
312937,
312941,
206447,
288377,
337533,
280193,
370307,
239238,
149127,
149128,
288391,
239251,
345753,
280217,
198304,
255651,
337590,
370359,
280252,
280253,
321217,
321220,
296649,
239305,
9935,
313042,
280279,
345817,
18139,
280285,
321250,
337638,
181992,
345832,
288492,
141037,
67316,
313082,
288508,
288515,
280326,
116491,
280333,
124691,
116502,
345882,
321309,
255781,
362281,
280367,
280373,
182070,
182071,
345910,
321338,
280381,
345918,
337734,
280396,
337746,
345942,
362326,
18263,
370526,
255844,
296807,
362351,
313200,
313204,
124795,
182145,
280451,
67464,
305032,
214936,
337816,
329627,
239515,
214943,
313257,
362411,
370604,
362418,
288698,
214978,
280517,
231382,
354268,
329696,
354273,
190437,
354279,
313322,
354283,
329707,
174058,
296942,
247787,
124912,
247786,
313338,
239610,
346117,
182277,
354312,
313356,
419857,
305173,
223269,
354342,
346153,
354346,
313388,
124974,
321589,
288829,
288835,
403524,
313415,
239689,
354386,
329812,
223317,
280676,
313446,
215144,
288878,
288890,
215165,
346237,
329884,
215204,
125108,
280761,
280767,
133313,
338118,
280779,
346319,
321744,
280792,
182503,
338151,
125166,
149743,
125170,
395511,
313595,
125184,
125192,
338187,
338188,
125200,
125204,
272661,
338196,
125215,
125225,
338217,
321839,
125236,
362809,
280903,
289109,
272730,
239973,
280938,
321901,
354671,
354672,
362864,
354678,
199030,
223611,
248188,
313726,
158087,
313736,
240020,
190870,
190872,
289185,
436644,
289195,
338359,
289229,
281038,
281039,
256476,
281071,
322057,
322077,
289328,
330291,
338491,
322119,
281165,
281170,
191065,
436831,
346739,
346741,
297600,
289435,
248494,
166581,
314043,
355006,
363212,
158424,
363228,
322269,
338658,
289511,
330473,
330476,
289517,
215790,
125683,
199415,
322302,
289534,
35584,
322312,
346889,
264971,
322320,
166677,
207639,
363295,
281378,
289580,
355129,
281407,
355136,
289599,
355138,
420680,
355147,
355153,
281426,
281434,
322396,
363361,
363362,
281444,
355173,
355174,
207724,
207728,
207735,
314240,
158594,
330627,
240517,
256918,
256919,
256920,
289691,
240543,
289699,
256934,
289720,
289723,
281541,
363462,
19398,
191445,
183254,
207839,
347104,
314343,
183276,
289773,
248815,
257007,
347122,
240631,
257023,
330759,
330766,
347150,
330789,
248871,
281647,
322609,
314437,
404550,
207954,
339031,
314458,
281698,
281699,
322664,
330867,
363643,
150656,
248960,
347286,
330912,
339106,
249003,
208044,
322733,
3243,
339131,
290001,
339167,
298209,
290030,
52473,
363769,
208123,
52476,
322826,
126229,
257323,
298290,
208179,
159033,
216387,
372039,
257353,
257354,
109899,
224591,
331091,
314708,
150868,
314711,
314721,
281958,
314727,
134504,
306541,
314734,
314740,
314742,
314745,
290170,
224637,
306558,
314752,
314759,
388488,
298378,
306580,
224662,
282008,
314776,
282013,
290206,
314788,
314790,
282023,
298406,
241067,
314797,
355761,
134586,
216510,
216511,
380350,
306630,
306634,
339403,
372172,
3557,
3559,
191980,
282097,
306678,
191991,
290304,
323083,
323088,
282132,
175640,
372261,
347693,
323120,
323126,
290359,
134715,
323132,
282182,
224848,
224852,
290391,
306777,
323171,
282214,
314997,
290425,
339579,
282244,
323208,
282248,
224907,
323226,
282272,
282279,
298664,
306875,
282302,
323262,
323265,
306891,
282321,
241366,
224985,
282330,
282336,
12009,
282349,
323315,
200444,
249606,
282375,
323335,
282379,
216844,
118549,
282390,
282399,
282401,
339746,
315172,
216868,
241447,
257831,
282418,
282424,
241471,
339782,
315209,
159563,
323405,
307024,
307030,
339799,
241494,
307038,
282471,
339840,
315265,
282503,
315272,
315275,
184207,
282517,
298912,
118693,
298921,
126896,
200628,
282573,
372699,
323554,
282634,
241695,
315431,
315433,
102441,
102446,
282671,
241717,
249912,
307269,
233548,
315468,
315477,
53334,
200795,
323678,
356446,
315488,
315489,
45154,
217194,
233578,
307306,
249976,
381071,
241809,
323730,
299166,
192670,
192671,
233635,
258213,
299176,
323761,
184498,
258233,
299202,
176325,
299208,
233678,
282832,
356575,
307431,
356603,
184574,
217352,
61720,
315674,
282908,
282912,
233761,
282920,
315698,
332084,
282938,
127292,
323914,
201037,
282959,
348499,
250196,
348501,
168280,
323934,
332128,
381286,
242027,
242028,
250227,
315768,
315769,
291194,
291193,
291200,
340356,
242059,
225684,
315798,
291225,
242079,
291266,
373196,
283088,
283089,
242138,
176602,
291297,
283138,
324098,
233987,
340489,
283154,
291359,
348709,
283185,
234037,
340539,
332379,
111197,
242274,
176751,
356983,
356984,
356990,
291455,
152196,
356998,
348807,
356999,
316044,
316048,
316050,
340645,
176810,
299698,
291529,
225996,
135888,
242385,
299737,
234216,
373485,
373486,
348921,
234233,
242428,
299777,
283418,
234276,
283431,
234290,
152372,
201534,
283466,
234330,
275294,
127840,
349025,
357219,
177002,
308075,
242542,
201590,
177018,
291713,
340865,
299912,
316299,
349068,
234382,
308111,
308113,
209820,
283551,
381872,
177074,
349122,
127945,
340960,
340967,
324587,
234476,
349176,
201721,
234499,
357380,
357413,
357420,
300087,
21567,
308288,
160834,
349254,
250955,
300109,
234578,
250965,
250982,
62574,
357487,
300145,
300147,
234626,
349315,
234635,
177297,
324761,
234655,
300192,
234662,
300200,
373937,
324790,
300215,
283841,
283846,
283849,
259275,
316628,
259285,
357594,
251124,
316661,
283894,
292092,
242955,
177420,
349458,
292145,
333114,
333115,
193858,
300354,
300355,
234830,
283990,
357720,
300378,
300379,
316764,
292194,
284015,
234864,
316786,
382329,
243073,
357763,
112019,
234902,
333224,
251314,
284086,
259513,
54719,
415170,
292291,
300488,
300490,
144862,
300526,
259569,
308722,
251379,
300539,
210429,
366081,
316951,
374297,
374327,
210489,
235069,
349764,
292424,
292426,
128589,
333389,
333394,
349780,
128600,
235096,
300643,
300645,
243306,
54895,
210558,
210559,
325246,
235136,
317102,
300729,
333508,
259780,
333522,
325345,
153318,
333543,
325357,
284410,
284425,
300810,
300812,
284430,
161553,
284436,
169751,
325403,
341791,
325411,
186148,
186149,
333609,
284460,
153392,
300849,
325444,
153416,
325449,
341837,
317268,
325460,
341846,
284508,
300893,
259937,
284515,
276326,
292713,
292719,
325491,
341878,
333687,
350072,
317308,
325508,
333700,
243590,
325514,
350091,
350092,
350102,
333727,
219046,
333734,
284584,
292783,
300983,
153553,
292835,
6116,
292838,
317416,
325620,
333827,
243720,
358418,
178215,
325675,
243763,
325695,
333902,
194667,
284789,
284790,
194692,
333968,
153752,
284827,
333990,
284840,
284843,
227517,
301255,
374984,
301270,
301271,
325857,
334049,
383208,
317676,
375040,
309504,
194832,
227601,
325904,
334104,
334121,
317738,
325930,
227655,
383309,
391521,
366948,
285031,
416103,
227702,
211327,
227721,
285074,
227730,
252309,
285083,
293275,
39323,
317851,
285089,
293281,
301482,
375211,
334259,
342454,
293309,
317889,
326083,
129484,
326093,
285152,
195044,
334315,
236020,
293368,
317949,
342537,
309770,
334345,
342549,
342560,
227881,
293420,
219694,
219695,
236080,
23093,
244279,
301635,
309831,
55880,
301647,
309847,
244311,
375396,
244326,
301688,
244345,
301702,
334473,
326288,
227991,
285348,
318127,
293552,
342705,
285362,
154295,
342714,
342757,
285419,
170735,
342775,
162559,
375552,
228099,
285443,
285450,
326413,
285457,
285467,
326428,
318247,
293673,
318251,
301872,
285493,
285496,
301883,
342846,
293702,
244569,
252766,
301919,
293729,
351078,
342888,
228214,
269179,
211835,
260995,
416649,
236427,
252812,
293780,
310166,
359332,
293801,
326571,
252848,
326580,
326586,
359365,
211913,
326602,
56270,
252878,
359391,
343020,
203758,
293894,
384015,
293911,
326684,
252959,
384031,
113710,
318515,
203829,
285795,
228457,
351343,
187508,
302202,
285819,
343166,
285823,
285833,
318602,
285834,
228492,
253074,
326803,
162962,
187539,
359574,
285850,
351389,
302239,
302251,
367791,
367792,
294069,
367798,
294075,
64699,
228541,
343230,
367809,
351445,
310496,
228587,
302319,
253168,
228608,
351489,
318732,
367897,
245018,
367898,
130342,
130344,
130347,
286012,
294210,
359747,
359748,
327030,
310650,
294278,
318860,
318876,
343457,
245160,
343480,
310714,
228796,
302530,
228804,
302539,
310731,
327122,
310747,
286176,
187877,
310758,
40439,
359931,
343552,
245249,
228868,
302602,
294413,
359949,
302613,
302620,
245290,
245291,
343606,
425534,
147011,
310853,
286281,
147020,
196184,
212574,
204386,
204394,
138862,
310896,
294517,
286344,
286351,
188049,
229011,
229021,
245413,
212649,
286387,
286392,
302778,
286400,
302798,
286419,
294621,
245471,
294629,
212721,
286457,
286463,
319232,
360194,
278292,
278294,
294699,
286507,
319289,
360253,
237397,
368471,
188250,
237411,
360315,
253828,
188293,
327556,
311183,
294806,
294808,
319393,
294820,
294824,
343993,
188349,
98240,
294849,
212947,
212953,
360416,
294887,
253930,
278507,
327666,
278515
] |
3ab79a0f56e7bc0831ab712ce50065f0c49adfac | d625ec4742157332683c3469eee6170ecca3922a | /Memorize/SceneDelegate.swift | 3d7f07545498ac100839f358435cf8aab98934d8 | [] | no_license | steniobarroso/memoryios | 74cba03cfb525f813f045fab737b1d8817ae38b3 | 7100e81dc38774249799429cbff7bac2fa127b82 | refs/heads/main | 2023-06-09T22:44:18.997987 | 2021-06-29T16:38:06 | 2021-06-29T16:38:06 | 381,432,081 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,757 | swift | //
// SceneDelegate.swift
// Memorize
//
// Created by stenio on 01/06/21.
//
import UIKit
import SwiftUI
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
// Create the SwiftUI view that provides the window contents.
let game = EmojiMemoryGame()
let contentView = EmojiMemoryGameView(viewModel: game)
// Use a UIHostingController as window root view controller.
if let windowScene = scene as? UIWindowScene {
let window = UIWindow(windowScene: windowScene)
window.rootViewController = UIHostingController(rootView: contentView)
self.window = window
window.makeKeyAndVisible()
}
}
func sceneDidDisconnect(_ scene: UIScene) {
// Called as the scene is being released by the system.
// This occurs shortly after the scene enters the background, or when its session is discarded.
// Release any resources associated with this scene that can be re-created the next time the scene connects.
// The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead).
}
func sceneDidBecomeActive(_ scene: UIScene) {
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
}
func sceneWillResignActive(_ scene: UIScene) {
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).
}
func sceneWillEnterForeground(_ scene: UIScene) {
// Called as the scene transitions from the background to the foreground.
// Use this method to undo the changes made on entering the background.
}
func sceneDidEnterBackground(_ scene: UIScene) {
// Called as the scene transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
}
}
| [
393221,
393228,
393231,
393251,
352294,
344103,
393260,
163892,
393269,
213049,
385082,
376890,
16444,
393277,
254020,
376906,
327757,
254032,
286804,
368728,
180314,
254045,
368736,
376932,
286833,
368753,
286845,
286851,
262284,
360598,
286880,
286889,
377003,
377013,
164029,
327872,
377030,
377037,
180432,
368854,
377047,
377063,
205037,
393457,
393461,
336124,
418044,
336129,
385281,
262405,
180491,
262417,
368913,
262423,
377121,
262437,
254253,
336181,
262455,
262473,
344404,
418135,
262497,
418145,
262501,
213354,
262508,
262512,
213374,
385420,
393613,
262551,
262553,
385444,
262567,
385452,
262574,
393649,
385460,
262587,
262593,
336326,
360917,
369119,
328178,
328180,
328183,
328190,
254463,
328193,
164362,
328207,
410129,
393748,
262679,
377372,
188959,
385571,
377384,
33322,
352822,
270905,
197178,
418364,
369224,
385610,
270922,
352844,
385617,
352865,
262761,
352875,
344694,
352888,
377473,
336513,
385671,
213642,
148106,
352919,
344745,
271018,
361130,
385714,
434868,
164535,
336568,
164539,
328379,
328387,
344777,
418508,
385743,
385749,
139998,
189154,
369382,
418540,
361196,
418555,
344832,
344837,
344843,
328462,
361231,
394002,
418581,
418586,
434971,
369436,
418591,
369439,
262943,
418594,
336676,
418600,
336681,
418606,
328498,
369464,
361274,
328516,
328520,
361289,
328523,
213848,
361307,
197469,
254813,
361310,
361318,
344936,
361323,
361335,
369544,
361361,
222129,
345036,
386004,
345046,
386012,
386019,
386023,
435188,
418822,
328710,
328715,
377867,
361490,
386070,
336922,
345119,
345134,
361525,
386102,
361537,
377931,
197708,
345172,
189525,
156762,
402523,
361568,
148580,
345200,
361591,
386168,
410746,
361599,
214150,
345224,
386187,
337048,
345247,
361645,
337072,
337076,
345268,
402615,
361657,
337093,
402636,
165086,
66783,
328933,
222438,
386286,
328942,
386292,
206084,
115973,
345377,
345380,
353572,
345383,
263464,
337207,
378170,
369979,
386366,
337224,
337230,
337235,
353634,
197987,
337252,
402792,
345449,
99692,
271731,
378232,
337278,
271746,
181639,
181644,
361869,
181650,
230810,
263585,
181671,
181674,
181679,
337330,
181682,
181687,
370105,
181691,
181697,
361922,
337350,
181717,
271841,
329192,
116211,
402943,
337416,
329227,
419341,
419345,
329234,
419351,
419357,
345631,
370208,
419360,
394787,
419363,
370214,
419369,
419377,
419386,
206397,
214594,
419401,
353868,
419408,
214611,
419412,
403040,
345702,
222831,
370298,
353920,
403073,
403076,
345737,
198282,
403085,
345750,
419484,
345758,
419492,
345766,
419498,
419502,
370351,
419507,
337588,
419510,
419513,
337601,
403139,
337607,
419528,
419531,
272083,
419543,
394967,
419545,
345819,
419548,
181982,
419551,
345829,
419560,
419564,
337647,
370416,
141052,
337661,
337671,
362249,
362252,
395022,
362256,
321300,
116512,
345888,
362274,
378664,
354107,
345916,
354112,
247618,
329545,
354124,
345932,
370510,
337743,
354132,
247639,
370520,
337751,
313181,
354143,
345965,
354157,
345968,
345971,
345975,
403321,
354173,
247692,
337809,
247701,
329625,
436133,
362414,
337845,
190393,
346059,
247760,
346064,
346069,
419810,
354275,
329699,
190440,
247790,
354314,
436290,
378956,
395340,
436307,
100454,
329853,
329857,
329868,
411806,
346273,
362661,
379067,
387261,
346317,
411862,
411865,
411869,
411874,
379108,
411877,
387303,
395496,
338154,
387307,
346350,
387314,
436474,
321787,
379135,
411905,
411917,
43279,
379154,
395539,
387350,
387353,
338201,
182559,
395567,
248112,
264502,
362823,
436556,
190797,
321880,
362844,
379234,
182642,
354674,
420237,
379279,
354728,
338353,
338382,
272849,
338387,
248279,
256474,
182755,
338404,
330225,
248309,
199165,
199189,
420377,
191012,
330320,
199250,
346722,
248427,
191085,
346736,
338544,
191093,
346743,
330384,
346769,
150184,
363198,
223936,
355025,
273109,
355029,
264919,
183006,
338661,
338665,
264942,
330479,
363252,
338680,
207620,
191240,
338701,
338712,
363294,
199455,
396067,
346917,
396070,
215854,
355123,
355141,
355144,
338764,
355151,
330581,
387929,
330585,
355167,
265056,
355176,
355180,
355185,
330612,
330643,
412600,
207809,
379849,
347082,
396246,
330711,
248794,
248799,
437219,
338928,
257009,
265208,
330750,
265215,
199681,
158759,
396329,
347178,
404526,
396337,
396340,
339002,
388155,
339010,
347208,
412765,
339037,
257121,
322660,
265321,
248952,
420985,
330886,
248986,
44199,
380071,
339118,
249015,
339133,
322763,
388320,
363757,
388348,
339199,
175376,
175397,
208167,
273709,
372016,
437553,
347442,
199989,
44343,
175416,
396601,
208189,
437567,
175425,
437571,
126279,
437576,
437584,
331089,
437588,
331094,
396634,
175451,
437596,
429408,
175458,
208228,
175461,
175464,
249210,
175484,
175487,
249215,
175491,
249219,
249228,
249235,
175514,
175517,
396706,
175523,
355749,
396723,
388543,
380353,
339401,
380364,
339406,
372177,
208338,
249303,
413143,
339418,
339421,
249310,
249313,
339425,
339429,
339435,
249329,
69114,
372229,
339464,
249355,
208399,
175637,
405017,
134689,
339504,
413251,
265796,
265806,
224854,
224858,
257636,
224871,
372328,
257647,
372338,
339572,
224885,
224888,
224891,
224895,
372354,
421509,
126597,
339593,
224905,
159375,
11919,
126611,
224917,
126618,
208539,
224923,
224927,
224930,
224933,
257705,
224943,
257713,
224949,
257717,
257721,
224954,
257725,
224960,
257733,
224966,
224970,
257740,
339664,
224976,
257745,
257748,
224982,
257752,
224987,
257762,
224996,
225000,
339696,
225013,
257788,
225021,
257791,
225027,
257796,
257802,
257805,
225039,
257808,
225044,
167701,
372500,
257815,
225049,
257820,
225054,
184096,
257825,
225059,
339748,
257837,
413485,
225071,
225074,
257843,
372533,
225077,
257846,
225080,
397113,
225083,
397116,
257853,
225088,
225094,
225097,
323404,
257869,
257872,
225105,
339795,
397140,
225109,
225113,
257881,
257884,
257887,
225120,
413539,
257891,
225128,
257897,
339818,
225138,
339827,
257909,
372598,
225142,
257914,
257917,
225150,
257922,
380803,
225156,
339845,
257927,
225166,
397201,
225171,
380823,
225176,
225183,
184245,
372698,
372704,
372707,
356336,
372739,
266298,
217158,
421961,
200786,
356440,
217180,
430181,
356467,
266365,
192640,
266375,
381069,
225425,
250003,
225430,
250008,
356507,
225439,
225442,
438434,
225445,
225448,
356521,
438441,
225451,
225456,
430257,
225459,
225462,
225468,
389309,
225472,
372931,
225476,
389322,
225485,
225488,
225491,
225494,
266454,
225497,
225500,
225503,
225506,
356580,
217319,
225511,
225515,
225519,
381177,
397572,
389381,
381212,
258333,
356638,
356641,
356644,
356647,
389417,
356650,
356656,
332081,
307507,
356662,
397623,
332091,
225599,
332098,
201030,
348489,
151884,
430422,
348503,
250201,
332126,
332130,
250211,
340328,
250217,
348523,
332153,
356734,
250239,
389503,
438657,
332158,
389507,
348548,
356741,
332175,
160152,
373146,
340380,
373149,
373169,
266688,
201158,
127473,
217590,
340473,
266757,
340512,
381483,
356908,
356917,
348734,
356935,
348745,
381513,
389724,
332381,
373344,
381546,
119432,
340628,
184983,
373399,
340639,
332455,
389806,
381626,
373450,
357070,
357074,
332512,
332521,
340724,
332534,
155647,
348926,
389927,
152371,
348979,
348983,
340792,
398141,
127815,
357202,
389971,
136024,
357208,
389979,
357212,
430940,
357215,
439138,
201580,
201583,
349041,
340850,
201589,
430967,
324473,
398202,
119675,
324476,
340859,
324479,
324482,
373635,
324485,
324488,
381834,
324493,
324496,
324499,
430996,
324502,
324511,
422817,
373672,
324525,
111539,
324534,
324539,
324542,
398280,
349129,
340940,
340942,
209874,
431073,
398307,
340964,
209896,
201712,
209904,
381947,
201724,
431100,
431107,
349203,
250915,
357411,
250917,
357419,
209980,
209996,
431180,
341072,
349268,
250968,
210011,
373853,
341094,
210026,
210032,
349296,
210037,
349309,
152704,
349313,
160896,
210053,
210056,
259217,
373905,
210068,
251045,
210108,
333003,
333010,
210132,
333016,
210144,
218355,
218361,
275709,
275713,
242947,
275717,
349460,
333079,
251161,
349486,
349492,
251190,
415034,
251211,
357710,
210261,
365912,
259423,
374113,
365922,
374118,
333164,
234867,
390518,
357756,
136591,
374161,
349591,
333222,
259516,
415168,
415187,
415192,
415194,
415197,
415208,
366057,
366064,
423424,
415258,
415264,
366118,
382503,
415271,
349739,
144940,
415279,
415282,
349748,
415286,
210488,
415291,
415295,
349762,
333387,
333396,
374359,
366173,
333415,
423529,
423533,
333423,
210547,
415354,
333440,
267910,
333472,
333499,
333512,
210632,
259789,
358100,
366301,
153311,
333535,
366308,
366312,
431852,
399086,
366319,
210673,
366322,
399092,
366326,
268042,
210700,
366349,
210707,
399129,
210720,
366384,
358192,
210740,
366388,
358201,
399166,
325441,
366403,
325447,
341831,
341835,
341839,
341844,
415574,
341852,
350046,
399200,
399208,
358256,
268144,
341877,
399222,
325494,
243584,
325505,
333699,
399244,
333725,
382891,
382898,
333767,
350153,
358348,
333777,
399318,
358372,
350194,
333819,
350204,
350207,
350214,
219144,
268299,
350225,
186388,
350241,
374819,
350245,
350249,
350252,
178221,
350272,
243782,
350281,
374865,
342113,
342134,
374904,
268435,
333989,
350411,
350417,
350423,
350426,
334047,
350449,
375027,
358645,
350459,
350462,
350465,
350469,
325895,
268553,
194829,
350477,
268560,
350481,
432406,
350487,
325915,
350491,
325918,
350494,
325920,
350500,
194854,
350505,
391469,
350510,
358701,
358714,
358717,
383307,
334162,
358738,
383331,
383334,
391531,
383342,
268669,
194942,
391564,
383375,
366991,
268702,
416159,
342431,
375209,
326059,
375220,
334263,
358857,
195041,
334306,
104940,
375279,
162289,
416255,
350724,
350740,
334359,
342551,
342555,
334364,
416294,
350762,
252463,
334386,
358962,
358973,
334397,
252483,
219719,
399957,
334425,
326240,
375401,
268922,
334466,
334469,
162446,
326291,
342680,
342685,
260767,
342711,
260798,
260802,
350918,
342737,
391895,
154329,
416476,
113389,
342769,
203508,
375541,
342777,
391938,
391949,
326417,
375569,
375572,
375575,
375580,
162592,
326444,
383794,
326452,
326455,
375613,
244542,
326463,
326468,
326474,
326479,
326486,
342875,
326494,
326503,
375657,
433001,
326508,
400238,
326511,
211832,
392061,
359296,
351105,
252801,
260993,
400260,
211846,
342921,
236432,
342931,
400279,
392092,
400286,
252838,
359335,
252846,
400307,
351169,
359362,
170950,
187335,
359367,
359383,
359389,
383968,
359411,
261109,
261112,
244728,
383999,
261130,
326669,
261148,
359452,
211999,
261155,
261160,
359471,
375868,
343132,
384099,
384102,
326764,
367724,
384108,
326767,
187503,
343155,
384115,
212095,
351366,
384144,
351382,
351399,
367795,
367801,
351424,
244934,
367817,
326858,
244938,
253132,
343246,
351450,
343272,
351467,
351480,
351483,
351492,
343307,
261391,
359695,
253202,
261395,
253218,
171304,
384299,
376111,
326970,
384324,
343366,
212296,
212304,
367966,
343394,
343399,
367981,
343410,
155000,
327035,
253321,
155021,
384398,
245143,
343453,
155045,
40358,
245163,
114093,
343478,
359867,
384444,
146878,
327112,
384457,
327116,
327118,
359887,
359891,
343509,
368093,
155103,
343535,
343540,
368120,
343545,
409092,
253445,
359948,
359951,
245295,
359984,
343610,
400977,
400982,
343650,
327276,
245358,
138865,
155255,
155274,
368289,
425639,
425652,
155323,
425663,
155328,
155352,
212700,
155356,
155364,
245477,
155372,
212723,
245495,
409336,
155394,
155404,
245528,
155423,
360224,
155439,
204592,
155444,
155448,
384829,
384831,
360262,
155463,
155477,
376665,
155484,
261982,
425823,
376672,
155488,
155492,
327532,
261997,
376686,
262000,
262003,
425846,
262006,
327542,
262009,
147319,
262012,
155517,
155523,
155526,
360327,
376715,
155532,
262028,
262031,
262034,
262037,
262040,
262043,
155550,
253854,
262046,
262049,
262052,
155560,
155563,
155566,
393152,
311244,
212945,
393170,
155604,
155620,
253924,
155622,
253927,
327655,
360432,
204785,
393204,
360439,
253944,
393209,
393215
] |
a887aa443582c4d223176522d0268b8e8c2cb550 | e9760279abb80dcf8ab3aaa0e8c58f1d6616c26b | /Roshambo/ChoiceViewController.swift | 2717978f8deb4604dda570a0a49e7c60952705b0 | [
"MIT"
] | permissive | jcochran206/Roshambo | 511c6b76e44d811887ad59dd4293b56652249e28 | 78966c141e193ac8070708c22b3099b71afa4264 | refs/heads/master | 2020-03-22T08:34:03.211038 | 2018-07-05T01:16:14 | 2018-07-05T01:16:14 | 139,774,539 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,242 | swift | //
// ChoiceViewController.swift
// Roshambo
//
// Created by Jonathan Cochran on 7/4/18.
// Copyright © 2018 Jonathan Cochran. All rights reserved.
//
import UIKit
class ChoiceViewController: UIViewController {
//programmatic way
@IBAction func playRock(_ sender: UIButton) {
let vc = self.storyboard?.instantiateViewController(withIdentifier: "ResultsViewController") as! ResultsViewController
vc.userChoice = getUserShape(sender)
present(vc, animated: true, completion: nil)
}
//Segue way + code
@IBAction func playPaper(_ sender: Any) {
performSegue(withIdentifier: "play", sender: sender)
}
//Segue way only
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "play" {
let vc = segue.destination as! ResultsViewController
vc.userChoice = getUserShape(sender as! UIButton)
}
}
// The enum "Shape" represents a play or move
private func getUserShape(_ sender: UIButton) -> Shape {
// Titles are set to one of: Rock, Paper, or Scissors
let shape = sender.title(for: UIControlState())!
return Shape(rawValue: shape)!
}
}
| [
-1
] |
ad3580306b33b006b58db2c678316b9827cadfe4 | 87badd850f947f1efbadf2cc8316b630844833e5 | /CreditManager/ViewController/HomeTabViewController.swift | d92d2c8e2882650d0dbe962c762b2ae155e6c66b | [] | no_license | anudeepsinghpatelgithub/creditManagerIos | c22497f99a45afd2e66c0afc259c86044678ade9 | c0ea8f16d27f390ed8f5703e2cff5bbaa75727a5 | refs/heads/main | 2023-01-06T14:40:31.429518 | 2020-11-01T06:10:10 | 2020-11-01T06:10:10 | 309,033,228 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,404 | swift | //
// HomeViewController.swift
// CreditManager
//
// Created by Patel, Anudeep on 31/10/20.
//
import Foundation
import UIKit
class HomeTabViewController: UITabBarController {
override func viewDidLoad() {
super.viewDidLoad()
tabBar.barTintColor = UIColor(red: 255/255, green: 187/255, blue: 51/255, alpha: 1)
setupTabs3()
}
func setupTabs3() {
let allAccountsVC = UINavigationController(rootViewController: AllAccountsViewController())
allAccountsVC.title = "All"
let creidtsVC = UINavigationController(rootViewController: CreditAcccountsViewController())
creidtsVC.title = "Credits"
let debitsVC = UINavigationController(rootViewController: DebitAccountsViewController())
debitsVC.title = "Debits"
let settingVC = UINavigationController(rootViewController: SettingsViewController())
settingVC.title = "Settings"
viewControllers = [allAccountsVC, creidtsVC, debitsVC,settingVC]
guard let items = tabBar.items else {
return
}
let images = ["house","creditcard","megaphone","gear"]
for x in 0..<items.count {
items[x].image = UIImage(systemName: images[x])
}
// tabBarController.modalPresentationStyle = .fullScreen
// present(tabBarController, animated: true)
}
}
| [
-1
] |
a9a4612fba0859a4bd3d0163e98d5b0e55c0deb8 | cd6e639317c3fcfc2e0fffed4bafdf947096ed5e | /ClapTests/ClapTests.swift | c4c9759255197ff5d91584c19c713c1a4c63cdf9 | [] | no_license | karu128/Clapapp | 255ee5293ffca0bcd0684738440cd0c0a1ab6af3 | 2be384112499284975afb7873fce07906f13b15b | refs/heads/master | 2021-01-19T15:01:47.828173 | 2015-06-14T06:25:44 | 2015-06-14T06:25:44 | 37,401,713 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 910 | swift | //
// ClapTests.swift
// ClapTests
//
// Created by 畠山 ひかる on 2015/06/14.
// Copyright (c) 2015年 Hikaru Hatakeyama. All rights reserved.
//
import UIKit
import XCTest
class ClapTests: 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.
}
}
}
| [
278541,
278544,
305179,
276509,
278558,
307231,
313375,
102437,
227370,
360491,
276534,
159807,
286788,
280649,
223316,
315476,
223318,
288857,
278618,
227417,
194653,
194656,
309345,
227428,
276581,
276582,
276589,
278638,
227439,
131189,
227446,
223350,
292992,
141450,
215178,
311435,
311438,
276627,
276632,
196773,
227495,
129203,
299187,
131256,
176314,
280762,
223419,
299198,
309444,
276682,
276684,
278742,
155867,
280802,
276709,
276715,
233715,
157944,
211193,
168188,
227585,
227592,
157970,
309529,
278810,
276764,
299293,
276774,
282919,
262450,
276792,
315706,
164162,
311621,
280902,
278856,
227658,
276813,
6481,
6482,
6489,
323935,
276835,
321894,
416104,
276847,
285040,
280961,
227725,
178578,
190871,
293274,
61857,
61859,
278954,
278961,
278965,
276919,
276920,
278969,
293303,
33211,
276925,
278978,
278985,
278993,
287198,
227809,
358882,
227813,
279013,
279019,
279022,
281072,
279039,
276998,
287241,
279050,
186893,
303631,
223767,
223769,
291358,
277029,
293419,
277048,
277083,
295519,
66150,
277094,
277101,
189042,
287346,
277111,
279164,
277118,
291454,
184962,
303746,
152203,
225933,
277133,
133774,
230040,
164512,
285353,
209581,
205487,
285361,
303793,
299699,
293556,
342706,
285371,
199366,
225997,
164563,
277204,
226004,
203477,
279252,
226007,
226019,
285415,
342762,
277227,
230134,
234234,
279294,
234241,
226051,
209670,
226058,
234250,
234253,
234263,
234268,
228129,
234277,
279336,
277289,
289576,
234283,
277294,
234286,
234289,
234294,
230199,
293693,
162621,
234301,
289598,
281408,
162626,
277316,
234311,
234312,
299849,
234317,
277325,
293711,
234323,
234326,
234331,
301918,
279392,
349026,
234340,
174949,
234343,
234346,
234355,
277366,
234360,
279417,
226170,
209785,
177019,
234361,
277370,
234366,
234367,
158593,
234372,
226181,
113542,
213894,
226184,
234377,
277381,
228234,
295824,
226194,
234386,
234387,
234392,
324507,
234400,
279456,
234404,
289703,
234409,
275371,
236461,
234419,
234425,
277435,
234427,
287677,
234430,
226241,
234436,
234438,
52172,
234444,
234445,
183248,
234451,
234454,
234457,
234463,
234466,
277479,
277480,
234472,
234473,
234477,
234482,
287731,
277492,
314355,
277505,
234498,
234500,
277509,
277510,
230410,
234506,
197647,
295953,
277523,
230423,
197657,
281625,
281626,
175132,
234531,
234534,
310317,
234542,
234548,
277563,
234555,
238651,
277566,
230463,
234560,
207938,
234565,
234569,
300111,
207953,
277585,
296018,
234577,
296019,
234583,
234584,
277603,
230499,
281700,
300135,
275565,
156785,
312434,
275571,
300151,
234616,
398457,
234622,
300158,
285828,
302213,
275591,
253063,
234632,
234642,
308372,
119963,
234656,
330913,
306338,
234659,
234663,
275625,
300201,
275628,
238769,
226481,
277690,
208058,
230588,
283840,
279747,
279760,
290000,
189652,
203989,
363744,
195811,
298212,
304356,
279792,
298228,
204022,
120055,
234742,
228600,
208124,
292107,
277792,
339234,
199971,
304421,
277800,
113962,
113966,
226608,
226609,
277814,
300343,
277824,
277825,
226624,
15686,
226632,
294218,
177484,
222541,
277841,
296273,
314709,
283991,
357719,
218462,
224606,
142689,
230756,
277862,
163175,
281962,
284014,
275831,
181625,
275839,
281992,
230799,
112017,
296338,
306579,
277911,
310692,
277925,
279974,
277927,
282024,
277940,
279989,
296375,
277946,
296387,
415171,
163269,
296391,
300487,
277962,
280013,
312782,
284116,
277974,
226781,
310757,
316902,
296425,
306677,
300542,
306693,
175625,
192010,
149007,
65041,
282136,
204313,
278060,
286254,
228917,
194110,
276040,
366154,
276045,
276046,
286288,
280147,
300630,
147036,
243292,
370271,
282213,
317032,
222832,
276085,
188031,
192131,
276101,
229001,
310923,
312972,
278160,
278162,
282259,
276116,
276120,
280220,
276126,
276129,
282273,
282276,
278191,
198324,
286388,
296628,
278214,
323276,
276173,
302797,
212688,
302802,
276179,
276180,
286423,
216795,
276195,
153319,
313065,
280300,
419569,
276210,
276219,
194303,
171776,
288512,
311042,
288516,
278285,
276238,
227091,
294678,
284442,
278299,
276253,
159533,
276282,
276283,
276287,
345919,
276294,
282438,
276298,
216918,
307031,
237408,
276325,
282474,
288619,
110452,
276344,
194429,
227199,
40853,
44952,
247712,
227238,
294823,
276401,
276408,
290746,
276413,
276421,
276430,
231375,
153554,
276444,
280541,
276454,
276459,
296941
] |
bd8e5b27136f79554c128fee2938ad7299d05eb1 | 4c7928e52548f4b764261e618175da5f5049672d | /helloworld2/AppDelegate.swift | 65eab97e22a6f58cf7d1215f97a8e274e5ed1505 | [] | no_license | 20181102932/helloworld2 | 7a269003b1abbf13b0aa78da47415ac4c45d1697 | 23e456c70d99a38f93bc47953a40d5ee0cc1aae3 | refs/heads/master | 2020-07-12T14:53:38.688377 | 2019-08-28T03:56:49 | 2019-08-28T03:56:49 | 204,844,448 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,171 | swift | //
// AppDelegate.swift
// helloworld2
//
// Created by s20181102932 on 2019/8/28.
// Copyright © 2019 wjx. 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,
294924,
229388,
229391,
327695,
229394,
229397,
229399,
229402,
278556,
229405,
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,
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,
312006,
107208,
172748,
287436,
107212,
172751,
287440,
295633,
172755,
303827,
279255,
172760,
287450,
303835,
279258,
189149,
303838,
213724,
312035,
279267,
295654,
279272,
230128,
312048,
312050,
230131,
205564,
303871,
230146,
328453,
295685,
230154,
33548,
312077,
295695,
295701,
230169,
369433,
295707,
328476,
295710,
230175,
295720,
303914,
279340,
205613,
279353,
230202,
312124,
328508,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
279390,
230241,
279394,
303976,
336744,
303985,
328563,
303987,
279413,
303991,
303997,
295806,
295808,
295813,
304005,
320391,
213895,
304007,
304009,
304011,
230284,
304013,
295822,
279438,
189329,
295825,
304019,
189331,
58262,
304023,
304027,
279452,
234648,
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,
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,
280021,
288214,
239064,
288217,
329177,
280027,
288220,
288218,
239070,
288224,
280034,
288226,
280036,
288229,
280038,
288230,
288232,
370146,
320998,
288234,
288236,
288238,
288240,
288242,
296435,
288244,
288250,
296446,
321022,
402942,
206336,
296450,
148990,
230916,
230919,
214535,
230923,
304651,
304653,
370187,
230940,
222752,
108066,
296486,
296488,
157229,
239152,
230961,
157236,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
288344,
280152,
239194,
280158,
403039,
370272,
181854,
239202,
312938,
280183,
280185,
280188,
280191,
116354,
280194,
280208,
280211,
288408,
280218,
280222,
190118,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
313027,
280260,
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,
288519,
280331,
198416,
280337,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
296767,
288576,
345921,
280388,
337732,
304968,
280393,
280402,
173907,
313171,
313176,
280419,
321381,
296809,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280464,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
280487,
313258,
321458,
296883,
124853,
214966,
296890,
10170,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
239586,
313320,
231404,
124913,
165876,
321528,
239612,
313340,
288764,
239617,
313347,
288773,
313358,
305176,
321560,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
378941,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
149599,
280671,
149601,
321634,
149603,
223327,
329830,
280681,
313451,
223341,
280687,
149618,
215154,
313458,
280691,
313464,
329850,
321659,
280702,
288895,
321670,
215175,
141446,
141455,
141459,
280725,
313498,
100520,
288936,
280747,
288940,
288947,
280755,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
313548,
321740,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
157930,
280811,
280817,
125171,
157940,
280819,
182517,
280823,
280825,
280827,
280830,
280831,
280833,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
280888,
305464,
280891,
289087,
280897,
280900,
305480,
239944,
280906,
239947,
305485,
305489,
379218,
280919,
354653,
313700,
280937,
313705,
190832,
280946,
223606,
313720,
280956,
239997,
280959,
313731,
199051,
240011,
289166,
240017,
297363,
190868,
240021,
297365,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
289210,
305594,
281024,
289218,
289221,
289227,
281045,
281047,
215526,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
240132,
281095,
223752,
150025,
338440,
330244,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
281179,
338528,
338532,
281190,
199273,
281196,
19053,
158317,
313973,
297594,
281210,
158347,
182926,
133776,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
199364,
297671,
158409,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322314,
322318,
281361,
281372,
322341,
215850,
281388,
289593,
281401,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
281442,
174955,
224110,
207733,
207737,
158596,
183172,
240519,
322440,
314249,
338823,
183184,
142226,
289687,
240535,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
281567,
289762,
322534,
297961,
183277,
281581,
322550,
134142,
322563,
314372,
330764,
175134,
322599,
322610,
314421,
281654,
314427,
314433,
207937,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
289912,
248995,
306341,
306344,
306347,
322734,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
126190,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
257334,
216376,
380226,
298306,
224584,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
290171,
314747,
306555,
290174,
298365,
224641,
281987,
298372,
314756,
281990,
224647,
265604,
298377,
314763,
142733,
298381,
314768,
224657,
306581,
314773,
314779,
314785,
314793,
282025,
282027,
241068,
241070,
241072,
282034,
241077,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
290291,
282101,
241142,
191992,
290298,
151036,
290302,
282111,
290305,
175621,
306694,
192008,
323084,
257550,
290321,
282130,
323090,
290325,
282133,
241175,
290328,
282137,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
282186,
224849,
282195,
282199,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
282261,
175770,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
306856,
196133,
282295,
282300,
323260,
323266,
282310,
323273,
282319,
306897,
241362,
306904,
282328,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
241450,
282410,
306988,
306991,
315184,
323376,
315190,
241464,
159545,
282425,
298811,
118593,
307009,
413506,
307012,
241475,
148946,
315211,
282446,
307027,
315221,
323414,
315223,
241496,
241498,
307035,
307040,
110433,
282465,
241509,
110438,
298860,
110445,
282478,
315249,
110450,
315251,
282481,
315253,
315255,
339838,
315267,
282499,
315269,
241544,
282505,
241546,
241548,
298896,
298898,
282514,
241556,
44948,
298901,
241560,
282520,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
36779,
241581,
282542,
241583,
323504,
241586,
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,
315860,
176597,
283095,
127447,
299481,
176605,
242143,
127457,
291299,
340454,
127463,
242152,
291305,
127466,
176620,
127469,
127474,
291314,
291317,
127480,
135672,
291323,
233979,
127485,
291330,
127490,
283142,
127494,
127497,
233994,
135689,
127500,
291341,
233998,
127506,
234003,
127509,
234006,
127511,
152087,
283161,
242202,
234010,
135707,
242206,
135710,
242208,
291361,
242220,
291378,
234038,
152118,
234041,
315961,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
291456,
135808,
373383,
299655,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
225948,
135839,
299680,
225954,
299684,
135844,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
119509,
226005,
226008,
299740,
242396,
201444,
299750,
283368,
234219,
283372,
226037,
283382,
316151,
234231,
234236,
226045,
242431,
234239,
209665,
234242,
299778,
242436,
226053,
234246,
226056,
234248,
291593,
242443,
234252,
242445,
234254,
291601,
234258,
242450,
242452,
234261,
348950,
201496,
234264,
234266,
234269,
283421,
234272,
234274,
152355,
299814,
234278,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
160572,
283452,
234302,
234307,
242499,
234309,
292433,
316233,
234313,
316235,
234316,
283468,
234319,
242511,
234321,
234324,
185173,
201557,
234329,
234333,
308063,
234336,
242530,
349027,
234338,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
291711,
234368,
291714,
234370,
291716,
234373,
201603,
226182,
234375,
308105,
324490,
226185,
234379,
234384,
234388,
234390,
324504,
234393,
209818,
308123,
324508,
234396,
291742,
226200,
234401,
291747,
291748,
234405,
291750,
234407,
324520,
324518,
324522,
234410,
291756,
226220,
291754,
324527,
291760,
234417,
201650,
324531,
234414,
226230,
234422,
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,
234501,
308231,
234504,
234507,
234510,
234515,
300054,
316439,
234520,
234519,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
144430,
234543,
234546,
275508,
300085,
234549,
300088,
234553,
234556,
234558,
316479,
234561,
316483,
160835,
234563,
308291,
234568,
234570,
316491,
234572,
300108,
234574,
300115,
234580,
234581,
242777,
234585,
275545,
234590,
234593,
234595,
234597,
300133,
234601,
300139,
234605,
160879,
234607,
275569,
234610,
316530,
300148,
234614,
398455,
144506,
234618,
234620,
275579,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
308373,
226453,
234647,
275606,
275608,
234650,
324757,
308379,
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,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
292338,
226802,
227440,
316917,
308727,
292343,
300537,
316933,
316947,
308757,
308762,
284191,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
194101,
284213,
316983,
194103,
284215,
308790,
284218,
226877,
292414,
284223,
284226,
284228,
292421,
226886,
284231,
128584,
243268,
284234,
276043,
317004,
366155,
284238,
226895,
284241,
194130,
284243,
300628,
284245,
276053,
284247,
317015,
284249,
243290,
284251,
235097,
284253,
300638,
284255,
243293,
284258,
292452,
292454,
284263,
177766,
284265,
292458,
284267,
292461,
284272,
284274,
284278,
292470,
276086,
292473,
284283,
276093,
284286,
292479,
284288,
292481,
284290,
325250,
284292,
292485,
276095,
276098,
284297,
317066,
284299,
317068,
284301,
276109,
284303,
284306,
276114,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
284329,
317098,
284331,
276137,
284333,
284335,
276144,
284337,
284339,
300726,
284343,
284346,
284350,
276160,
358080,
284354,
358083,
284358,
276166,
358089,
284362,
276170,
284365,
276175,
284368,
276177,
284370,
358098,
284372,
317138,
284377,
276187,
284379,
284381,
284384,
358114,
284386,
358116,
276197,
317158,
358119,
284392,
325353,
358122,
284394,
284397,
358126,
276206,
358128,
284399,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
300819,
317207,
284440,
300828,
300830,
276255,
300832,
325408,
300834,
317221,
227109,
358183,
186151,
276268,
300845,
243504,
300850,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
300872,
292681,
153417,
358224,
284499,
276308,
284502,
317271,
178006,
276315,
292700,
317279,
284511,
227175,
292715,
300912,
292721,
284529,
300915,
284533,
292729,
317306,
284540,
292734,
325512,
169868,
276365,
317332,
358292,
284564,
284566,
350106,
284572,
276386,
284579,
276388,
358312,
317353,
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,
243779,
325700,
284739,
292934,
243785,
350293,
350295,
309337,
194649,
227418,
350299,
350302,
227423,
350304,
178273,
309346,
194657,
194660,
350308,
309350,
309348,
292968,
309352,
227426,
276579,
227430,
276583,
309354,
301167,
276590,
350321,
350313,
350316,
284786,
350325,
252022,
276595,
350328,
292985,
301178,
350332,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
350366,
276638,
284837,
153765,
350375,
350379,
350381,
350383,
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,
277337,
301913,
301921,
400236,
236397,
162671,
326514,
310134,
236408,
15224,
277368,
416639,
416640,
113538,
310147,
416648,
39817,
187274,
277385,
301972,
424853,
277405,
277411,
310179,
293798,
293802,
236460,
277426,
293811,
293817,
293820,
203715,
326603,
276586,
293849,
293861,
228327,
228328,
318442,
228330,
326638,
277486,
318450,
293876,
293877,
285686,
302073,
121850,
293882,
302075,
285690,
244731,
293887,
277504,
277507,
277511,
293899,
277519,
293908,
302105,
293917,
293939,
318516,
277561,
277564,
310336,
7232,
293956,
277573,
228422,
293960,
310344,
277577,
277583,
203857,
293971,
310355,
310359,
236632,
277594,
138332,
277598,
203872,
277601,
285792,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
367737,
285817,
302205,
285821,
392326,
285831,
253064,
294026,
302218,
285835,
162964,
384148,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
302241,
285862,
277671,
302248,
64682,
277678,
294063,
294065,
302258,
277687,
294072,
318651,
294076,
277695,
318657,
244930,
302275,
130244,
302277,
228550,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
310486,
302296,
384222,
310498,
285927,
318698,
302315,
195822,
228592,
294132,
138485,
228601,
204026,
228606,
204031,
64768,
310531,
285958,
138505,
228617,
318742,
204067,
277798,
130345,
277801,
113964,
285997,
277804,
285999,
277807,
113969,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
417086,
277822,
286016,
302403,
294211,
384328,
277832,
277836,
294221,
294223,
326991,
277839,
277842,
277847,
277850,
179547,
277853,
146784,
277857,
302436,
277860,
294246,
327015,
310632,
327017,
351594,
277864,
277869,
277872,
351607,
310648,
277880,
310651,
277884,
277888,
310657,
351619,
294276,
310659,
327046,
277892,
253320,
310665,
318858,
277894,
277898,
277903,
310672,
351633,
277905,
277908,
277917,
310689,
277921,
130468,
228776,
277928,
277932,
310703,
277937,
310710,
130486,
310712,
277944,
310715,
277947,
302526,
228799,
277950,
277953,
302534,
310727,
64966,
245191,
163272,
277959,
277963,
302541,
277966,
302543,
310737,
277971,
228825,
163290,
277978,
310749,
277981,
277984,
310755,
277989,
277991,
187880,
277995,
310764,
286188,
278000,
228851,
310772,
278003,
278006,
40440,
212472,
278009,
40443,
286203,
310780,
40448,
228864,
286214,
228871,
302603,
65038,
302614,
286233,
302617,
302621,
286240,
146977,
187939,
40484,
294435,
40486,
286246,
294440,
40488,
294439,
294443,
40491,
294445,
278057,
310831,
245288,
286248,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
327240,
40521,
286283,
40525,
40527,
212560,
400976,
228944,
40533,
147032,
40537,
40539,
40541,
278109,
40544,
40548,
40550,
40552,
286313,
40554,
286312,
310892,
40557,
40560,
188022,
122488,
294521,
343679,
294537,
310925,
286354,
278163,
302740,
122517,
278168,
179870,
327333,
229030,
212648,
278188,
302764,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
294601,
302793,
343757,
212690,
319187,
278227,
286420,
229076,
286425,
319194,
278235,
301163,
278238,
229086,
286432,
294625,
294634,
302838,
319226,
286460,
278274,
302852,
278277,
302854,
294664,
311048,
352008,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
278320,
319280,
319290,
229192,
302925,
188247,
188252,
237409,
229233,
294776,
360317,
294785,
327554,
40840,
40851,
294803,
188312,
294811,
237470,
319390,
40865,
319394,
294817,
294821,
311209,
180142,
343983,
294831,
188340,
40886,
319419,
294844,
294847,
393177,
294876,
294879,
294883,
294890,
311279,
278513,
237555,
278516,
311283,
237562
] |
c6da8a29ec68adbda7837d30787e5841f72b9759 | 67023b8419dec5326e3bb101c06b2d38cd46c875 | /Week2/lecture/ScrollViewExample/ScrollViewExample/SceneDelegate.swift | 8d16776153c7e22b666829aa201a32984e980dad | [] | no_license | msseock/GURU_iOS_lecture | 6778597462af82df9a01faeea793b450b324b5b7 | 8b6f18c80fdefe2157ac77c74b70d760058a33bc | refs/heads/main | 2023-07-02T06:45:36.716778 | 2021-08-04T14:09:47 | 2021-08-04T14:09:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,299 | swift | //
// SceneDelegate.swift
// ScrollViewExample
//
// Created by 석민솔 on 2021/07/12.
//
import UIKit
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
guard let _ = (scene as? UIWindowScene) else { return }
}
func sceneDidDisconnect(_ scene: UIScene) {
// Called as the scene is being released by the system.
// This occurs shortly after the scene enters the background, or when its session is discarded.
// Release any resources associated with this scene that can be re-created the next time the scene connects.
// The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead).
}
func sceneDidBecomeActive(_ scene: UIScene) {
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
}
func sceneWillResignActive(_ scene: UIScene) {
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).
}
func sceneWillEnterForeground(_ scene: UIScene) {
// Called as the scene transitions from the background to the foreground.
// Use this method to undo the changes made on entering the background.
}
func sceneDidEnterBackground(_ scene: UIScene) {
// Called as the scene transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
}
}
| [
393221,
163849,
393228,
393231,
393251,
352294,
344103,
393260,
393269,
213049,
376890,
385082,
393277,
376906,
327757,
254032,
368728,
180314,
254045,
180322,
376932,
286833,
286845,
286851,
417925,
262284,
360598,
286880,
377003,
377013,
164029,
327872,
180418,
377030,
377037,
377047,
418008,
418012,
377063,
327915,
205037,
393457,
393461,
393466,
418044,
385281,
336129,
262405,
180491,
336140,
164107,
262417,
368913,
262423,
377118,
377121,
262437,
254253,
336181,
262455,
393539,
262473,
344404,
213333,
418135,
270687,
262497,
418145,
262501,
213354,
246124,
262508,
262512,
213374,
385420,
262551,
262553,
385441,
385444,
262567,
385452,
262574,
393649,
385460,
262587,
344512,
262593,
360917,
369119,
328178,
328180,
328183,
328190,
254463,
328193,
164362,
328207,
410129,
393748,
377372,
188959,
385571,
377384,
197160,
33322,
352822,
270905,
197178,
418364,
188990,
369224,
385610,
270922,
352844,
385617,
352865,
262761,
352875,
344694,
352888,
336513,
377473,
385671,
148106,
377485,
352919,
98969,
344745,
361130,
336556,
385714,
434868,
164535,
336568,
328379,
164539,
328387,
352969,
385743,
385749,
139998,
189154,
369382,
361196,
418555,
344832,
336644,
344837,
344843,
328462,
361231,
394002,
336660,
418581,
418586,
434971,
369436,
262943,
369439,
418591,
418594,
336676,
418600,
418606,
369464,
361274,
328516,
336709,
328520,
336712,
361289,
328523,
336715,
361300,
213848,
426842,
361307,
197469,
361310,
254813,
361318,
344936,
361323,
361335,
328574,
369544,
361361,
222129,
345036,
115661,
386004,
345046,
386012,
386019,
328690,
435188,
328703,
328710,
418822,
328715,
377867,
361490,
386070,
271382,
336922,
345119,
377888,
345134,
345139,
361525,
386102,
361537,
377931,
189525,
156762,
402523,
361568,
148580,
345200,
361591,
386168,
410746,
361594,
214150,
345224,
386187,
345247,
361645,
345268,
402615,
361657,
337093,
402636,
328925,
165086,
165092,
222438,
386286,
328942,
386292,
206084,
328967,
345377,
353572,
345380,
345383,
263464,
337207,
345400,
378170,
369979,
337224,
337230,
337235,
263509,
353634,
337252,
402792,
271731,
378232,
337278,
271746,
181639,
353674,
181644,
361869,
181650,
181655,
230810,
181671,
181674,
181679,
181682,
337330,
181687,
370105,
181691,
181697,
361922,
337350,
181704,
337366,
271841,
329192,
361961,
329195,
116211,
337399,
402943,
337416,
329227,
419341,
419345,
329234,
419351,
345626,
419357,
345631,
370208,
419360,
394787,
419363,
370214,
419369,
394796,
419377,
419386,
206397,
214594,
419401,
419404,
353868,
419408,
214611,
419412,
403040,
345702,
222831,
370298,
353920,
403076,
345737,
198282,
403085,
403092,
345750,
419484,
345758,
345763,
419492,
419498,
419502,
370351,
419507,
337588,
419510,
419513,
337601,
403139,
337607,
419528,
419531,
272083,
394967,
419545,
345819,
419548,
419551,
345829,
419560,
337643,
419564,
337647,
370416,
337671,
362249,
362252,
395022,
362256,
321300,
345888,
362274,
378664,
354107,
345916,
354112,
370504,
329545,
345932,
370510,
354132,
337751,
247639,
370520,
313181,
182110,
354143,
354157,
345965,
345968,
345971,
345975,
403321,
1914,
354173,
247692,
395148,
337809,
247701,
329625,
436127,
436133,
247720,
337834,
362414,
337845,
190393,
346059,
346064,
247760,
346069,
419810,
329699,
354275,
190440,
354314,
346140,
436290,
378956,
395340,
436307,
338005,
100454,
329833,
329853,
329857,
329868,
411806,
329886,
346273,
362661,
100525,
387250,
379067,
387261,
256193,
395467,
256214,
411862,
411865,
411869,
411874,
379108,
411877,
387303,
346344,
395496,
338154,
387307,
346350,
338161,
436474,
321787,
379135,
411905,
411917,
379154,
395539,
387350,
387353,
338201,
182559,
338212,
395567,
248112,
362823,
436556,
321880,
362844,
379234,
354674,
321911,
420237,
379279,
354728,
338353,
338382,
272849,
248279,
256474,
182755,
338404,
338411,
330225,
248309,
248332,
330254,
199189,
420377,
330268,
191012,
330320,
199250,
191069,
346722,
248427,
191085,
338544,
191093,
346743,
346769,
150184,
174775,
248505,
174778,
363198,
223936,
355025,
273109,
355029,
264919,
256735,
338661,
264942,
363252,
338680,
264965,
338701,
256787,
363294,
199455,
396067,
346917,
396070,
215854,
355123,
355141,
355144,
338764,
355151,
330581,
330585,
387929,
355167,
265056,
265059,
355176,
355180,
355185,
412600,
207809,
379849,
347082,
396246,
330711,
248794,
248799,
347106,
437219,
257009,
265208,
265215,
199681,
338951,
330761,
330769,
158759,
396329,
347178,
404526,
396337,
330803,
396340,
339002,
388155,
339010,
347208,
248905,
330827,
248915,
183384,
339037,
412765,
257121,
322660,
265321,
248952,
420985,
330886,
330890,
347288,
248986,
44199,
380071,
339118,
249018,
339133,
322763,
330959,
330966,
265433,
265438,
388320,
363757,
388348,
339199,
396552,
175376,
175397,
273709,
372016,
437553,
347442,
199989,
175416,
396601,
208189,
437567,
175425,
437571,
126279,
437576,
437584,
331089,
437588,
331094,
396634,
175451,
437596,
429408,
175458,
175461,
175464,
265581,
331124,
175478,
249210,
175484,
249215,
175487,
249219,
175491,
249225,
249228,
249235,
175514,
175517,
396703,
396706,
175523,
355749,
396723,
388543,
380353,
216518,
372166,
380364,
339406,
372177,
339414,
413143,
249303,
339418,
339421,
249310,
339425,
249313,
339429,
339435,
249329,
69114,
372229,
208399,
380433,
175637,
405017,
134689,
339504,
265779,
421442,
413251,
265796,
265806,
224854,
224858,
339553,
257636,
224871,
372328,
257647,
372338,
224885,
224888,
224891,
224895,
372354,
421509,
126597,
224905,
11919,
224911,
224914,
126611,
224917,
224920,
126618,
208539,
224923,
224927,
224930,
224933,
257705,
224939,
224943,
257713,
224949,
257717,
257721,
224954,
257725,
224960,
257733,
224966,
224970,
257740,
224976,
257745,
339664,
257748,
224982,
257752,
224987,
257762,
224996,
225000,
225013,
257788,
225021,
339711,
257791,
225027,
257796,
257802,
339722,
257805,
225039,
257808,
249617,
225044,
167701,
372500,
257815,
225049,
257820,
225054,
184096,
257825,
225059,
339748,
225068,
257837,
413485,
225071,
225074,
257843,
225077,
257846,
225080,
397113,
225083,
397116,
257853,
225088,
225094,
225097,
257869,
257872,
225105,
397140,
225109,
225113,
257881,
257884,
257887,
225120,
257891,
413539,
225128,
257897,
339818,
225138,
339827,
257909,
225142,
372598,
257914,
257917,
225150,
257922,
380803,
225156,
339845,
257927,
225166,
397201,
225171,
380823,
225176,
225183,
372698,
372704,
372707,
356336,
380919,
372739,
405534,
266295,
266298,
217158,
421961,
200786,
356440,
217180,
430181,
266351,
356467,
266365,
192640,
266375,
381069,
225425,
250003,
225430,
250008,
356507,
250012,
225439,
135328,
225442,
438434,
192674,
225445,
438438,
225448,
438441,
225451,
258223,
225456,
430257,
225459,
225462,
225468,
389309,
225472,
372931,
225476,
430275,
389322,
225485,
225488,
225491,
266454,
225494,
225497,
225500,
225503,
225506,
356580,
225511,
217319,
225515,
225519,
381177,
397572,
389381,
356638,
356641,
356644,
356647,
266537,
356650,
389417,
356656,
332081,
307507,
340276,
356662,
397623,
332091,
225599,
201030,
348489,
332107,
151884,
430422,
348503,
332118,
250201,
250203,
250211,
340328,
250217,
348523,
348528,
332153,
356734,
389503,
332158,
438657,
332162,
389507,
348548,
356741,
250239,
332175,
160152,
373146,
340380,
373149,
70048,
356783,
373169,
266688,
324032,
201158,
340452,
127473,
217590,
340473,
324095,
324100,
324103,
324112,
340501,
324118,
340512,
332325,
324134,
381483,
356908,
324141,
324143,
356917,
324150,
324156,
168509,
348734,
324161,
324165,
356935,
381513,
348745,
324171,
324174,
324177,
389724,
332381,
373344,
340580,
348777,
381546,
119432,
340628,
184983,
373399,
258723,
332460,
389806,
332464,
332473,
381626,
332484,
332487,
332494,
357070,
357074,
332512,
332521,
340724,
332534,
155647,
373499,
348926,
389927,
348979,
152371,
340792,
398141,
357202,
389971,
357208,
389979,
430940,
357212,
357215,
439138,
201580,
201583,
349041,
340850,
381815,
430967,
324473,
398202,
119675,
324476,
430973,
340859,
340863,
324479,
324482,
324485,
324488,
185226,
381834,
324493,
324496,
324499,
430996,
324502,
324511,
422817,
324514,
201638,
398246,
373672,
324525,
5040,
111539,
324534,
5047,
324539,
324542,
398280,
349129,
340940,
340942,
209874,
340958,
431073,
398307,
340964,
209896,
201712,
209904,
349173,
381947,
201724,
431100,
349181,
431107,
349203,
209944,
209948,
250915,
250917,
169002,
357419,
209966,
209969,
209973,
209976,
209980,
209988,
209991,
209996,
431180,
341072,
349268,
177238,
250968,
210011,
373853,
341094,
210026,
210028,
210032,
349296,
210037,
210042,
210045,
349309,
152704,
160896,
349313,
210053,
210056,
349320,
373905,
259217,
210068,
210072,
210078,
210081,
210085,
210089,
210096,
210100,
324792,
210108,
357571,
210116,
210128,
210132,
333016,
210139,
210144,
218355,
218361,
275709,
128254,
275713,
242947,
275717,
275723,
349460,
333079,
251161,
349486,
349492,
415034,
210261,
365912,
259423,
374113,
251236,
374118,
333164,
234867,
390518,
357756,
374161,
112021,
349591,
333222,
259516,
415168,
366035,
415187,
366039,
415192,
415194,
415197,
415200,
333285,
415208,
366057,
366064,
415217,
415225,
423424,
415258,
415264,
366118,
415271,
382503,
349739,
144940,
415279,
415282,
415286,
210488,
415291,
415295,
333396,
333400,
366173,
423529,
423533,
210547,
415354,
333440,
267910,
267929,
333512,
259789,
366301,
333535,
153311,
366308,
366312,
431852,
399086,
366319,
210673,
366322,
399092,
366326,
333566,
268042,
210700,
366349,
210707,
399129,
333595,
210720,
358192,
366384,
366388,
210740,
358201,
325441,
366403,
325447,
341831,
341835,
341839,
341844,
415574,
358235,
341852,
350046,
399200,
399208,
358256,
268144,
358260,
341877,
399222,
325494,
333690,
325505,
333699,
399244,
333709,
333725,
333737,
382891,
382898,
350153,
358348,
333777,
219094,
399318,
358372,
350190,
350194,
333819,
350204,
350207,
325633,
325637,
350214,
268299,
333838,
350225,
350232,
333851,
350238,
350241,
374819,
350245,
350249,
350252,
178221,
350257,
350260,
350272,
243782,
350281,
350286,
374865,
342113,
252021,
342134,
374904,
268435,
333998,
334012,
260299,
350411,
350417,
350423,
211161,
350426,
350449,
358645,
350459,
350462,
350465,
350469,
268553,
350477,
268560,
350481,
432406,
350487,
325915,
350491,
325918,
350494,
325920,
350500,
350505,
358701,
391469,
350510,
358705,
358714,
358717,
383307,
358738,
334162,
383331,
383334,
391531,
383342,
334204,
268669,
194942,
391564,
366991,
334224,
268702,
342431,
375209,
375220,
334263,
326087,
358857,
195041,
334312,
104940,
375279,
350724,
186898,
342546,
350740,
342551,
334359,
342555,
334364,
416294,
350762,
252463,
358962,
334386,
334397,
358973,
252483,
219719,
399957,
334425,
326240,
375401,
334466,
334469,
162446,
326291,
342680,
342685,
260767,
342711,
244410,
260798,
260802,
350918,
154318,
342737,
391895,
154329,
416476,
64231,
113389,
342769,
203508,
375541,
342777,
391938,
391949,
375569,
326417,
375572,
375575,
375580,
162592,
334633,
326444,
383794,
326452,
326455,
375613,
244542,
260925,
375616,
326463,
326468,
342857,
326474,
326479,
326486,
416599,
342875,
326494,
433001,
400238,
326511,
211826,
211832,
392061,
351102,
359296,
252801,
260993,
351105,
400260,
211846,
342921,
342931,
400279,
252823,
392092,
400286,
252838,
359335,
211885,
400307,
351169,
359362,
351172,
170950,
359367,
326599,
187335,
359383,
359389,
383968,
343018,
359411,
261109,
261112,
244728,
383999,
261130,
261148,
359452,
211999,
261155,
261160,
261166,
359471,
375868,
343132,
384099,
384102,
384108,
367724,
187503,
343155,
384115,
212095,
384136,
384140,
384144,
351382,
384152,
384158,
384161,
351399,
384169,
367795,
244917,
384182,
367801,
384189,
351424,
384192,
343232,
367817,
244938,
384202,
253132,
326858,
384209,
146644,
351450,
384225,
359650,
343272,
351467,
359660,
384247,
351480,
384250,
351483,
351492,
343307,
384270,
261391,
359695,
253202,
261395,
384276,
384284,
245021,
384290,
253218,
245032,
171304,
384299,
351535,
376111,
245042,
326970,
384324,
343366,
212296,
212304,
367966,
343394,
367981,
343410,
155000,
327035,
245121,
245128,
253321,
155021,
384398,
245137,
245143,
245146,
245149,
343453,
245152,
245155,
155045,
245158,
40358,
245163,
114093,
327090,
343478,
359867,
384444,
146878,
327108,
327112,
384457,
359887,
359891,
368093,
155103,
343535,
343540,
368120,
343545,
409092,
359948,
359951,
245295,
359984,
400977,
400982,
179803,
155241,
245358,
155255,
155274,
368289,
245410,
425652,
425663,
155328,
245463,
155352,
155356,
212700,
155364,
245477,
155372,
245487,
212723,
409336,
155394,
155404,
245528,
155423,
360224,
155439,
204592,
155444,
155448,
417596,
384829,
384831,
360262,
155463,
155477,
376665,
155484,
261982,
425823,
376672,
155488,
155492,
327532,
261997,
376686,
262000,
262003,
327542,
147319,
262006,
262009,
425846,
262012,
155517,
155523,
155526,
360327,
376715,
155532,
262028,
262031,
262034,
262037,
262040,
262043,
155550,
253854,
262046,
262049,
262052,
327590,
155560,
155563,
155566,
327613,
393152,
311244,
393170,
155604,
155620,
253924,
155622,
327655,
253927,
360432,
393204,
360439,
253944,
393209,
393215
] |
5486ba75ee6360d3a22ec8c969ad1393ece763fd | 4afbcf9562a6cd0626c3d51a284d472e7ad8f4ff | /annimal.swift | 66fb3e60e7ac1a410320e3b9bf775b615a5fca19 | [] | no_license | libull/ok | 3d1895365eb518b47c4aa76513dab701c112ad71 | 0a5efeee96a1e8be2f51a83c094d53b8a00009ce | refs/heads/master | 2021-08-23T20:25:17.905076 | 2017-12-06T11:52:09 | 2017-12-06T11:52:09 | 113,309,962 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 77 | swift | //
// Created by libull on 17/12/6.
//
import Foundation
class annimal {
}
| [
-1
] |
d6a896f2c89088d5cab326dc8675f3c0033c2c6f | 3ef871ec5572a2da320906b5cc22368b29ee7394 | /Postuparium/Modules/StartScreen/ProgramsSelection/ProgramsSelectionViewContoller.swift | 90b72a49ef7a56c6695aa6301a4db02538c5db38 | [] | no_license | mikstime/ege_front | f8c6293037e759d498e7c3275d739f47683473e5 | 3a201c510d3b355bcfa6e899b54df1dae9003526 | refs/heads/master | 2023-02-07T08:55:10.029818 | 2020-12-29T17:17:21 | 2020-12-29T17:17:21 | 299,357,717 | 0 | 0 | null | 2020-12-29T17:17:22 | 2020-09-28T15:49:40 | null | UTF-8 | Swift | false | false | 5,367 | swift | //
// ProgramsSelectionViewContoller.swift
// Postuparium
//
// Created by Сергей Петренко on 12.10.2020.
//
import UIKit
class ProgramsSelectionViewController: SwipeableViewController, LoadableScreen, ProgramsSelectionViewControllerProtocol, UITextFieldDelegate {
var message1: String!
var message2: String!
var loader: UIView?
var presenter: ProgramsSelectionPresenterProtocol!
@IBOutlet weak var scrollView: UIScrollView!
@IBOutlet weak var selectedProgramsView: UIStackView!
@IBOutlet weak var selectedProgramsHeightConstraint: NSLayoutConstraint!
@IBAction func showNextScreen() {
presenter?.showNextScreen()
}
var menu: ProgramsSelectionMenuViewControllerProtocol!
override func viewDidLoad() {
menu = ProgramsSelectionMenuConfigurator.configureModule()
menu.actionsDispatcher = self
cardViewController = menu
super.viewDidLoad()
presenter?.viewDidLoad()
hideKeyboardWhenTappedAround()
updateSelectedProgramsView()
setupScrollView()
view.layoutIfNeeded()
}
func setupScrollView() {
view.addGestureRecognizer(scrollView.panGestureRecognizer)
}
@IBAction func OpenProgramsSelectionMenu() {
menu.totalOffset = 0
showCard()
}
override var preferredStatusBarStyle: UIStatusBarStyle {
return .lightContent
}
// MARK: - Navigation methods
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
presenter.router.prepare(for: segue, sender: sender)
}
}
extension ProgramsSelectionViewController: ProgramsSelectionItemDispatcherProtocol {
func updateSelectedProgramsView() {
if selectedProgramsView.subviews.count == 0 {
selectedProgramsHeightConstraint.constant = 0
} else if selectedProgramsView.subviews.count == 1 {
selectedProgramsHeightConstraint.constant = 58
} else if selectedProgramsView.subviews.count == 2 {
selectedProgramsHeightConstraint.constant = 58 * 2 + 20
} else if selectedProgramsView.subviews.count == 3 {
selectedProgramsHeightConstraint.constant = 58 * 3 + 20 * 2
} else {
selectedProgramsHeightConstraint.constant = 58 * 3 + 20 * 3 + 6
}
}
func searchFor(searchString: String) {
presenter?.searchPrograms(searchString: searchString)
}
func addProgram(program: EdProgram) {
let programView = ProgramsSelectionItem()
programView.source = program
programView.translatesAutoresizingMaskIntoConstraints = false
selectedProgramsView.addArrangedSubview(programView)
programView.actionDispatcher = self
NSLayoutConstraint(item: programView, attribute: .leading, relatedBy: .equal, toItem: selectedProgramsView, attribute: .leading, multiplier: 1, constant: 0).isActive = true
NSLayoutConstraint(item: programView, attribute: .trailing, relatedBy: .equal, toItem: selectedProgramsView, attribute: .trailing, multiplier: 1, constant: 0).isActive = true
NSLayoutConstraint(item: programView, attribute: .height, relatedBy: .equal, toItem: nil, attribute: .notAnAttribute, multiplier: 1, constant: 58).isActive = true
}
func tappedRemoveProgram(programView: ProgramsSelectionItem!) {
programView.removeFromSuperview()
menu.deselectProgram(program: programView.source)
updateSelectedProgramsView()
UIView.animate(withDuration: 0.3) {
self.view.layoutIfNeeded()
}
updatePresenterData()
}
}
extension ProgramsSelectionViewController: ProgramsSelectionMenuActionDispatcherProtocol {
func didTapOnCell(row: Int, program: EdProgram) {
let thatView = selectedProgramsView.subviews.first { programView in
let pw = programView as? ProgramsSelectionItem ?? ProgramsSelectionItem()
if pw.source.id == program.id {
return true
} else {
return false
}
}
if thatView != nil {
thatView?.removeFromSuperview()
updateSelectedProgramsView()
self.view.layoutIfNeeded()
} else {
addProgram(program: program)
self.view.layoutIfNeeded()
updateSelectedProgramsView()
UIView.animate(withDuration: 0.3) {
self.view.layoutIfNeeded()
}
if selectedProgramsView.subviews.count > 3 {
let bottomOffset = CGPoint(x: 0, y: scrollView.contentSize.height - scrollView.bounds.size.height)
scrollView.setContentOffset(bottomOffset, animated: true)
}
}
updatePresenterData()
}
func updatePresenterData() {
let programs = selectedProgramsView.subviews.map{ programView -> EdProgram in
let pw = programView as? ProgramsSelectionItem ?? ProgramsSelectionItem()
return pw.source
}
presenter?.setPrograms(programs: programs)
}
func requestForMoreData() {
presenter?.requestMoreData()
}
func programsDidLoad(programs: [EdProgram]) {
menu?.didLoadMoreData(newPrograms: programs)
}
}
| [
-1
] |
f746fafb708b3cd6dc90e4151afd434c5ab30671 | 37f325ebb336bbeb8bb1d5232db3df1c0c826a10 | /Sources/TDLibKit/Generated/Models/GetChatEventLog.swift | 45440b2dc47b36e3c52ab0cbe6080852f4a7348f | [
"MIT"
] | permissive | Swiftgram/TDLibKit | 9cdf8d479872792cc03824e0c12d3f93edab4b13 | 428e713cdbb92706033d2fa9083ff545d46c2055 | refs/heads/main | 2023-08-31T03:32:11.243396 | 2023-08-26T22:20:53 | 2023-08-26T22:20:53 | 386,682,104 | 47 | 19 | MIT | 2023-08-09T16:36:59 | 2021-07-16T15:25:10 | Swift | UTF-8 | Swift | false | false | 1,549 | swift | //
// GetChatEventLog.swift
// tl2swift
//
// Generated automatically. Any changes will be lost!
// Based on TDLib 1.8.16-470c36ce
// https://github.com/tdlib/td/tree/470c36ce
//
import Foundation
/// Returns a list of service actions taken by chat members and administrators in the last 48 hours. Available only for supergroups and channels. Requires administrator rights. Returns results in reverse chronological order (i.e., in order of decreasing event_id)
public struct GetChatEventLog: Codable, Equatable, Hashable {
/// Chat identifier
public let chatId: Int64?
/// The types of events to return; pass null to get chat events of all types
public let filters: ChatEventLogFilters?
/// Identifier of an event from which to return results. Use 0 to get results from the latest events
public let fromEventId: TdInt64?
/// The maximum number of events to return; up to 100
public let limit: Int?
/// Search query by which to filter events
public let query: String?
/// User identifiers by which to filter events. By default, events relating to all users will be returned
public let userIds: [Int64]?
public init(
chatId: Int64?,
filters: ChatEventLogFilters?,
fromEventId: TdInt64?,
limit: Int?,
query: String?,
userIds: [Int64]?
) {
self.chatId = chatId
self.filters = filters
self.fromEventId = fromEventId
self.limit = limit
self.query = query
self.userIds = userIds
}
}
| [
-1
] |
59c526df25bcf24c40c0c559dfaee818bfbb06f6 | e5ad1cefaa901f2b31c50b63c59babd4779eaaa4 | /what a beautiful view/what a beautiful view/AppDelegate.swift | a8f9e888693f53e5e603893cc4fd522d38643dd8 | [] | no_license | songty11/iOS_App | 4189de6ba2371eaf6a2d16eedd78329646ae151e | ed73119bd66042d5b8365c89a4bd52d3e14af1c6 | refs/heads/master | 2021-01-10T03:36:26.138098 | 2016-04-13T17:13:29 | 2016-04-13T17:13:29 | 55,918,436 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,102 | swift | //
// AppDelegate.swift
// what a beautiful view
//
// Created by 宋天瑜 on 16/1/30.
// Copyright © 2016年 Tianyu Song. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
let defaults = NSUserDefaults.standardUserDefaults()
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
/// - Attributions: http://nshipster.com/uiappearance/
//modifie the color of NavigationBar and TabBar, Make it Gorgeous
UINavigationBar.appearance().backgroundColor = UIColor.grayColor()
UINavigationBar.appearance().tintColor = UIColor(red:251.0/255.0,green:145.0/255.0,blue:0.0/255.0,alpha:1.0)
UITabBar.appearance().tintColor = UIColor(red:251.0/255.0,green:145.0/255.0,blue:0.0/255.0,alpha:1.0)
/// - Attributions: https://www.hackingwithswift.com/read/12/2/reading-and-writing-basics-nsuserdefaults
//Remember the First Launch with Defaults
if(defaults.objectForKey("firstLaunch") != nil)
{
print ("Not First Launch: ✌️")
}
else
{
defaults.setObject(NSDate(), forKey: "firstLaunch")
print ("First 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,
229388,
294924,
229391,
327695,
229394,
229397,
229399,
229402,
229405,
229408,
294950,
229415,
229417,
237613,
229422,
229426,
237618,
229428,
286774,
229432,
286776,
319544,
286791,
237640,
237646,
311375,
163920,
311383,
319590,
311400,
303212,
131192,
237693,
327814,
303241,
311436,
319633,
286873,
286876,
311460,
32944,
327862,
286906,
180413,
286910,
131264,
286922,
286924,
286926,
319694,
131281,
278743,
278747,
295133,
155872,
319716,
237807,
303345,
131314,
286962,
327930,
278781,
278783,
278785,
237826,
319751,
278792,
286987,
319757,
311569,
286999,
287003,
287006,
287009,
287012,
287014,
287019,
311598,
287032,
155966,
278849,
319809,
319810,
319814,
311628,
229709,
287054,
319822,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
65943,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
98756,
278980,
319945,
278986,
319947,
278990,
278994,
172512,
279010,
279015,
172520,
319978,
172526,
279023,
311791,
279027,
319989,
180727,
164343,
311804,
287230,
279040,
303617,
287234,
172550,
287238,
172552,
303623,
320007,
279051,
172558,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
279082,
311850,
279084,
172591,
172598,
279095,
172607,
172612,
377413,
172614,
172618,
303690,
33357,
287309,
279124,
172634,
262752,
311911,
295533,
172655,
172656,
352880,
295538,
172660,
287349,
287355,
287360,
295553,
287365,
311942,
303751,
352905,
279178,
287371,
311946,
287377,
311957,
221850,
287386,
164509,
172702,
230045,
287390,
172705,
287394,
172707,
303773,
303780,
287398,
279208,
287400,
172714,
295595,
279212,
189102,
172721,
287409,
303797,
189114,
287419,
303804,
328381,
279231,
287423,
287427,
312006,
107212,
172748,
287436,
172751,
295633,
172755,
303827,
279255,
172760,
279258,
287450,
213724,
189149,
303835,
303838,
279267,
312035,
295654,
279272,
312048,
312050,
230131,
205564,
295685,
230154,
312077,
295695,
369433,
295707,
328476,
295710,
303914,
279340,
205613,
279353,
230202,
222018,
295755,
377676,
287569,
230241,
279394,
303976,
336744,
303985,
303987,
328563,
279413,
303991,
303997,
295806,
295808,
295813,
304005,
213895,
304007,
304009,
320391,
304011,
230284,
304013,
279438,
295822,
189329,
189331,
58262,
279452,
410526,
279461,
304042,
213931,
230327,
304055,
304063,
295873,
189378,
213954,
304065,
213963,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
312321,
295945,
197645,
230413,
295949,
140312,
238620,
197663,
304164,
304170,
238641,
312374,
238652,
230465,
238658,
296004,
336964,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
164973,
279669,
337018,
222340,
296084,
238745,
304285,
238756,
205991,
165035,
337067,
165038,
238766,
304311,
230592,
279750,
230600,
230607,
148690,
279769,
304348,
279777,
304354,
296163,
279781,
304360,
279788,
320748,
279790,
320771,
312585,
230674,
320786,
230677,
296213,
296215,
320792,
230681,
173350,
312622,
296243,
312630,
222522,
230718,
296255,
378181,
230727,
222545,
230739,
312663,
222556,
337244,
312676,
230760,
173418,
230763,
230768,
296305,
230773,
304505,
304506,
181631,
312711,
288140,
230800,
288144,
304533,
288154,
337306,
288160,
288162,
279975,
304555,
370092,
279983,
173488,
312755,
296373,
279991,
312759,
337335,
173507,
296389,
222665,
230860,
230865,
370130,
148946,
288210,
222676,
280021,
288212,
288214,
239064,
288217,
288218,
329177,
288220,
239070,
288224,
280034,
288226,
280036,
288229,
280038,
288230,
288232,
320998,
288234,
370146,
288238,
288240,
288242,
296435,
288244,
288250,
148990,
296446,
206336,
321022,
296450,
402942,
230916,
214535,
230919,
304651,
222752,
108066,
296488,
230961,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
280152,
288344,
239194,
181854,
280158,
370272,
403039,
239202,
312938,
280183,
280185,
280188,
280191,
116354,
280194,
280208,
280211,
288408,
280218,
280222,
190118,
321195,
321200,
296634,
280260,
280264,
280276,
313044,
321239,
280283,
288478,
321252,
313066,
280302,
288494,
280304,
313073,
419570,
288499,
288502,
288510,
67330,
280324,
198416,
280337,
296723,
321304,
329498,
296731,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
321336,
296767,
345921,
304968,
280393,
280402,
313176,
280419,
321381,
296812,
313201,
1920,
255873,
305028,
247688,
280464,
124817,
280473,
124827,
214940,
247709,
280487,
313258,
321458,
296883,
124853,
214966,
10170,
296890,
288700,
296894,
190403,
280515,
296900,
337862,
165831,
280521,
296921,
239586,
313320,
231404,
124913,
165876,
321528,
239612,
288764,
239617,
313347,
288773,
313358,
305176,
313371,
354338,
305191,
313386,
354348,
124978,
215090,
124980,
288826,
313406,
288831,
67654,
280651,
354382,
288848,
354390,
280669,
223327,
280671,
321634,
149603,
329830,
280681,
313451,
280687,
215154,
280691,
313458,
313464,
321659,
280702,
288895,
141446,
215175,
321670,
141455,
141459,
280725,
313498,
100520,
288936,
280747,
288940,
321717,
280764,
280769,
280771,
280774,
280783,
280786,
280793,
280796,
338147,
280804,
280807,
157930,
280811,
280817,
125171,
157940,
280825,
280827,
280830,
280831,
125187,
280835,
125191,
125207,
125209,
321817,
321842,
223539,
280888,
289087,
280897,
239944,
305480,
239947,
305485,
305489,
379218,
280919,
354653,
313700,
280937,
280946,
223606,
313720,
280956,
280959,
313731,
199051,
240011,
240017,
190868,
297365,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
289210,
305594,
281024,
289221,
289227,
281045,
281047,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
240132,
305668,
281095,
223752,
338440,
150025,
223757,
281102,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
150066,
158262,
158266,
281154,
322115,
281163,
281179,
338528,
281190,
281196,
19053,
158317,
313973,
281210,
297594,
158347,
133776,
117398,
314007,
289436,
174754,
330404,
174764,
240309,
133817,
314045,
314047,
199364,
297671,
158409,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322318,
281372,
322341,
215850,
281388,
281401,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
281442,
174955,
224110,
207733,
207737,
158596,
183172,
240519,
322440,
314249,
240535,
289687,
289694,
289696,
289724,
52163,
281567,
289762,
322534,
297961,
183277,
322550,
134142,
322563,
175134,
322599,
322610,
314421,
281654,
314427,
207937,
314433,
314441,
207949,
322642,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
248995,
306341,
306344,
306347,
306354,
142531,
289991,
249045,
363745,
298216,
126190,
216303,
322801,
257302,
363802,
199976,
199978,
298292,
257334,
298306,
224584,
224587,
224594,
216404,
150870,
224603,
265568,
281960,
306539,
290161,
216436,
306549,
298358,
306552,
290171,
298365,
290174,
224641,
281987,
265604,
298372,
281990,
298377,
142733,
298381,
224657,
306581,
282025,
282027,
241068,
241070,
241072,
282034,
241077,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
339431,
282089,
191985,
282098,
290291,
282101,
151036,
290302,
282111,
290305,
175621,
192008,
323084,
257550,
290321,
282130,
323090,
282133,
290325,
241175,
290328,
282137,
290332,
241181,
282144,
290344,
290349,
290351,
290356,
224849,
282195,
282199,
282201,
306778,
159330,
314979,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
282261,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
306856,
282295,
282300,
323260,
323266,
282310,
323273,
282319,
306897,
241362,
282328,
298714,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
282402,
315174,
241450,
282410,
306991,
315184,
323376,
315190,
241464,
282425,
307009,
241475,
307012,
315211,
282446,
315221,
323414,
315223,
241496,
241498,
307035,
307040,
110433,
241509,
110438,
110445,
282478,
282481,
110450,
315249,
315251,
315253,
315255,
339838,
282499,
315267,
315269,
241544,
282505,
241546,
241548,
298896,
282514,
298898,
241556,
298901,
241560,
241563,
241565,
241567,
241569,
241574,
282537,
298922,
36779,
241581,
282542,
241583,
323504,
241586,
282547,
241588,
290739,
241590,
241592,
241598,
290751,
241600,
241605,
151495,
241610,
298975,
241632,
241640,
298984,
241643,
298988,
241646,
241649,
241652,
323574,
290807,
299006,
282623,
241669,
315397,
282632,
282639,
290835,
282645,
241693,
282654,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
192596,
176213,
307287,
315482,
315483,
192605,
233567,
200801,
217188,
299109,
307303,
45163,
307307,
315502,
307314,
323700,
299126,
233591,
299136,
307329,
307338,
233613,
307352,
299164,
315557,
184486,
307370,
184492,
307372,
307374,
307376,
176311,
184503,
307386,
258235,
176316,
307388,
307390,
184512,
307394,
299204,
184518,
323784,
307409,
176343,
299225,
233701,
184572,
184579,
282893,
291089,
282906,
233766,
176435,
168245,
307510,
315701,
332086,
307515,
282942,
307518,
282957,
110926,
323917,
233808,
323921,
315733,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
315771,
299388,
299398,
242057,
291212,
299405,
291222,
283033,
242075,
61855,
283042,
291238,
291241,
127403,
127405,
127407,
291247,
291254,
127417,
291260,
127421,
127429,
315856,
315860,
176597,
127447,
299481,
176605,
242143,
291299,
242152,
291305,
176620,
291314,
291317,
135672,
233979,
291323,
291330,
283142,
127497,
135689,
233994,
291341,
233998,
234003,
234006,
234010,
135707,
242206,
135710,
291361,
242220,
291378,
152118,
234038,
70213,
111193,
242275,
299620,
168562,
184952,
135805,
135808,
291456,
299655,
373383,
316051,
225941,
316054,
299672,
135834,
225948,
373404,
135839,
299680,
225954,
299684,
242343,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
225998,
226002,
226005,
226008,
242396,
299740,
201444,
299750,
283368,
234219,
283372,
226037,
283382,
234231,
234236,
242431,
209665,
234242,
242436,
234246,
226056,
234248,
291593,
242443,
242445,
234254,
234258,
242450,
242452,
201496,
234269,
234272,
234274,
152355,
234278,
299814,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
160572,
283452,
234302,
234307,
242499,
234309,
234313,
316235,
234316,
283468,
234319,
242511,
234321,
234324,
201557,
234329,
234333,
308063,
234336,
234338,
242530,
349027,
234344,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
291711,
234368,
234370,
291714,
291716,
234373,
226182,
234375,
226185,
308105,
234384,
234388,
234390,
226200,
234393,
308123,
234396,
324508,
291742,
234401,
291748,
234405,
291750,
234407,
324518,
324520,
291754,
226220,
291756,
234414,
291760,
201650,
226230,
234422,
275384,
234428,
291773,
226239,
234431,
242623,
234434,
324548,
226245,
234437,
234439,
234443,
291788,
193486,
234446,
193488,
234449,
275406,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234478,
234481,
234484,
234485,
234487,
234493,
234496,
316416,
234501,
308231,
234504,
234507,
234515,
300054,
234519,
234520,
316439,
234523,
234528,
300066,
234532,
234535,
234537,
234540,
234543,
275508,
234549,
300085,
300088,
234558,
316479,
234561,
234563,
316483,
234568,
234570,
316491,
234572,
300108,
300115,
234580,
234581,
234585,
242777,
275545,
234595,
234597,
300133,
300139,
234605,
160879,
234607,
275569,
234610,
234614,
144506,
234618,
234620,
275579,
234623,
226433,
234627,
275588,
234634,
234636,
234640,
275602,
234643,
324757,
226453,
275606,
234647,
234648,
275608,
234650,
308373,
308379,
234653,
283805,
119967,
300189,
234657,
324766,
242852,
300197,
275626,
316596,
234687,
300226,
234692,
283844,
300229,
308420,
283850,
300234,
300238,
300241,
316625,
300243,
300245,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
161003,
300267,
300270,
300272,
120053,
300278,
316663,
300284,
275710,
300287,
300289,
300292,
300294,
275719,
177419,
300299,
242957,
275725,
283917,
177424,
349464,
283939,
259367,
283951,
300344,
226617,
243003,
226628,
300357,
177482,
283983,
316758,
357722,
316766,
218464,
316768,
292197,
243046,
316774,
218473,
136562,
275834,
333178,
275836,
275840,
316806,
226696,
226699,
316811,
300433,
234899,
357783,
316826,
300448,
144810,
144812,
144814,
144820,
284084,
284087,
292279,
144826,
144828,
144830,
144832,
144835,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
292329,
300523,
259565,
259567,
300527,
316917,
308727,
300537,
308757,
308762,
284194,
284196,
235045,
284199,
284206,
284209,
284211,
194101,
284213,
194103,
284215,
284218,
226877,
284223,
284226,
284228,
292421,
226886,
284231,
284234,
276043,
317004,
366155,
284238,
226895,
284241,
194130,
284243,
284245,
276053,
284247,
317015,
284249,
243290,
284253,
243293,
284255,
300638,
284258,
292452,
177766,
292454,
292458,
284267,
292461,
284274,
276086,
284278,
292470,
292473,
284283,
276093,
284286,
292479,
284288,
276098,
284290,
284292,
292485,
325250,
284297,
317066,
284299,
317068,
284301,
284303,
276114,
284306,
284308,
284312,
284314,
284316,
276127,
284322,
284327,
276137,
284329,
284331,
317098,
284333,
284335,
284337,
284339,
300726,
284343,
284346,
284350,
276160,
358080,
284354,
284358,
358089,
276170,
284362,
276175,
284368,
276177,
284370,
317138,
284372,
358098,
284377,
358116,
276197,
325353,
358122,
276206,
358126,
358128,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
284418,
317187,
358146,
317191,
284428,
300816,
317207,
300828,
300830,
276255,
300832,
227109,
317221,
186151,
358183,
276268,
243504,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
300872,
153417,
284499,
276308,
178006,
284502,
317271,
276315,
292700,
284511,
227175,
292715,
284529,
292721,
300915,
284533,
317306,
284540,
292734,
325512,
169868,
350106,
284572,
276386,
284579,
276388,
292776,
284585,
358312,
276395,
276402,
161718,
358326,
358330,
276411,
276425,
301009,
301011,
301013,
301015,
358360,
301017,
292828,
153568,
292843,
227314,
325624,
317435,
292876,
276496,
317456,
317458,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
276528,
243762,
309298,
325685,
325689,
235579,
276539,
325692,
178238,
309337,
227418,
227423,
178273,
227426,
276579,
194660,
227430,
292968,
309352,
276586,
301163,
309354,
227440,
284786,
276595,
292985,
301178,
292989,
292993,
301185,
301199,
350354,
350359,
276638,
153765,
284837,
227520,
227522,
301252,
227529,
301258,
276685,
276689,
301272,
276699,
194780,
309468,
301283,
317672,
243948,
194801,
309494,
243960,
227583,
276735,
276739,
211204,
276742,
227596,
325910,
309530,
342298,
211232,
211241,
325937,
325943,
260421,
285002,
276811,
276816,
235858,
276829,
276833,
276836,
276843,
293227,
276848,
293232,
186744,
211324,
317833,
178572,
285070,
178583,
227738,
317853,
317858,
342434,
285093,
285098,
276907,
293304,
293314,
293325,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
293346,
276964,
293352,
236013,
293364,
317951,
309764,
236043,
317963,
342541,
55822,
113167,
317971,
309781,
55837,
227879,
227882,
293421,
105007,
236082,
285236,
23094,
277054,
244288,
301636,
285265,
277080,
309849,
285277,
285282,
326244,
277100,
121458,
170618,
170619,
309885,
309888,
277122,
227975,
277128,
285320,
301706,
318092,
326285,
318094,
334476,
277136,
277139,
227992,
285340,
318108,
227998,
318110,
285357,
318128,
277170,
293555,
154292,
277173,
342707,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
137946,
113378,
203491,
228069,
277223,
342760,
56041,
285417,
277232,
228081,
56059,
310015,
310020,
310029,
228113,
285459,
277273,
326430,
228135,
318248,
277291,
318253,
285489,
293685,
285494,
285499,
301884,
310080,
277317,
277329,
162643,
310100,
301911,
277337,
301921,
400236,
236397,
162671,
326514,
15224,
236408,
277368,
416639,
416640,
113538,
310147,
416648,
39817,
187274,
277385,
301972,
424853,
310179,
293798,
293802,
236460,
293811,
293817,
293820,
203715,
326603,
293849,
293861,
228327,
228328,
318442,
277486,
326638,
318450,
293877,
285686,
302073,
121850,
293882,
302075,
293887,
277504,
277507,
277511,
277519,
293908,
293917,
293939,
318516,
277561,
277564,
7232,
310336,
293956,
277573,
228422,
293960,
277577,
310344,
277583,
203857,
293971,
310359,
236632,
277594,
138332,
277598,
203872,
277601,
285792,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
285817,
367737,
302205,
294026,
285835,
302218,
162964,
384148,
187542,
302231,
302233,
285852,
302237,
285854,
285862,
277671,
302248,
64682,
277678,
294063,
294065,
302258,
294072,
318651,
277695,
318657,
302275,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
302296,
384222,
310498,
285927,
318698,
302315,
228592,
294132,
138485,
204026,
228606,
204031,
64768,
310531,
138505,
228617,
318742,
204067,
277801,
277804,
285997,
277807,
285999,
113969,
277811,
318773,
277816,
318776,
286010,
277819,
294204,
277822,
417086,
294211,
302403,
277832,
277836,
277839,
326991,
277842,
277847,
277850,
179547,
277853,
277857,
277860,
302436,
294246,
327015,
277864,
310632,
327017,
351594,
277869,
277872,
351607,
277880,
310648,
310651,
277884,
277888,
310657,
310659,
277892,
294276,
277894,
327046,
253320,
310665,
277898,
318858,
351619,
277903,
310672,
277905,
351633,
277908,
277917,
277921,
310689,
130468,
277928,
277932,
310703,
277937,
130486,
310710,
277944,
310712,
277947,
310715,
277950,
277953,
64966,
245191,
277959,
302534,
310727,
277963,
277966,
302543,
277971,
228825,
277978,
277981,
310749,
277984,
310755,
277989,
277991,
277995,
286188,
310764,
278000,
228851,
278003,
278006,
40440,
212472,
278009,
40443,
286203,
228864,
286214,
302603,
302614,
286233,
286240,
146977,
187939,
40484,
294435,
40486,
286246,
40488,
286248,
294439,
40491,
294440,
294443,
294445,
310831,
212538,
40507,
40511,
40513,
40521,
286283,
40525,
40527,
212560,
228944,
400976,
40533,
40537,
40541,
278109,
40544,
40548,
40550,
40552,
286313,
40554,
310892,
40557,
40560,
188022,
122488,
294521,
343679,
310925,
286354,
278163,
302740,
278168,
327333,
229030,
212648,
278188,
302764,
319153,
278196,
319171,
302789,
294599,
278216,
294601,
319187,
229076,
286425,
319194,
229086,
286432,
294625,
294634,
302838,
319226,
286460,
302852,
302854,
294664,
311048,
319243,
311053,
294682,
278306,
294701,
278320,
319280,
319290,
229192,
302925,
237409,
360317,
327554,
40840,
40851,
294803,
188312,
294811,
319390,
40865,
294817,
319394,
294821,
180142,
188340,
40886,
319419,
294844,
294847,
393177,
294876,
294879,
294883,
294890,
311279,
278513,
237555,
278516,
237562
] |
efdd9a74d8bfce134e8c3f73ac965610edefb712 | d1b458bdddda6d404ef9487662c7909ccb96285c | /CurrencyConverterCalculator/UI/Calculator/SubView/CalculationInputView.swift | f2e2ec87301a2a3af89c412bd53891f8a894daab | [
"Apache-2.0"
] | permissive | bitrise-io/iosCCC | caa7a6aa8d9ca896d4188f96d5186bf69e2dd551 | bb4fc061735de8149e532500174aab6c6b8226e0 | refs/heads/master | 2022-12-14T18:12:50.888757 | 2020-09-17T13:53:51 | 2020-09-17T13:53:51 | 296,326,305 | 0 | 2 | null | 2020-09-17T12:56:04 | 2020-09-17T12:56:03 | null | UTF-8 | Swift | false | false | 1,468 | swift | //
// CalculationView.swift
// CurrencyConverterCalculator
//
// Created by Mustafa Ozhan on 27/08/2020.
// Copyright © 2020 Mustafa Ozhan. All rights reserved.
//
import SwiftUI
struct CalculationInputView: View {
var input: String
var destinationView: CurrenciesView
var body: some View {
HStack {
Spacer()
Text(input)
.foregroundColor(Color("ColorText"))
.font(.title2)
Spacer()
NavigationLink(destination: destinationView) {
Image(systemName: "gear")
.imageScale(.large)
.accentColor(Color("ColorText"))
.padding(.trailing, 15)
}
}.frame(width: .none, height: 40, alignment: .center)
}
}
#if DEBUG
struct CalculationInputViewPreview: PreviewProvider {
static var previews: some View {
CalculationInputView(
input: "1+2+3",
destinationView: CurrenciesView(
baseCurrency: .constant(CurrencyType.EUR),
isFirstRun: .constant(false)
)
)
CalculationInputView(
input: "1+2+3",
destinationView: CurrenciesView(
baseCurrency: .constant(CurrencyType.EUR),
isFirstRun: .constant(false)
)
)
.preferredColorScheme(.dark)
}
}
#endif
| [
-1
] |
569b7072ebf7b7c4ded78e56e73d4939b6aba92c | 72f3e0cbe55489a3b325ffd67ec77f45dcfd16e7 | /UFCDataAPI/Classes/UFCEvent.swift | ba6fdfacff91d9ba9b1fbe9045aaa410c18eb56d | [
"MIT"
] | permissive | marceloreina/UFCDataAPI | 1aff5e544c02fb45f61ee9bb141a863168ffb69f | 62a7f9efdc7fd8c4e92dc1f7047a4b0b0f45ba25 | refs/heads/master | 2021-01-11T22:27:41.203500 | 2017-01-16T23:27:56 | 2017-01-16T23:27:56 | 78,965,239 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,732 | swift | //
// UFCEvent.swift
// UFCDataAPI
//
// Created by Marcelo Reina on 11/01/17.
// Copyright © 2017 Marcelo Reina. All rights reserved.
//
import Foundation
import ObjectMapper
public struct UFCEvent {
var id: Int64?
var eventDate: Date?
var secondaryFeatureImage: String?
var ticketImage: String?
var eventTimeZoneText: String?
var shortDescription: String?
var eventDategmt: Date?
var endEventDategmt: Date?
var ticketURL: String?
var ticketSellerName: String?
var baseTitle: String?
var titleTagLine: String?
var twitterHashtag: String?
var ticketGeneralSaleDate: String?
var statid: Int64?
var featureImage: String?
var eventTimeText: String?
var ticketGeneralSaleText: String?
var subtitle: String?
var eventStatus: String?
var isPPVEvent: Bool?
var cornerAudioAvailable: Bool?
var cornerAudioBlueStreamURL: String?
var cornerAudioRedStreamURL: String?
var lastModified: Date?
var urlName: String?
var created: Date?
var trailerURL: String?
var arena: String?
var location: String?
var fmFntFeedURL: String?
var mainEventFighter1Id: Int64?
var mainEventFighter2Id: Int64?
var latitude: Double?
var longitude: Double?
}
extension UFCEvent: Mappable {
public init?(map: Map) {}
mutating public func mapping(map: Map) {
id <- map["id"]
secondaryFeatureImage <- map["secondary_feature_image"]
ticketImage <- map["ticket_image"]
eventTimeZoneText <- map["event_time_zone_text"]
shortDescription <- map["short_description"]
ticketURL <- map["ticketurl"]
ticketSellerName <- map["ticket_seller_name"]
baseTitle <- map["base_title"]
titleTagLine <- map["title_tag_line"]
twitterHashtag <- map["twitter_hashtag"]
ticketGeneralSaleDate <- map["ticket_general_sale_date"]
statid <- map["statid"]
featureImage <- map["feature_image"]
eventTimeText <- map["event_time_text"]
ticketGeneralSaleText <- map["ticket_general_sale_text"]
subtitle <- map["subtitle"]
eventStatus <- map["event_status"]
isPPVEvent <- map["isppvevent"]
cornerAudioAvailable <- map["corner_audio_available"]
cornerAudioBlueStreamURL <- map["corner_audio_blue_stream_url"]
cornerAudioRedStreamURL <- map["corner_audio_red_stream_url"]
urlName <- map["url_name"]
trailerURL <- map["trailer_url"]
arena <- map["arena"]
location <- map["location"]
fmFntFeedURL <- map["fm_fnt_feed_url"]
mainEventFighter1Id <- map["main_event_fighter1_id"]
mainEventFighter2Id <- map["main_event_fighter2_id"]
latitude <- map["latitude"]
longitude <- map["longitude"]
// convert string from json to Date object (closure)
let transform = TransformOf<Date, String>(fromJSON: { (value: String?) -> Date? in
return Date.makeDate(from: value)
}, toJSON: { (value: Date?) -> String? in
if let value = value {
return Date.makeString(from: value, dateStyle: .short)
}
return nil
})
// custom map using transform closure
eventDate <- (map["event_date"], transform)
eventDategmt <- (map["event_dategmt"], transform)
endEventDategmt <- (map["end_event_dategmt"], transform)
lastModified <- (map["last_modified"], transform)
created <- (map["created"], transform)
}
}
extension UFCEvent {
static func makeUFCEvents(from jsonArray: [[String: Any]]) -> [UFCEvent]? {
return Mapper<UFCEvent>().mapArray(JSONArray: jsonArray)
}
}
| [
-1
] |
2663c7b3514aef8ea0a1f9411db208885a1c2cfd | d0f8a0ca155d986115f75b45f1d5e578634b378b | /ViperMoviesssDB/ViperMoviesssDB/NowPlayingScreen/NowPlayingView.swift | be09503874690a39e22351ddd336900cdf76e535 | [
"Apache-2.0"
] | permissive | anderlentz/ViperMoviesMDB | 3881b7f94ce0c28ce38f9812b4c3701016b122ba | 6e26ff52cd14b8ac5788bc4ca54a1c87ade867d5 | refs/heads/master | 2022-04-11T17:28:20.850068 | 2020-03-26T20:34:53 | 2020-03-26T20:34:53 | 205,207,940 | 0 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 3,163 | swift | //
// NowPlayingView.swift
// ViperMoviesssDB
//
// Created Anderson Lentz on 20/08/19.
// Copyright © 2019 Luiz. All rights reserved.
//
import UIKit
/// NowPlaying Module View
class NowPlayingView: UIViewController {
@IBOutlet weak var playingNowCollectionView: UICollectionView!
var presenter: NowPlayingPresenterProtocol?
private var movies:[GlobalMovie]?
private var object : NowPlayingEntity?
override func viewDidLoad() {
super.viewDidLoad()
presenter?.viewDidLoad()
playingNowCollectionView.delegate = self
playingNowCollectionView.dataSource = self
let flowLayout = UICollectionViewFlowLayout()
flowLayout.scrollDirection = .vertical
flowLayout.itemSize = CGSize(width: 129, height: 308)
flowLayout.minimumLineSpacing = 10.0
flowLayout.minimumInteritemSpacing = 20.0
playingNowCollectionView.collectionViewLayout = flowLayout
//register the xib for collection view cell
let cellNib = UINib(nibName: "NowPlayingCollectionViewCell", bundle: nil)
playingNowCollectionView.register(cellNib, forCellWithReuseIdentifier: "NowPlayingCollectionViewCell")
}
override func viewWillAppear(_ animated: Bool) {
//Setup navigation bar title
self.navigationController?.navigationBar.prefersLargeTitles = false
}
}
// MARK: - extending NowPlayingView to implement it's protocol
extension NowPlayingView: NowPlayingViewProtocol {
func showNowPlayingMovies(with: [GlobalMovie]?) {
movies = with
playingNowCollectionView.reloadData()
}
}
extension NowPlayingView: UICollectionViewDelegate,
UICollectionViewDataSource{
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
print(movies?.count)
return movies?.count ?? 0
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "NowPlayingCollectionViewCell", for: indexPath) as! NowPlayingCollectionViewCell
cell.title.text = movies?[indexPath.row].title
cell.votes.text = String(movies?[indexPath.row].voteAverage ?? 0)
if let imageData = movies?[indexPath.row].albumImage{
cell.albumImage.image = UIImage(data: imageData)
}
return cell
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
presenter?.showMovieDetails(with: movies?[indexPath.row], from: self)
}
}
extension NowPlayingView: UICollectionViewDelegateFlowLayout{
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
let height = view.frame.size.height
let width = view.frame.size.width
// in case you you want the cell to be 40% of your controllers view
return CGSize(width: width * 0.4, height: height * 0.4)
}
}
| [
-1
] |
937491a7d8a202684aae973f742d3460746c4503 | 02131c0cd787e1aa653de8d8ccac1d532d14929c | /Socer swiftui/model/match/MatchDetail.swift | 8378dfa935f1ce25a4b887fb838b292a3033bb86 | [] | no_license | SulemanAli303/Football-Socer-Data-swiftui | 744da0cabb64da4d1f7e59f028df7f04f399d185 | ee833adde575aff71a34ea8643f80fd6a5e8ace8 | refs/heads/main | 2023-03-21T07:16:15.709209 | 2021-03-01T05:49:36 | 2021-03-01T05:49:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,659 | swift | //
// MatchDetail.swift
// Socer swiftui
//
// Created by hosam on 2/23/21.
//
import SwiftUI
struct MatchDetailResponse: Decodable {
var match: MatchDetail
}
struct MatchDetail: Identifiable, Decodable {
var id: Int
var competition: MatchDetailCompetition
var utcDate: Date
var status: String
var attendance: Int?
var venue: String
var matchday: Int
var score: MatchScore?
var homeTeam: MatchDetailTeam
var awayTeam: MatchDetailTeam
var goals: [MatchDetailGoal]?
var bookings: [MatchDetailBooking]?
var substitutions: [MatchDetailSubtitution]?
var referees: [Player]?
}
extension MatchDetail {
static var stub: MatchDetail {
let url = Bundle.main.url(forResource: "match_detail", withExtension: "json")!
let response: MatchDetailResponse = Utilities.loadStub(url: url)
return response.match
}
}
struct MatchDetailCompetition: Decodable {
var id: Int
var name: String
}
struct MatchDetailTeam: Decodable {
var id: Int
var name: String
var coach: Player?
var captain: Player?
var lineup: [Player]?
var bench: [Player]?
}
struct MatchDetailGoal: Identifiable, Equatable, Decodable {
var id: Int {
team.id
}
var minute: Int
var extraTime: Int?
var team: MatchDetailTeam
var scorer: Player?
var assist: Player?
static func == (lhs: MatchDetailGoal, rhs: MatchDetailGoal) -> Bool {
return lhs.team.id == rhs.team.id && lhs.minute == rhs.minute && (lhs.scorer?.id ?? 0) == (rhs.scorer?.id ?? 0)
}
}
struct MatchDetailBooking: Identifiable, Decodable, Equatable {
var id: Int {
team.id
}
var minute: Int
var team: MatchDetailTeam
var player: Player
var card: String
var isYellowCard: Bool {
card == "YELLOW_CARD"
}
var isRedCard: Bool {
card == "RED_CARD"
}
static func == (lhs: MatchDetailBooking, rhs: MatchDetailBooking) -> Bool {
return lhs.team.id == rhs.team.id && lhs.minute == rhs.minute && (lhs.player.id) == (rhs.player.id)
}
}
struct MatchDetailSubtitution: Identifiable, Decodable, Equatable {
var id: Int {
team.id
}
var minute: Int
var team: MatchDetailTeam
var playerOut: Player
var playerIn: Player
static func == (lhs: MatchDetailSubtitution, rhs: MatchDetailSubtitution) -> Bool {
return lhs.team.id == rhs.team.id && lhs.minute == rhs.minute && (lhs.playerIn.id) == (rhs.playerIn.id) && (lhs.playerOut.id) == (rhs.playerOut.id)
}
}
| [
-1
] |
d2fbca9d093f8a8bcacfcd85dd3ca457a6fcf8ba | 1c1ee914e3a85576a5ed4fcd9a63d9159425eeb6 | /NirjaraAp/Profile/TableCell/MyGalleryPostsTableViewCell.swift | 153a373d169199b85d97eea7bbde0ccc4307036f | [] | no_license | javed28/nirjara | 998a18a3031a85c4e03814bd35ab9612cd56b19d | cc76a9b0214d3b165ec0ee9dc6ed5536f3f16b27 | refs/heads/master | 2020-04-04T19:32:27.746840 | 2018-11-05T12:08:22 | 2018-11-05T12:08:22 | 156,210,771 | 2 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,091 | swift | //
// MyGalleryPostsTableViewCell.swift
// NirjaraAp
//
// Created by gadgetzone on 3/11/18.
// Copyright © 2018 gadgetzone. All rights reserved.
//
import UIKit
class MyGalleryPostsTableViewCell: UITableViewCell {
@IBOutlet weak var lblGalleryName: UILabel!
@IBOutlet weak var imgWhoPost: UIImageView!
@IBOutlet weak var lblDate: UILabel!
@IBOutlet weak var lineView: UIView!
@IBOutlet weak var btnAnumodha: UIButton!
@IBOutlet weak var btnComment: UIButton!
@IBOutlet weak var imgWhatpost: UIImageView!
@IBOutlet weak var btnDarshan: UIButton!
@IBOutlet weak var lblLocation: UILabel!
@IBOutlet weak var btnAnumodhaText: UIButton!
@IBOutlet weak var btnDarshanText: UIButton!
@IBOutlet weak var btnCommentText: UIButton!
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
}
}
| [
226176,
135815,
333831,
227849,
196108,
203788,
271117,
276756,
334229,
302875,
261406,
243746,
337317,
282552,
310840,
123451,
314431,
317377,
349123,
279757,
283470,
283471,
283472,
283473,
180696,
287067,
287068,
287069,
336734,
281183,
358875,
336738,
249067,
196076,
249068,
249069,
216438,
262518,
317302,
310778
] |