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.799000 | 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.819000 | 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.915000 | 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.349000 | 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.172000 | 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.028000 | 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.327000 | 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.362000 | 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.648000 | 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.820000 | 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.790000 | 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.100000 | 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.754000 | 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.955000 | 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.045000 | 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.432000 | 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.885000 | 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.870000 | 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.536000 | 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.038000 | 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.393000 | 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.683000 | 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.019000 | 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.374000 | 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.176000 | 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.143000 | 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.605000 | 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.804000 | 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.713000 | 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.875000 | 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.389000 | 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.411000 | 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.158000 | 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.514000 | 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.488000 | 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.952000 | 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.384000 | 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
] |
End of preview. Expand
in Dataset Viewer.
README.md exists but content is empty.
- Downloads last month
- 35