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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
fff8f9f8cbf1e248e8f61601fcb91eb8be101ab6 | 60df74ffb4dcca09a1a908a9b855602aa229f871 | /GoodPlaces/Services/Request/PlaceDetailRequest.swift | 47e9a0284348a78e66fb6b8212e3a06db388c6e9 | [] | no_license | LucasNeto/GoodPlaces | b9ceaa0e93c15136ec6797938f97bc47247b9cc7 | 48dcbfc8cf91bc1d1c72e079f02837d68478cadf | refs/heads/main | 2023-01-29T19:02:00.302613 | 2020-12-07T04:10:36 | 2020-12-07T04:10:36 | 319,194,155 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 214 | swift | //
// PlaceDetailRequest.swift
// GoodPlaces
//
// Created by Lucas N Santana on 03/12/20.
// Copyright © 2020 Lucas N Santana. All rights reserved.
//
struct PlaceDetailRequest {
var placeID: String
}
| [
-1
] |
ea214bbb4dde298b17624fbdba30d347b9a7f375 | 227aaae4400455203106100f5de3fb3d1fb86218 | /Tourus/Controllers/MapViewController.swift | a532d448d8360c0c3ca7b17510dc7f930119b2dd | [] | no_license | DanielPich1996/tourus | 91dc5848297a0c0f5b69a963d2b3e1ff1cee3e45 | a2e7bce1b4987afe27f2d34f5d6f762323f0772a | refs/heads/master | 2020-06-24T17:18:51.046204 | 2019-07-25T20:22:09 | 2019-07-25T20:22:09 | 199,028,141 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 16,237 | swift | //
// MapViewController.swift
// Tourus
//
// Created by admin on 27/05/2019.
// Copyright © 2019 Tourus. All rights reserved.
//
import UIKit
import MapKit
import CoreLocation
import AVFoundation
class MapViewController: UIViewController {
@IBOutlet weak var mapView: MKMapView!
@IBOutlet weak var directionLabel: UILabel!
@IBOutlet weak var ArrivalLabel: UILabel!
var lat:Double? = nil
var long:Double? = nil
var destinationName:String? = nil
var destinationRating:Double? = nil
private let locationManager = CLLocationManager()
private var currentCoordinate: CLLocationCoordinate2D!
private var directed = false
private var steps = [MKRoute.Step]()
private var route:MKRoute? = nil
private let speechSynthesizer = AVSpeechSynthesizer()
private var isDirectionalAudioOn = true
override func viewDidLoad() {
super.viewDidLoad()
if let settings = MainModel.instance.getSettings() {
isDirectionalAudioOn = settings.isDirectionalAudioOn
}
locationManager.requestAlwaysAuthorization()
locationManager.delegate = self
locationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation
locationManager.startUpdatingLocation()
}
func setDestinationData(destLat:Double?, destlong:Double?, destName:String?, destRating:Double?) {
lat = destLat
long = destlong
destinationName = destName
destinationRating = destRating
}
@IBAction func onExitTap(_ sender: Any) {
self.alertStoppingNavigation()
}
@IBAction func onNavigateTap(_ sender: Any) {
self.alertNavigationRefresh()
}
@IBAction func onCenterTap(_ sender: Any) {
self.centerMapOnUserLocation()
}
func centerMapOnUserLocation() {
guard let coordinate = locationManager.location?.coordinate else { return }
let region = MKCoordinateRegion(center: coordinate, latitudinalMeters: 2000, longitudinalMeters: 2000)
mapView.setRegion(region, animated: true)
}
func getDirections(to destination: MKMapItem) {
let sourcePlacemark = MKPlacemark(coordinate: currentCoordinate)
let sourceMapItem = MKMapItem(placemark: sourcePlacemark)
let directionsReq = MKDirections.Request()
directionsReq.source = sourceMapItem
directionsReq.destination = destination
directionsReq.transportType = .walking
let directions = MKDirections(request: directionsReq)
directions.calculate { (response, _) in
guard let response = response else { return }
guard let primaryRoute = response.routes.first else { return }
self.stopNavigation()
self.route = primaryRoute
//add a polyline path to the map
self.mapView.addOverlay(primaryRoute.polyline)
//add polyline steps to the map
self.steps = primaryRoute.steps
for i in 0 ..< primaryRoute.steps.count {
let step = primaryRoute.steps[i]
print(step.instructions)
print(step.distance)
//let region = CLRegion( MTLRegion(origin: nil, size: nil)
let region = CLCircularRegion(center: step.polyline.coordinate, radius: 10, identifier: "\(i)")
self.locationManager.startMonitoring(for: region)
let circle = MKCircle(center: region.center, radius: region.radius)
self.mapView.addOverlay(circle)
}
//add destination pin
let annotation = DestinationPointAnnotation()
annotation.title = self.destinationName
annotation.coordinate = primaryRoute.steps[primaryRoute.steps.count-1].polyline.coordinate
self.mapView.addAnnotation(annotation)
//set durections
self.setArrivalData(primaryRoute)
self.setDirections(self.steps[0])
}
}
func getDirectionsFormat(_ step:MKRoute.Step) -> String {
let distanceInt = Int(step.distance)
if step.instructions.isEmpty {
return "Walk forward for \(distanceInt) meters"
} else {
return "In \(distanceInt) meters \(step.instructions)"
}
}
func setDirections(_ step:MKRoute.Step) {
let directions = getDirectionsFormat(step)
setDirections(directions)
}
func setDirections(_ directions:String) {
self.directionLabel.text = directions
if isDirectionalAudioOn {
let speechUtterance = AVSpeechUtterance(string: directions)
self.speechSynthesizer.speak(speechUtterance)
}
}
func setArrivalData(_ route:MKRoute) {
let distance = String(format: "%.1f Km", route.distance/1000)
let travelTime = route.expectedTravelTime.toDisplayString()
ArrivalLabel.text = "\(distance) away" + "\n" + "arrive in \(travelTime)"
}
func navigate() {
if lat != nil && long != nil {
//follows the user's direction by the phone rotating
mapView.userTrackingMode = .followWithHeading
getDirections(to: MKMapItem(placemark: MKPlacemark(coordinate: CLLocationCoordinate2D(latitude: lat!, longitude: long!))))
} else {
//error - no lat nor long were found
self.stopNavigation()
self.dismissAndGoToMain()
}
}
func calculateMaxDistanceFromRoute() {
var farestDistance:Int? = nil
guard let currentRoute = route else { return }
//calculating the center point of the route
let centerRoutePoint = MKMapPoint(currentRoute.polyline.coordinate)
for step in self.steps {
//calculating the current step distance from the center of the entire route
let stepPoint = MKMapPoint(step.polyline.coordinate)
let distance = Int(centerRoutePoint.distance(to: stepPoint))
//taking the max distance
if farestDistance == nil || distance > farestDistance! {
farestDistance = distance
}
}
guard var maxDistance = farestDistance else { return }
maxDistance += consts.map.maxFarFromRouteInMeters
//calculating user point
let userPoint = MKMapPoint(currentCoordinate)
let userDistance = Int(centerRoutePoint.distance(to: userPoint))
if userDistance > maxDistance {
//far from route - navigate again
getDirections(to: MKMapItem(placemark: MKPlacemark(coordinate: CLLocationCoordinate2D(latitude: lat!, longitude: long!))))
}
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.destination is MoreInfoViewController {
let vc = segue.destination as? MoreInfoViewController
vc?.displayInteractionInfo(name: destinationName, rating: destinationRating)
}
}
}
extension MapViewController : CLLocationManagerDelegate {
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
//manager.stopUpdatingLocation()
guard let currentLocation = locations.first else { return }
currentCoordinate = currentLocation.coordinate
if !directed {
directed = true
navigate()
} else { calculateMaxDistanceFromRoute() }
}
func locationManager(_ manager: CLLocationManager, didEnterRegion region: CLRegion) {
guard let stepIndex = Int(region.identifier) else { stopNavigation(); return }
if stepIndex == 0 { return } //we've already directed the user by the first step
let currentStep = steps[stepIndex]
if stepIndex < (steps.count-1) {
setDirections(currentStep)
} else {
//arrived
let message = "Arrived at destination"
setDirections(message)
stopNavigation()
}
}
func stopNavigation() {
//remove regions
self.locationManager.monitoredRegions.forEach({ self.locationManager.stopMonitoring(for: $0)})
//remove overlays
self.mapView.overlays.forEach {
if !($0 is MKUserLocation) {
self.mapView.removeOverlay($0)
}
}
//remove annotations
self.mapView.annotations.forEach {
if !($0 is MKUserLocation) {
self.mapView.removeAnnotation($0)
}
}
}
func alertStoppingNavigation() {
//Create the alert controller and actions
let alert = UIAlertController(title: "Navigation", message: "Back for another attraction?", preferredStyle: .alert)
let cancelAction = UIAlertAction(title: "No", style: .cancel, handler: nil)
let acceptAction = UIAlertAction(title: "Yes", style: .destructive) { _ in
DispatchQueue.main.async {
self.dismissAndGoToMain()
}
}
//Add the actions to the alert controller
alert.addAction(cancelAction)
alert.addAction(acceptAction)
//Present the alert controller
present(alert, animated: true, completion: nil)
}
func alertNavigationRefresh() {
let alert = UIAlertController(title: "Navigation", message: "Refresh navigation for you'r attraction?", preferredStyle: .alert)
let cancelAction = UIAlertAction(title: "Cancel", style: .cancel, handler: nil)
let acceptAction = UIAlertAction(title: "Refresh", style: .destructive) { _ in
DispatchQueue.main.async {
self.route = nil
self.steps = [MKRoute.Step]()
self.navigate()
}
}
//Add the actions to the alert controller
alert.addAction(cancelAction)
alert.addAction(acceptAction)
//Present the alert controller
present(alert, animated: true, completion: nil)
}
func dismissAndGoToMain() {
let mainStoryboard = UIStoryboard(name: "Main", bundle: Bundle.main)
guard let mainVC = mainStoryboard.instantiateViewController(withIdentifier: "MainViewController") as? MainViewController else { return }
present(mainVC, animated: true, completion: nil)
}
}
extension MapViewController : MKMapViewDelegate {
func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
if annotation is DestinationPointAnnotation {
var annotationView = mapView.dequeueReusableAnnotationView(withIdentifier: consts.map.destinationPinIdentifier)
if annotationView == nil {
annotationView = DestinationAnnotationView(annotation: annotation, reuseIdentifier: consts.map.destinationPinIdentifier)
annotationView?.image = UIImage(named: "destinationPin.png")
} else {
annotationView?.annotation = annotation
}
return annotationView
}
return nil
}
func mapView(_ mapView: MKMapView, didSelect view: MKAnnotationView) {
if view is DestinationAnnotationView {
let destView = view as! DestinationAnnotationView
destView.selected()
}
}
func mapView(_ mapView: MKMapView, didDeselect view: MKAnnotationView) {
if view is DestinationAnnotationView {
let destView = view as! DestinationAnnotationView
destView.deselected()
}
}
func mapView(_ mapView: MKMapView, rendererFor overlay: MKOverlay) -> MKOverlayRenderer {
if overlay is MKPolyline {
let renderer = MKPolylineRenderer(overlay: overlay)
renderer.strokeColor = .directionColor
renderer.lineWidth = 4
return renderer
}
if overlay is MKCircle {
let renderer = MKCircleRenderer(overlay: overlay)
renderer.strokeColor = .directionPointColor
renderer.fillColor = .directionColor
renderer.alpha = 0.8
return renderer
}
return MKOverlayRenderer()
}
}
extension TimeInterval {
func toDisplayString() -> String {
let time = NSInteger(self)
//let ms = Int((self.truncatingRemainder(dividingBy: 1)) * 1000)
//let seconds = time % 60
let minutes = Int((time / 60) % 60)
let hours = Int(time / 3600)
var message = String(format: "%.1d Minutes", minutes)
if hours > 0 {
message = String(format: "%.1d:%02d Hours", hours, minutes)
}
return message
}
}
class DestinationAnnotationView: MKAnnotationView {
private var originalTransform: CGAffineTransform? = nil
private let annotationFrame = CGRect(x: 0, y: 0, width: 100, height: 20)
private let label: UILabel
override var annotation: MKAnnotation? {
didSet {
updateTitleLabel()
if originalTransform == nil {
transform = transform.scaledBy(x: 0.9, y: 0.9)
originalTransform = CGAffineTransform(a: transform.a, b: transform.b, c: transform.c, d: transform.d, tx: transform.tx, ty: transform.ty)
}
}
}
override init(annotation: MKAnnotation?, reuseIdentifier: String?) {
label = UILabel(frame: annotationFrame.offsetBy(dx: -15, dy: 55))
super.init(annotation: annotation, reuseIdentifier: reuseIdentifier)
canShowCallout = false
backgroundColor = .clear
frame = annotationFrame
}
required init?(coder aDecoder: NSCoder) {
label = UILabel(frame: annotationFrame)
super.init(coder: aDecoder)
}
private func updateTitleLabel() {
if subviews.contains(label) {
willRemoveSubview(label)
}
guard let title = annotation?.title else { return }
label.alpha = 0
label.textAlignment = .center
let strokeTextAttributes = [
NSAttributedString.Key.strokeColor : UIColor.destinationBorderPointColor,
NSAttributedString.Key.foregroundColor : UIColor.destinationPointColor,
NSAttributedString.Key.strokeWidth : -4.0,
NSAttributedString.Key.font : UIFont.boldSystemFont(ofSize: 10)
] as [NSAttributedString.Key : Any] as [NSAttributedString.Key : Any]
label.attributedText = NSMutableAttributedString(string: title ?? "", attributes: strokeTextAttributes)
label.numberOfLines = 0;
label.sizeToFit()
addSubview(label)
}
func selected() {
guard let transform = originalTransform else { return }
UIView.animate(withDuration: 0.1, delay: 0.0, options: .curveLinear, animations: {
self.transform = transform.scaledBy(x: 1.3, y: 1.3)
self.label.alpha = 1
})
}
func deselected() {
guard let transform = originalTransform else { return }
UIView.animate(withDuration: 0.1, delay: 0.0, options: .curveLinear, animations: {
self.transform = transform
self.label.alpha = 0
})
}
}
class DestinationPointAnnotation : MKPointAnnotation {
}
| [
-1
] |
ab4019778aaba81c7da783e024c7e7214911e1f1 | 94ec81c85ef3c656b1edfe36165f2a9c9ba46d4b | /Sources/BowOptics/Prism.swift | 8019a056d4ee112dfbb3a0811cc801da57a59eca | [
"Apache-2.0"
] | permissive | Guang1234567/bow | 4b365813e3e31181d72a9ab5c452eb991a9f57a1 | 23eb31da79e26fa749670b8f78ef1e0c6ab67127 | refs/heads/master | 2022-05-24T11:50:29.386561 | 2020-04-27T15:14:45 | 2020-04-27T15:14:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 18,192 | swift | import Foundation
import Bow
/// Witness for the `PPrism<S, T, A, B>` data type. To be used in simulated Higher Kinded Types.
public final class ForPPrism {}
/// Partial application of the PPrism type constructor, omitting the last parameter.
public final class PPrismPartial<S, T, A>: Kind3<ForPPrism, S, T, A> {}
/// Higher Kinded Type alias to improve readability over `Kind4<ForPPrism, S, T, A, B>`.
public typealias PPrismOf<S, T, A, B> = Kind<PPrismPartial<S, T, A>, B>
/// Prism is a type alias for PPrism which fixes the type arguments and restricts the PPrism to monomorphic updates.
public typealias Prism<S, A> = PPrism<S, S, A, A>
/// Witness for the `Prism<S, A>` data type. To be used in simulated Higher Kinded Types.
public typealias ForPrism = ForPPrism
/// Partial application of the `Prism` type constructor, omitting the last parameter.
public typealias PrismPartial<S> = Kind<ForPrism, S>
/// A Prism is a loss less invertible optic that can look into a structure and optionally find its focus. It is mostly used for finding a focus that is only present under certain conditions, like in a sum type.
///
/// A (polymorphic) PPrism is useful when setting or modifying a value for a polymorphic sum type.
///
/// A PPrism gathres the two concepts of pattern matching and constructor and thus can be seen as a pair of functions:
/// - `getOrModify` meaning it returns the focus of a PPRism or the original value.
/// - `reverseGet` meaining we can construct the source type of a PPrism from a focus.
///
/// Type parameters:
/// - `S`: Source.
/// - `T`: Modified source.
/// - `A`: Focus.
/// - `B`: Modified focus.
public class PPrism<S, T, A, B>: PPrismOf<S, T, A, B> {
private let getOrModifyFunc: (S) -> Either<T, A>
private let reverseGetFunc: (B) -> T
/// Composes a `PPrism` with a `PPrism`.
///
/// - Parameters:
/// - lhs: Left side of the composition.
/// - rhs: Right side of the composition.
/// - Returns: A `PPrism` resulting from the sequential application of the two provided optics.
public static func +<C, D>(lhs: PPrism<S, T, A, B>, rhs: PPrism<A, B, C, D>) -> PPrism<S, T, C, D> {
return lhs.compose(rhs)
}
/// Composes a `PPrism` with a `PIso`.
///
/// - Parameters:
/// - lhs: Left side of the composition.
/// - rhs: Right side of the composition.
/// - Returns: A `PPrism` resulting from the sequential application of the two provided optics.
public static func +<C, D>(lhs: PPrism<S, T, A, B>, rhs: PIso<A, B, C, D>) -> PPrism<S, T, C, D> {
return lhs.compose(rhs)
}
/// Composes a `PPrism` with a `PLens`.
///
/// - Parameters:
/// - lhs: Left side of the composition.
/// - rhs: Right side of the composition.
/// - Returns: A `POptional` resulting from the sequential application of the two provided optics.
public static func +<C, D>(lhs: PPrism<S, T, A, B>, rhs: PLens<A, B, C, D>) -> POptional<S, T, C, D> {
return lhs.compose(rhs)
}
/// Composes a `PPrism` with a `POptional`.
///
/// - Parameters:
/// - lhs: Left side of the composition.
/// - rhs: Right side of the composition.
/// - Returns: A `POptional` resulting from the sequential application of the two provided optics.
public static func +<C, D>(lhs: PPrism<S, T, A, B>, rhs: POptional<A, B, C, D>) -> POptional<S, T, C, D> {
return lhs.compose(rhs)
}
/// Composes a `PPrism` with a `PSetter`.
///
/// - Parameters:
/// - lhs: Left side of the composition.
/// - rhs: Right side of the composition.
/// - Returns: A `PSetter` resulting from the sequential application of the two provided optics.
public static func +<C, D>(lhs: PPrism<S, T, A, B>, rhs: PSetter<A, B, C, D>) -> PSetter<S, T, C, D> {
return lhs.compose(rhs)
}
/// Composes a `PPrism` with a `Fold`.
///
/// - Parameters:
/// - lhs: Left side of the composition.
/// - rhs: Right side of the composition.
/// - Returns: A `Fold` resulting from the sequential application of the two provided optics.
public static func +<C>(lhs: PPrism<S, T, A, B>, rhs: Fold<A, C>) -> Fold<S, C> {
return lhs.compose(rhs)
}
/// Composes a `PPrism` with a `PTraversal`.
///
/// - Parameters:
/// - lhs: Left side of the composition.
/// - rhs: Right side of the composition.
/// - Returns: A `PTraversal` resulting from the sequential application of the two provided optics.
public static func +<C, D>(lhs: PPrism<S, T, A, B>, rhs: PTraversal<A, B, C, D>) -> PTraversal<S, T, C, D> {
return lhs.compose(rhs)
}
/// Initializes a Prism.
///
/// - Parameters:
/// - getOrModify: Gets the focus of the prism, if present.
/// - reverseGet: Builds the source of the prism from its focus.
public init(getOrModify: @escaping (S) -> Either<T, A>, reverseGet: @escaping (B) -> T) {
self.getOrModifyFunc = getOrModify
self.reverseGetFunc = reverseGet
}
/// Retrieves the focus or modifies the source.
///
/// - Parameter s: Source.
/// - Returns: Either the modified source or the focus of the prism.
public func getOrModify(_ s: S) -> Either<T, A> {
return getOrModifyFunc(s)
}
/// Obtains a modified source.
///
/// - Parameter b: Modified focus.
/// - Returns: Modified source.
public func reverseGet(_ b: B) -> T {
return reverseGetFunc(b)
}
/// Modifies the focus of a PPrism with an `Applicative` function.
///
/// - Parameters:
/// - s: Source.
/// - f: Modifying function.
/// - Returns: Modified source in the context of the `Applicative`.
public func modifyF<F: Applicative>(_ s: S, _ f: @escaping (A) -> Kind<F, B>) -> Kind<F, T> {
return getOrModify(s).fold(F.pure,
{ a in F.map(f(a), self.reverseGet) })
}
/// Lifts an `Applicative` function operating on focus to one operating on source.
///
/// - Parameter f: Modifying function.
/// - Returns: Lifted function operating on the source.
public func liftF<F: Applicative>(_ f: @escaping (A) -> Kind<F, B>) -> (S) -> Kind<F, T> {
return { s in self.modifyF(s, f) }
}
/// Retrieves the focus.
///
/// - Parameter s: Source.
/// - Returns: An optional value that is present if the focus exists.
public func getOption(_ s: S) -> Option<A> {
return getOrModify(s).toOption()
}
/// Retrieves the focus.
///
/// - Parameter s: Source.
/// - Returns: An optional value that is present if the focus exists.
public func getOptional(_ s: S) -> A? {
getOption(s).toOptional()
}
/// Obtains a modified source.
///
/// - Parameters:
/// - s: Source.
/// - b: Modified focus.
/// - Returns: Modified source.
public func set(_ s: S, _ b: B) -> T {
return modify(s, constant(b))
}
/// Sets a modified focus.
///
/// - Parameters:
/// - s: Source.
/// - b: Modified focus.
/// - Returns: Optional modified source.
public func setOption(_ s: S, _ b: B) -> Option<T> {
return modifyOption(s, constant(b))
}
/// Sets a modified focus.
///
/// - Parameters:
/// - s: Source.
/// - b: Modified focus.
/// - Returns: Optional modified source.
public func setOptional(_ s: S, _ b: B) -> T? {
setOption(s, b).toOptional()
}
/// Checks if the provided source is non-empty.
///
/// - Parameter s: Source.
/// - Returns: Boolean value indicating if the provided source is non-empty.
public func nonEmpty(_ s: S) -> Bool {
return getOption(s).fold(constant(false), constant(true))
}
/// Checks if the provided source is empty.
///
/// - Parameter s: Source.
/// - Returns: Boolean value indicating if the provided source is empty.
public func isEmpty(_ s: S) -> Bool {
return !nonEmpty(s)
}
/// Pairs this `PPrism` with another type, placing this as the first element.
///
/// - Returns: A `PPrism` that operates on tuples where the second argument remains unchanged.
public func first<C>() -> PPrism<(S, C), (T, C), (A, C), (B, C)> {
return PPrism<(S, C), (T, C), (A, C), (B, C)>(
getOrModify: { s, c in
self.getOrModify(s).bimap({ t in (t, c) }, { a in (a, c) })
},
reverseGet: { b, c in
(self.reverseGet(b), c)
})
}
/// Pairs this `PPrism` with another type, placing this as the second element.
///
/// - Returns: A `PPrism` that operates on tuples where the first argument remains unchanged.
public func second<C>() -> PPrism<(C, S), (C, T), (C, A), (C, B)> {
return PPrism<(C, S), (C, T), (C, A), (C, B)>(
getOrModify: { c, s in
self.getOrModify(s).bimap({ t in (c, t) }, { a in (c, a) })
},
reverseGet: { c, b in
(c, self.reverseGet(b))
})
}
/// Modifies the source with the provided function.
///
/// - Parameters:
/// - s: Source.
/// - f: Modifying function.
/// - Returns: Modified source.
public func modify(_ s: S, _ f: @escaping (A) -> B) -> T {
return getOrModify(s).fold(id, { a in self.reverseGet(f(a)) })
}
/// Lifts a function modifying the focus to one modifying the source.
///
/// - Parameter f: Modifying function.
/// - Returns: Function that modifies the source.
public func lift(_ f: @escaping (A) -> B) -> (S) -> T {
return { s in self.modify(s, f) }
}
/// Optionally modifies the source with a function.
///
/// - Parameters:
/// - s: Source.
/// - f: Modifying function.
/// - Returns: Optional modified source.
public func modifyOption(_ s: S, _ f: @escaping (A) -> B) -> Option<T> {
return Option.fix(getOption(s).map { a in self.reverseGet(f(a)) })
}
/// Lifts a function modifying the focus to a function that optionally modifies the source.
///
/// - Parameter f: Modifying function.
/// - Returns: Function that optionally modifies the source.
public func liftOption(_ f: @escaping (A) -> B) -> (S) -> Option<T> {
return { s in self.modifyOption(s, f) }
}
/// Retrieves the focus if it matches a predicate.
///
/// - Parameters:
/// - s: Source.
/// - predicate: Testing predicate.
/// - Returns: An optional focus that is present if it matches the predicate.
public func find(_ s: S, _ predicate: @escaping (A) -> Bool) -> Option<A> {
return Option.fix(getOption(s).flatMap { a in predicate(a) ? Option.some(a) : Option.none() })
}
/// Checks if the focus matches a predicate.
///
/// - Parameters:
/// - s: Source.
/// - predicate: Testing predicate.
/// - Returns: Boolean value indicating if the focus matches the predicate.
public func exists(_ s: S, _ predicate: @escaping (A) -> Bool) -> Bool {
return getOption(s).fold(constant(false), predicate)
}
/// Checks if the focus matches a predicate.
///
/// - Parameters:
/// - s: Source.
/// - predicate: Testing predicate.
/// - Returns: Boolean value indicating if the focus matches the predicate.
public func all(_ s: S, _ predicate: @escaping(A) -> Bool) -> Bool {
return getOption(s).fold(constant(true), predicate)
}
/// Creates the sum of this `PPrism` with another type, placing this as the left side.
///
/// - Returns: A `PPrism` that operates on `Either`s where the right side remains unchanged.
public func left<C>() -> PPrism<Either<S, C>, Either<T, C>, Either<A, C>, Either<B, C>> {
return PPrism<Either<S, C>, Either<T, C>, Either<A, C>, Either<B, C>>(
getOrModify: { esc in
esc.fold({ s in self.getOrModify(s).bimap(Either.left, Either.left) },
{ c in Either.right(Either.right(c)) })
},
reverseGet: { ebc in
ebc.fold({ b in Either.left(self.reverseGet(b)) }, { c in Either.right(c) })
})
}
/// Creates the sum of this `PPrism` with another type, placing this as the right side.
///
/// - Returns: A `PPrism` that operates on `Either`s where the left side remains unchanged.
public func right<C>() -> PPrism<Either<C, S>, Either<C, T>, Either<C, A>, Either<C, B>> {
return PPrism<Either<C, S>, Either<C, T>, Either<C, A>, Either<C, B>>(
getOrModify: { ecs in
ecs.fold({ c in Either.right(Either.left(c)) },
{ s in self.getOrModify(s).bimap(Either.right, Either.right) })
},
reverseGet: { ecb in
Either.fix(ecb.map(self.reverseGet))
})
}
/// Composes this value with a `PPrism`.
///
/// - Parameter other: Value to compose with.
/// - Returns: A `PPrism` resulting from the sequential application of the two provided optics.
public func compose<C, D>(_ other: PPrism<A, B, C, D>) -> PPrism<S, T, C, D> {
return PPrism<S, T, C, D>(
getOrModify: { s in
Either.fix(self.getOrModify(s).flatMap{ a in other.getOrModify(a).bimap({ b in self.set(s, b) }, id)})
},
reverseGet: self.reverseGet <<< other.reverseGet)
}
/// Composes this value with a `PIso`.
///
/// - Parameter other: Value to compose with.
/// - Returns: A `PPrism` resulting from the sequential application of the two provided optics.
public func compose<C, D>(_ other: PIso<A, B, C, D>) -> PPrism<S, T, C, D> {
return self.compose(other.asPrism)
}
/// Composes this value with a `PLens`.
///
/// - Parameter other: Value to compose with.
/// - Returns: A `POptional` resulting from the sequential application of the two provided optics.
public func compose<C, D>(_ other: PLens<A, B, C, D>) -> POptional<S, T, C, D> {
return self.asOptional.compose(other)
}
/// Composes this value with a `POptional`.
///
/// - Parameter other: Value to compose with.
/// - Returns: A `POptional` resulting from the sequential application of the two provided optics.
public func compose<C, D>(_ other: POptional<A, B, C, D>) -> POptional<S, T, C, D> {
return self.asOptional.compose(other)
}
/// Composes this value with a `PSetter`.
///
/// - Parameter other: Value to compose with.
/// - Returns: A `PSetter` resulting from the sequential application of the two provided optics.
public func compose<C, D>(_ other: PSetter<A, B, C, D>) -> PSetter<S, T, C, D> {
return self.asSetter.compose(other)
}
/// Composes this value with a `Fold`.
///
/// - Parameter other: Value to compose with.
/// - Returns: A `Fold` resulting from the sequential application of the two provided optics.
public func compose<C>(_ other: Fold<A, C>) -> Fold<S, C> {
return self.asFold.compose(other)
}
/// Composes this value with a `PTraversal`.
///
/// - Parameter other: Value to compose with.
/// - Returns: A `PTraversal` resulting from the sequential application of the two provided optics.
public func compose<C, D>(_ other: PTraversal<A, B, C, D>) -> PTraversal<S, T, C, D> {
return self.asTraversal.compose(other)
}
/// Converts this value into a POptional.
public var asOptional: POptional<S, T, A, B> {
return POptional(set: self.set, getOrModify: self.getOrModify)
}
/// Converts this value into a PSetter.
public var asSetter: PSetter<S, T, A, B> {
return PSetter(modify: { f in {s in self.modify(s, f) } })
}
/// Converts this value into a Fold.
public var asFold: Fold<S, A> {
return PrismFold(prism: self)
}
/// Converts this value into a PTraversal.
public var asTraversal: PTraversal<S, T, A, B> {
return PrismTraversal(prism: self)
}
}
public extension Prism where S == A, S == T, A == B {
/// Provides an identity Prism.
static var identity: Prism<S, S> {
return Iso<S, S>.identity.asPrism
}
}
public extension Prism where S == T, A == B {
/// Creates a prism based on functions to extract and embed a value into a sum type.
///
/// - Parameters:
/// - extract: Function to extract a value from the source.
/// - embed: Function to embed a value into the source.
convenience init(extract: @escaping (S) -> A?, embed: @escaping (A) -> S) {
self.init(
getOrModify: { s in extract(s).flatMap(Either.right) ?? .left(s) },
reverseGet: embed)
}
}
public extension Prism where A: Equatable {
/// Provides a prism that checks equality with a value.
///
/// - Parameter a: Value to check equality with.
/// - Returns: A Prism that only matches with the provided value.
static func only(_ a: A) -> Prism<A, ()> {
return Prism<A, ()>(getOrModify: { x in a == x ? Either.left(a) : Either.right(unit)},
reverseGet: { _ in a })
}
}
private class PrismFold<S, T, A, B> : Fold<S, A> {
private let prism: PPrism<S, T, A, B>
init(prism: PPrism<S, T, A, B>) {
self.prism = prism
}
override func foldMap<R: Monoid>(_ s: S, _ f: @escaping (A) -> R) -> R {
return Option.fix(prism.getOption(s).map(f)).getOrElse(R.empty())
}
}
private class PrismTraversal<S, T, A, B> : PTraversal<S, T, A, B> {
private let prism : PPrism<S, T, A, B>
init(prism: PPrism<S, T, A, B>) {
self.prism = prism
}
override func modifyF<F: Applicative>(_ s: S, _ f: @escaping (A) -> Kind<F, B>) -> Kind<F, T> {
return prism.getOrModify(s)
.fold(F.pure,
{ a in F.map(f(a), prism.reverseGet) })
}
}
extension Prism {
internal var fix: Prism<S, A> {
return self as! Prism<S, A>
}
}
| [
-1
] |
6e95cbc31967ed0a00f5e683940ce0627f2cad2e | c41c353bf5968659e4c82ebad4aee52245e81307 | /Gestures/GesturesTests/GesturesTests.swift | 5cd781a8dc394872a6eeca30023e5f6cb41f2cc6 | [] | no_license | ppro13/swift-projects | cfec545ae26da3a2885c408b7403a3ac729f67a3 | 49b0dfd3a312553182a89870f80436428b4df20d | refs/heads/master | 2021-08-14T14:30:40.226694 | 2017-11-16T01:11:57 | 2017-11-16T01:11:57 | 106,152,609 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 974 | swift | //
// GesturesTests.swift
// GesturesTests
//
// Created by Pedro Paulo on 12/11/17.
// Copyright © 2017 Pedro Paulo. All rights reserved.
//
import XCTest
@testable import Gestures
class GesturesTests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measure {
// Put the code you want to measure the time of here.
}
}
}
| [
98333,
278558,
16419,
229413,
204840,
278570,
344107,
155694,
253999,
229424,
229430,
319542,
180280,
213052,
286788,
352326,
254027,
311372,
311374,
196691,
278615,
180311,
180312,
237663,
278634,
319598,
352368,
237689,
131198,
278655,
311438,
278677,
278685,
311458,
278691,
49316,
278699,
32941,
278704,
278708,
131256,
278714,
295098,
254170,
229597,
286958,
327929,
278797,
180493,
254226,
319763,
278816,
98610,
278842,
287041,
139589,
319813,
319821,
254286,
344401,
155990,
106847,
246127,
139640,
246136,
246137,
311681,
246178,
377264,
278970,
319930,
336317,
278978,
188871,
278989,
278993,
278999,
328152,
369116,
188894,
287198,
279008,
279013,
279018,
311786,
279029,
279032,
279039,
287241,
279050,
279065,
180771,
377386,
279094,
352829,
115270,
295519,
66150,
344680,
279146,
295536,
287346,
287352,
279164,
189057,
311941,
279177,
369289,
344715,
311949,
352917,
230040,
271000,
295576,
303771,
221852,
279206,
295590,
287404,
205487,
295599,
303793,
164533,
287417,
287422,
66242,
287439,
279252,
287452,
295652,
279269,
279280,
230134,
221948,
205568,
295682,
295697,
336671,
344865,
279336,
262954,
295724,
312108,
353069,
164656,
295729,
303920,
262962,
328499,
353078,
230199,
353079,
336702,
295746,
353094,
353095,
353109,
230234,
295776,
279392,
303972,
230248,
246641,
246648,
279417,
361337,
254850,
287622,
295824,
189348,
279464,
353195,
140204,
353197,
304051,
189374,
353216,
213960,
279498,
50143,
123881,
304110,
320494,
287731,
295927,
304122,
320507,
328700,
328706,
320516,
230410,
320527,
418837,
140310,
320536,
197657,
336929,
189474,
345132,
238639,
238651,
238664,
296019,
353367,
156764,
156765,
304222,
279660,
353397,
279672,
279685,
222343,
296086,
238743,
296092,
238765,
279728,
238769,
230588,
279747,
353479,
353481,
353482,
279760,
189652,
279765,
296153,
279774,
304351,
304356,
279785,
279792,
353523,
279814,
312587,
328971,
173334,
320796,
304421,
279854,
345396,
116026,
222524,
279875,
304456,
230729,
296270,
238927,
296273,
222559,
230756,
230765,
296303,
279920,
312689,
296307,
116084,
148867,
378244,
296335,
9619,
279974,
279984,
173491,
279989,
361927,
296392,
280010,
370123,
148940,
280013,
312782,
222675,
329173,
353750,
280032,
280041,
361963,
321009,
280055,
288249,
230913,
230921,
329225,
296461,
304656,
329232,
230943,
230959,
288309,
288318,
280130,
124485,
288326,
288327,
280147,
239198,
222832,
247416,
337535,
239237,
288392,
239250,
345752,
255649,
321207,
296632,
280251,
280257,
321219,
280267,
9936,
9937,
280278,
280280,
18138,
67292,
321247,
280300,
239341,
313081,
124669,
288512,
288516,
280327,
280329,
321302,
116505,
321310,
247590,
280366,
296755,
280372,
321337,
280380,
280390,
345929,
304977,
18262,
280410,
370522,
345951,
362337,
345955,
296806,
288619,
288620,
280430,
296814,
362352,
313203,
124798,
182144,
305026,
67463,
329622,
124824,
214937,
214938,
354212,
124852,
288697,
214977,
280514,
280519,
247757,
231375,
280541,
329695,
337895,
247785,
296941,
362480,
313339,
313357,
182296,
354345,
223274,
124975,
346162,
124984,
288828,
288833,
288834,
354385,
223316,
280661,
329814,
338007,
354393,
280675,
280677,
329829,
313447,
288879,
223350,
280694,
288889,
215164,
313469,
215166,
280712,
215178,
346271,
239793,
125109,
182456,
280762,
223419,
379071,
338119,
280778,
321745,
280795,
280802,
338150,
321772,
125169,
338164,
125183,
125188,
313608,
125193,
125198,
125203,
125208,
305440,
125217,
125235,
280887,
125240,
280902,
182598,
289110,
272729,
379225,
321894,
280939,
313713,
354676,
362881,
248194,
395659,
395661,
240016,
190871,
289189,
289194,
108972,
281040,
281072,
289304,
182817,
338490,
322120,
281166,
281171,
354911,
436832,
191082,
313966,
281199,
330379,
330387,
330388,
117397,
289434,
338613,
166582,
314040,
158394,
363211,
289502,
363230,
338662,
346858,
330474,
289518,
199414,
35583,
363263,
322313,
322319,
166676,
207640,
289576,
281408,
420677,
281427,
281433,
330609,
207732,
240518,
289698,
289703,
289727,
363458,
19399,
338899,
248797,
207838,
314342,
52200,
289774,
183279,
314355,
240630,
314362,
134150,
322570,
330763,
281626,
248872,
322612,
314448,
281697,
314467,
281700,
322663,
207979,
363644,
150657,
248961,
330888,
339102,
306338,
249002,
339130,
208058,
322749,
290000,
298212,
298213,
290022,
330984,
298228,
216315,
208124,
363771,
388349,
322824,
126237,
339234,
298291,
224586,
372043,
314720,
281957,
134506,
314739,
290173,
306559,
298374,
314758,
314760,
142729,
388487,
314766,
306579,
282007,
290207,
314783,
314789,
282022,
282024,
241066,
380357,
306631,
306639,
191981,
306673,
306677,
191990,
290300,
290301,
282114,
306692,
306693,
323080,
323087,
282129,
282136,
282141,
282146,
306723,
290358,
282183,
290390,
306776,
282213,
323178,
314998,
175741,
224901,
282245,
282246,
290443,
323217,
282259,
298654,
282271,
282273,
323236,
282276,
298661,
290471,
282280,
298667,
282303,
306890,
282318,
241361,
241365,
298712,
298720,
282339,
12010,
282348,
282358,
175873,
323331,
323332,
249626,
282400,
241441,
339745,
257830,
282417,
282427,
282434,
307011,
315202,
282438,
323406,
307025,
413521,
216918,
307031,
282474,
282480,
241528,
241540,
282504,
315273,
315274,
110480,
184208,
282518,
282519,
118685,
298909,
298920,
282549,
290746,
298980,
290811,
282633,
241692,
102437,
233517,
315476,
307289,
200794,
315487,
307299,
315498,
299121,
233589,
233590,
241808,
323729,
233636,
299174,
233642,
323762,
299187,
184505,
299198,
299203,
282831,
356576,
176362,
184570,
184584,
299293,
233762,
217380,
151847,
282919,
332085,
332089,
315706,
282939,
307517,
241986,
332101,
323916,
348492,
250192,
323920,
348500,
323935,
242029,
291192,
225670,
291224,
283038,
61857,
381347,
61859,
340398,
299441,
61873,
283064,
61880,
299456,
127427,
127428,
283075,
291267,
324039,
373197,
176601,
242139,
160225,
242148,
291311,
233978,
291333,
340490,
283153,
291358,
283182,
283184,
234036,
315960,
70209,
348742,
70215,
348749,
111208,
348806,
152203,
184973,
299699,
299700,
225995,
242386,
299759,
299770,
234234,
299776,
291585,
242433,
291592,
291604,
234277,
283430,
152365,
242485,
234294,
299849,
283467,
201551,
242529,
349026,
275303,
177001,
201577,
308076,
242541,
209783,
209785,
177019,
291712,
308107,
308112,
234386,
209817,
324506,
324507,
324517,
283558,
349121,
316364,
340955,
340961,
324586,
340974,
316405,
201720,
234500,
324625,
234514,
316437,
201755,
300068,
357414,
300084,
324666,
308287,
21569,
300111,
234577,
341073,
234587,
250981,
300135,
300136,
316520,
316526,
357486,
144496,
300146,
300151,
291959,
160891,
341115,
300158,
349316,
349318,
234638,
169104,
177296,
308372,
185493,
119962,
300187,
300188,
234663,
300201,
300202,
283840,
259268,
283847,
62665,
283852,
283853,
316627,
357595,
234733,
234742,
292091,
316669,
234755,
242954,
292107,
251153,
300343,
333117,
193859,
300359,
234827,
177484,
251213,
234831,
120148,
283991,
234850,
292195,
333160,
284014,
243056,
111993,
112017,
234898,
112018,
357786,
333220,
316842,
210358,
284089,
292283,
415171,
300487,
300489,
284107,
366037,
210390,
210391,
210393,
144867,
316902,
54765,
251378,
333300,
300535,
300536,
333303,
300542,
210433,
366083,
316946,
308756,
398869,
308764,
349726,
333343,
349741,
169518,
235070,
349763,
218696,
292425,
243274,
128587,
333388,
333393,
300630,
235095,
333408,
374372,
317032,
54893,
366203,
325245,
300714,
218819,
333517,
333520,
333521,
333523,
153319,
284401,
325371,
194303,
194304,
300811,
284429,
284431,
366360,
284442,
325404,
325410,
341796,
333610,
317232,
325439,
341836,
325457,
284507,
300894,
284512,
284514,
276327,
292712,
325484,
292720,
325492,
300918,
317304,
194429,
325503,
333701,
243591,
325515,
243597,
325518,
300963,
292771,
333735,
284587,
292782,
243637,
284619,
301008,
153554,
194515,
219101,
292836,
292837,
325619,
333817,
292858,
333828,
145435,
317467,
292902,
227370,
358456,
309345,
227428,
194666,
284788,
333940,
292992,
194691,
227460,
333955,
235662,
325776,
317587,
284826,
333991,
333992,
284842,
301251,
309444,
227524,
227548,
301279,
317664,
243962,
309503,
375051,
325905,
325912,
309529,
227616,
211235,
211238,
260418,
6481,
366929,
366930,
6489,
391520,
416104,
285040,
227725,
227726,
178582,
293274,
317852,
285090,
375207,
293310,
317901,
326100,
285150,
227809,
342498,
195045,
293367,
342536,
342553,
375333,
293419,
244269,
236081,
23092,
309830,
301638,
293448,
55881,
244310,
301689,
227990,
342682,
285361,
342706,
342713,
285373,
154316,
96984,
318173,
285415,
342762,
154359,
162561,
285444,
285458,
326429,
326433,
318250,
318252,
285487,
301871,
285497,
293693,
318278,
293711,
301918,
293730,
351077,
342887,
400239,
269178,
359298,
113542,
228233,
228234,
56208,
293781,
318364,
310176,
310178,
293800,
236461,
293806,
130016,
64485,
203757,
293886,
146448,
252980,
359478,
302139,
359495,
228458,
15471,
187506,
285814,
187521,
285828,
302213,
302216,
228491,
228493,
285838,
162961,
326804,
302240,
343203,
253099,
367799,
294074,
64700,
228542,
343234,
367810,
244940,
228563,
228588,
253167,
302325,
228609,
245019,
130338,
130343,
351537,
286018,
113987,
294218,
318805,
294243,
163175,
327024,
327025,
327031,
179587,
368011,
318864,
318875,
310701,
286129,
228795,
302529,
302531,
163268,
310732,
302540,
64975,
327121,
228827,
286172,
310757,
187878,
343542,
343543,
286202,
286205,
302590,
228861,
294400,
228867,
253452,
146964,
286244,
245287,
245292,
286254,
56902,
228943,
286288,
196187,
343647,
286306,
310889,
138863,
294529,
286343,
229001,
310923,
188048,
229020,
302754,
245412,
40613,
40614,
40615,
229029,
286388,
286391,
319162,
286399,
212685,
212688,
245457,
302802,
286423,
278233,
278234,
294622,
278240,
229088,
212716,
212717,
286459,
278272,
319233,
278291,
294678,
286494,
294700,
360252,
188251,
245599,
237408,
302946,
253829,
294807,
294809,
294814,
319392,
294823,
294843,
98239,
163781,
344013,
212946,
24532,
294886,
253929,
327661,
311282
] |
b90d6eed7633eae93895ab01434012530ecd51a4 | 84b8e9a17fe563fd8ff1e8be7e137950a471166a | /swift_macos/main.swift | d59c4fd7189ec85ad98d5d1ea10d10923d5279d6 | [] | no_license | wojtekmach/minimal | 5aff7623433bca4e70c954a9845070581ef36f46 | b2ffa493f310cce0a868e277839adfcc977cd556 | refs/heads/main | 2023-03-17T00:52:45.800854 | 2022-11-06T14:03:35 | 2022-11-06T14:03:35 | 135,748,873 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,113 | swift | import Cocoa
class AppDelegate: NSObject, NSApplicationDelegate {
private var window : NSWindow!
func applicationDidFinishLaunching(_ aNotification: Notification) {
let menuItemOne = NSMenuItem()
menuItemOne.submenu = NSMenu(title: "Example")
menuItemOne.submenu?.items = [
NSMenuItem(title: "Quit Example", action: #selector(NSApplication.terminate(_:)), keyEquivalent: "q")
]
let menu = NSMenu()
menu.items = [menuItemOne]
NSApp.mainMenu = menu
window = NSWindow(contentRect: NSMakeRect(0, -1000, 200, 200),
styleMask: [.titled, .closable],
backing: .buffered,
defer: true)
window.orderFrontRegardless()
window.title = "Minimal"
NSApp.activate(ignoringOtherApps: true)
}
func applicationShouldTerminateAfterLastWindowClosed(_ app: NSApplication) -> Bool {
return true
}
}
let app = NSApplication.shared
app.setActivationPolicy(.regular)
let delegate = AppDelegate()
app.delegate = delegate
app.run()
| [
-1
] |
771b1a09b3efa8c924fe1f072bf7ab5c41364a00 | 6a8a7916a59c98a4db6c42314fa62fd1d314d1d4 | /Bezier Interpolation/Bezier Interpolation/ContentView.swift | f265d1875b0d153d49de3d44f8bbc9d2e587686d | [] | no_license | Wildchild9/Bezier-Interpolation | 71a5382af04476f9b1dfd8d6bf5c022040790003 | 1364520137a9ec1f21870924bfe39e7c55a1dd10 | refs/heads/master | 2023-06-29T08:00:04.481760 | 2020-12-02T22:28:10 | 2020-12-02T22:28:10 | 317,679,534 | 0 | 0 | null | 2021-08-02T02:22:43 | 2020-12-01T22:03:26 | Swift | UTF-8 | Swift | false | false | 883 | swift | //
// ContentView.swift
// Bezier Interpolation
//
// Created by Noah Wilder on 2020-12-01.
//
import SwiftUI
struct ContentView: View {
var text: NSAttributedString {
NSAttributedString(
string: "Hello World!",
attributes: [.font: NSFont.systemFont(ofSize: 30)]
)
}
var body: some View {
VStack {
Spacer()
Text("Hello World!")
.font(.system(size: 30))
.fontWeight(.light)
.background(Color.red)
Spacer()
TextShapeView(text: text)
.background(Color.blue)
Spacer()
}
.frame(width: 300, height: 300)
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
| [
-1
] |
e995ff0feddff5cc89bc092317ecdbaac08cc635 | abe693ecadc789a9d98ce6e04d9dc25f4ee89562 | /MovieSearch/MoviesTableViewController.swift | 544a7d80226a7d28df3b08cfc5533529846b5b48 | [] | no_license | parkerdonat/ios-challenge-movie-search | c2def12ca3486843a8a74e1da3b865e18029a9b7 | 6ae040edf1cd1dd02a912760db78639e9592c927 | refs/heads/master | 2020-12-25T21:00:41.881448 | 2016-04-22T23:12:58 | 2016-04-22T23:12:58 | 56,879,083 | 0 | 0 | null | 2016-04-22T19:07:58 | 2016-04-22T19:07:56 | Swift | UTF-8 | Swift | false | false | 1,549 | swift | //
// MoviesTableViewController.swift
// MovieSearch
//
// Created by Parker Donat on 4/22/16.
// Copyright © 2016 DevMountain. All rights reserved.
//
import UIKit
class MovieListTableViewController: UITableViewController, UISearchBarDelegate {
var movies: [Movie] = []
override func viewDidLoad() {
super.viewDidLoad()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func searchBarSearchButtonClicked(searchBar: UISearchBar) {
guard let searchText = searchBar.text else {return}
MovieController.searchForMovie(searchText) { (movies) in
guard let movies = movies else { return }
self.movies = movies
self.tableView.reloadData()
}
searchBar.resignFirstResponder()
}
// MARK: - Table view data source
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// #warning Incomplete implementation, return the number of rows
return movies.count
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("movieCell", forIndexPath: indexPath) as! MovieTableViewCell
let movie = movies[indexPath.row]
cell.updateCell(movie)
return cell
}
} | [
-1
] |
42d19b188fdbf56c0890ec0af43be72ee1218ff7 | 1b04ba1fab3f0f7320a4f074c5c2ed4b2d3295c2 | /iosmobileapplication/ZorroSign/Views/Biometric-Fallback-New-Implementation/RecoveryOtp/RecoveryOtpTextErrorView.swift | 48e375d5586f99793e988700d3565e5a627586b5 | [] | no_license | Kavindu-Randimal/mobile_plus_widget | 06db1b18a021082f0017850ba12ddee5e8098a95 | cf61b247909158e45f93b88a7e7dfab4dea56041 | refs/heads/master | 2023-08-06T07:03:19.072119 | 2021-10-03T16:27:18 | 2021-10-03T16:27:18 | 413,132,522 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 6,387 | swift | //
// RecoveryOtpTextErrorView.swift
// ZorroSign
//
// Created by CHATHURA ELLAWALA on 6/22/20.
// Copyright © 2020 Apple. All rights reserved.
//
import UIKit
class RecoveryOtpTextErrorView: UIView {
private var greenColor: UIColor = ColorTheme.btnBG
private let deviceName = UIDevice.current.userInterfaceIdiom
private var containerView: UIView!
private var headerLabel: UILabel!
private var fourdigitsView: UIView!
private var errorMessageLabel: UILabel!
private var digitViews: [UIView] = []
private var bottomBars: [UIView] = []
private var digitTextBoxes: [UITextField] = []
var otpcallBack: ((Int?) -> ())?
override init(frame: CGRect) {
super.init(frame: frame)
setContainer()
setfourDigitsView()
setTextViews()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
//MARK: - Setup Container View
extension RecoveryOtpTextErrorView {
private func setContainer() {
containerView = UIView()
containerView.translatesAutoresizingMaskIntoConstraints = false
containerView.backgroundColor = .white
addSubview(containerView)
let containerviewConstraints = [containerView.leftAnchor.constraint(equalTo: leftAnchor),
containerView.topAnchor.constraint(equalTo: topAnchor),
containerView.rightAnchor.constraint(equalTo: rightAnchor),
containerView.bottomAnchor.constraint(equalTo: bottomAnchor)]
NSLayoutConstraint.activate(containerviewConstraints)
}
}
//MARK: Setup Digits
extension RecoveryOtpTextErrorView {
private func setfourDigitsView() {
fourdigitsView = UIView()
fourdigitsView.translatesAutoresizingMaskIntoConstraints = false
fourdigitsView.backgroundColor = .white
containerView.addSubview(fourdigitsView)
let _height = (UIScreen.main.bounds.width/2)/4
var _width = (UIScreen.main.bounds.width/2)/5 * 4 + 30
if deviceName == .pad {
_width = (UIScreen.main.bounds.width/3)/5 * 4 + 30
}
let fourdigitsviewConstraints = [fourdigitsView.leftAnchor.constraint(equalTo: containerView.leftAnchor, constant: 15),
fourdigitsView.topAnchor.constraint(equalTo: containerView.topAnchor),
fourdigitsView.widthAnchor.constraint(equalToConstant: _width),
fourdigitsView.heightAnchor.constraint(equalToConstant: _height)]
NSLayoutConstraint.activate(fourdigitsviewConstraints)
}
}
//MARK: Setup Digits Text
extension RecoveryOtpTextErrorView {
private func setTextViews() {
let _startPoint: CGFloat = 10.0
var _width = (UIScreen.main.bounds.width/2)/5
if deviceName == .pad {
_width = (UIScreen.main.bounds.width/3)/5
}
for i in 0..<4 {
let _gap = _startPoint * CGFloat(i) + (_width * CGFloat(i))
let _digittextView = UIView(frame: CGRect(x: _gap, y: 0, width: _width, height: _width))
_digittextView.backgroundColor = .white
_digittextView.tag = i
let _inidicatorHeight: CGFloat = 3.0
let _inidicatorY: CGFloat = _width - _inidicatorHeight
let _bottomIndicatorView = UIView(frame: CGRect(x: 0, y: _inidicatorY, width: _width, height: _inidicatorHeight))
_bottomIndicatorView.backgroundColor = ColorTheme.imgTint
_digittextView.addSubview(_bottomIndicatorView)
let _textboxHeight: CGFloat = _width - 2.0
let _textBox = UITextField(frame: CGRect(x: 0, y: 0, width: _width, height: _textboxHeight))
_textBox.borderStyle = .none
_textBox.textAlignment = .center
_textBox.keyboardType = .numberPad
_textBox.placeholder = "●"
_textBox.font = UIFont(name: "Helvetica", size: 17)
_textBox.delegate = self
_textBox.tag = i
_textBox.addTarget(self, action: #selector(changedTextField(_:)), for: .editingChanged)
_digittextView.addSubview(_textBox)
bottomBars.append(_bottomIndicatorView)
digitTextBoxes.append(_textBox)
digitViews.append(_digittextView)
fourdigitsView.addSubview(_digittextView)
}
}
}
//MARK: TextField Delegates
extension RecoveryOtpTextErrorView: UITextFieldDelegate {
@objc private func changedTextField(_ textField: UITextField) {
let tag = textField.tag
if let _text = textField.text {
if _text.count == 1 {
if tag <= 2 {
digitTextBoxes[tag+1].becomeFirstResponder()
}
getotpintValue()
return
}
}
}
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
if let _text = textField.text, let _textRange = Range(range, in: _text){
let _updatedText = _text.replacingCharacters(in: _textRange, with: string)
if _updatedText.count > 1 {
return false
}
}
return true
}
}
//MARK: Get OTP Int Value
extension RecoveryOtpTextErrorView {
private func getotpintValue(){
var _otpstring = ""
var _otpvalue: Int = 0
for _textfield in digitTextBoxes {
if let _text = _textfield.text {
_otpstring += _text
}
}
_otpvalue = Int(_otpstring)!
otpcallBack!(_otpvalue)
return
}
}
//MARK: Clear Text Fields
extension RecoveryOtpTextErrorView {
func cleartextBoxes() {
DispatchQueue.main.async {
self.errorMessageLabel.isHidden = true
for i in 0..<self.digitViews.count {
self.digitTextBoxes[i].text = ""
self.bottomBars[i].backgroundColor = ColorTheme.imgTint
}
}
}
}
| [
-1
] |
320540a470449d8e8e32dcb378aa6ae27a906abd | d3d5943b93fca0fce14ca614439bdfe8849b0ff2 | /MovieAppMVVM/ViewModel/TrailerVM.swift | 4d5e82145825ddf780620d8379358a49cf61c8c4 | [
"Apache-2.0"
] | permissive | gogoto2/MovieAppMVVM | d949d94dcf38a1fe3cd716f3e05ea5d777fb3c4d | f9e88fb4991c3f16a49cb11a3615d01e0a9409a0 | refs/heads/master | 2022-01-23T03:33:25.817230 | 2019-09-05T20:33:17 | 2019-09-05T20:33:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 388 | swift | //
// TrailerVM.swift
// MovieAppMVVM
//
// Created by Ayush Gupta on 03/09/19.
// Copyright © 2019 Ayush Gupta. All rights reserved.
//
import Foundation
class TrailerViewModel {
var arrVideos = [TrailerResults]()
func getParameters(apiKey: String) -> [String: String] {
let param = [
"api_key": apiKey
]
return param
}
}
| [
-1
] |
a6cca22f4450ca7e0336019f2c64be762bfedd5d | 8ad40845d2be348d436b58b88d96945ad1ae702b | /samples/client/petstore/swift/rxswift/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift | 8e0a210ed7e9a1505403a147b75559c2ce9158f6 | [
"Apache-2.0"
] | permissive | bannzai/openapi-generator | 94207aa4effa5ade304993be20601d40d1c355ae | f1831533d4cdd823a4560be1ba2d205122c487b3 | refs/heads/master | 2020-04-13T02:03:48.675384 | 2018-12-23T11:03:50 | 2018-12-23T11:03:50 | 162,891,997 | 5 | 0 | Apache-2.0 | 2018-12-23T14:40:58 | 2018-12-23T13:13:33 | HTML | UTF-8 | Swift | false | false | 10,191 | swift | //
// StoreAPI.swift
//
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Alamofire
import RxSwift
public class StoreAPI: APIBase {
/**
Delete purchase order by ID
- parameter orderId: (path) ID of the order that needs to be deleted
- parameter completion: completion handler to receive the data and the error objects
*/
public class func deleteOrder(orderId orderId: String, completion: ((error: ErrorType?) -> Void)) {
deleteOrderWithRequestBuilder(orderId: orderId).execute { (response, error) -> Void in
completion(error: error);
}
}
/**
Delete purchase order by ID
- parameter orderId: (path) ID of the order that needs to be deleted
- returns: Observable<Void>
*/
public class func deleteOrder(orderId orderId: String) -> Observable<Void> {
return Observable.create { observer -> Disposable in
deleteOrder(orderId: orderId) { error in
if let error = error {
observer.on(.Error(error as ErrorType))
} else {
observer.on(.Next())
}
observer.on(.Completed)
}
return NopDisposable.instance
}
}
/**
Delete purchase order by ID
- DELETE /store/order/{orderId}
- For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - parameter orderId: (path) ID of the order that needs to be deleted
- returns: RequestBuilder<Void>
*/
public class func deleteOrderWithRequestBuilder(orderId orderId: String) -> RequestBuilder<Void> {
var path = "/store/order/{orderId}"
path = path.stringByReplacingOccurrencesOfString("{orderId}", withString: "\(orderId)", options: .LiteralSearch, range: nil)
let URLString = PetstoreClientAPI.basePath + path
let nillableParameters: [String:AnyObject?] = [:]
let parameters = APIHelper.rejectNil(nillableParameters)
let convertedParameters = APIHelper.convertBoolToString(parameters)
let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
return requestBuilder.init(method: "DELETE", URLString: URLString, parameters: convertedParameters, isBody: true)
}
/**
Returns pet inventories by status
- parameter completion: completion handler to receive the data and the error objects
*/
public class func getInventory(completion: ((data: [String:Int32]?, error: ErrorType?) -> Void)) {
getInventoryWithRequestBuilder().execute { (response, error) -> Void in
completion(data: response?.body, error: error);
}
}
/**
Returns pet inventories by status
- returns: Observable<[String:Int32]>
*/
public class func getInventory() -> Observable<[String:Int32]> {
return Observable.create { observer -> Disposable in
getInventory() { data, error in
if let error = error {
observer.on(.Error(error as ErrorType))
} else {
observer.on(.Next(data!))
}
observer.on(.Completed)
}
return NopDisposable.instance
}
}
/**
Returns pet inventories by status
- GET /store/inventory
- Returns a map of status codes to quantities - API Key:
- type: apiKey api_key
- name: api_key
- returns: RequestBuilder<[String:Int32]>
*/
public class func getInventoryWithRequestBuilder() -> RequestBuilder<[String:Int32]> {
let path = "/store/inventory"
let URLString = PetstoreClientAPI.basePath + path
let nillableParameters: [String:AnyObject?] = [:]
let parameters = APIHelper.rejectNil(nillableParameters)
let convertedParameters = APIHelper.convertBoolToString(parameters)
let requestBuilder: RequestBuilder<[String:Int32]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
return requestBuilder.init(method: "GET", URLString: URLString, parameters: convertedParameters, isBody: true)
}
/**
Find purchase order by ID
- parameter orderId: (path) ID of pet that needs to be fetched
- parameter completion: completion handler to receive the data and the error objects
*/
public class func getOrderById(orderId orderId: String, completion: ((data: Order?, error: ErrorType?) -> Void)) {
getOrderByIdWithRequestBuilder(orderId: orderId).execute { (response, error) -> Void in
completion(data: response?.body, error: error);
}
}
/**
Find purchase order by ID
- parameter orderId: (path) ID of pet that needs to be fetched
- returns: Observable<Order>
*/
public class func getOrderById(orderId orderId: String) -> Observable<Order> {
return Observable.create { observer -> Disposable in
getOrderById(orderId: orderId) { data, error in
if let error = error {
observer.on(.Error(error as ErrorType))
} else {
observer.on(.Next(data!))
}
observer.on(.Completed)
}
return NopDisposable.instance
}
}
/**
Find purchase order by ID
- GET /store/order/{orderId}
- For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - examples: [{contentType=application/json, example={
"petId" : 6,
"quantity" : 1,
"id" : 0,
"shipDate" : "2000-01-23T04:56:07.000+00:00",
"complete" : true,
"status" : "placed"
}}, {contentType=application/xml, example=<Order>
<id>123456789</id>
<petId>123456789</petId>
<quantity>123</quantity>
<shipDate>2000-01-23T04:56:07.000Z</shipDate>
<status>aeiou</status>
<complete>true</complete>
</Order>}]
- examples: [{contentType=application/json, example={
"petId" : 6,
"quantity" : 1,
"id" : 0,
"shipDate" : "2000-01-23T04:56:07.000+00:00",
"complete" : true,
"status" : "placed"
}}, {contentType=application/xml, example=<Order>
<id>123456789</id>
<petId>123456789</petId>
<quantity>123</quantity>
<shipDate>2000-01-23T04:56:07.000Z</shipDate>
<status>aeiou</status>
<complete>true</complete>
</Order>}]
- parameter orderId: (path) ID of pet that needs to be fetched
- returns: RequestBuilder<Order>
*/
public class func getOrderByIdWithRequestBuilder(orderId orderId: String) -> RequestBuilder<Order> {
var path = "/store/order/{orderId}"
path = path.stringByReplacingOccurrencesOfString("{orderId}", withString: "\(orderId)", options: .LiteralSearch, range: nil)
let URLString = PetstoreClientAPI.basePath + path
let nillableParameters: [String:AnyObject?] = [:]
let parameters = APIHelper.rejectNil(nillableParameters)
let convertedParameters = APIHelper.convertBoolToString(parameters)
let requestBuilder: RequestBuilder<Order>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
return requestBuilder.init(method: "GET", URLString: URLString, parameters: convertedParameters, isBody: true)
}
/**
Place an order for a pet
- parameter order: (body) order placed for purchasing the pet (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
public class func placeOrder(order order: Order? = nil, completion: ((data: Order?, error: ErrorType?) -> Void)) {
placeOrderWithRequestBuilder(order: order).execute { (response, error) -> Void in
completion(data: response?.body, error: error);
}
}
/**
Place an order for a pet
- parameter order: (body) order placed for purchasing the pet (optional)
- returns: Observable<Order>
*/
public class func placeOrder(order order: Order? = nil) -> Observable<Order> {
return Observable.create { observer -> Disposable in
placeOrder(order: order) { data, error in
if let error = error {
observer.on(.Error(error as ErrorType))
} else {
observer.on(.Next(data!))
}
observer.on(.Completed)
}
return NopDisposable.instance
}
}
/**
Place an order for a pet
- POST /store/order - examples: [{contentType=application/json, example={
"petId" : 6,
"quantity" : 1,
"id" : 0,
"shipDate" : "2000-01-23T04:56:07.000+00:00",
"complete" : true,
"status" : "placed"
}}, {contentType=application/xml, example=<Order>
<id>123456789</id>
<petId>123456789</petId>
<quantity>123</quantity>
<shipDate>2000-01-23T04:56:07.000Z</shipDate>
<status>aeiou</status>
<complete>true</complete>
</Order>}]
- examples: [{contentType=application/json, example={
"petId" : 6,
"quantity" : 1,
"id" : 0,
"shipDate" : "2000-01-23T04:56:07.000+00:00",
"complete" : true,
"status" : "placed"
}}, {contentType=application/xml, example=<Order>
<id>123456789</id>
<petId>123456789</petId>
<quantity>123</quantity>
<shipDate>2000-01-23T04:56:07.000Z</shipDate>
<status>aeiou</status>
<complete>true</complete>
</Order>}]
- parameter order: (body) order placed for purchasing the pet (optional)
- returns: RequestBuilder<Order>
*/
public class func placeOrderWithRequestBuilder(order order: Order? = nil) -> RequestBuilder<Order> {
let path = "/store/order"
let URLString = PetstoreClientAPI.basePath + path
let parameters = order?.encodeToJSON() as? [String:AnyObject]
let convertedParameters = APIHelper.convertBoolToString(parameters)
let requestBuilder: RequestBuilder<Order>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
return requestBuilder.init(method: "POST", URLString: URLString, parameters: convertedParameters, isBody: true)
}
}
| [
-1
] |
f9ae83f366f6b0855a3e68e456e2a7da9ec0dbbc | 6b0f3d022f529878b96ebc6111741481912d63f3 | /Sources/SwiftImage/Extrapolation.swift | 3151fa8e419099d724c12e85fba45d183fbe1aae | [
"MIT"
] | permissive | koher/swift-image | 95ce63c49dd90637028ed595283368f241b496e8 | c61b8cf4613a7fc80d1c2a84231cef2909e837a1 | refs/heads/master | 2022-08-07T17:03:27.394797 | 2020-04-26T17:02:55 | 2020-04-26T17:02:55 | 35,428,820 | 231 | 35 | MIT | 2022-03-26T18:01:31 | 2015-05-11T14:24:52 | Swift | UTF-8 | Swift | false | false | 4,342 | swift | public enum ExtrapolationMethod<Pixel> {
case constant(Pixel)
case edge
case `repeat`
case reflection
}
private func reminder(_ a: Int, _ b: Int) -> Int {
let result = a % b
return result < 0 ? result + b : result
}
extension ImageProtocol {
public subscript(x: Int, y: Int, extrapolation extrapolationMethod: ExtrapolationMethod<Pixel>) -> Pixel {
switch extrapolationMethod {
case .constant(let value):
return extrapolatedPixelByFillingAt(x: x, y: y, by: value)
case .edge:
return extrapolatedPixelByEdgeAt(x: x, y: y, xRange: ClosedRange(xRange), yRange: ClosedRange(yRange))
case .repeat:
return extrapolatedPixelByRepeatAt(x: x, y: y, minX: xRange.lowerBound, minY: yRange.lowerBound, width: width, height: height)
case .reflection:
let doubleWidth = width * 2
let doubleHeight = height * 2
return extrapolatedPixelByReflectionAt(
x: x,
y: y,
minX: xRange.lowerBound,
minY: yRange.lowerBound,
doubleWidth: doubleWidth,
doubleHeight: doubleHeight,
doubleWidthMinusOne: doubleWidth - 1,
doubleHeightMinusOne: doubleHeight - 1
)
}
}
@usableFromInline
internal func extrapolatedPixelByFillingAt(x: Int, y: Int, by value: Pixel) -> Pixel {
guard xRange.contains(x) && yRange.contains(y) else {
return value
}
return self[x, y]
}
@usableFromInline
internal func extrapolatedPixelByEdgeAt(x: Int, y: Int, xRange: ClosedRange<Int>, yRange: ClosedRange<Int>) -> Pixel {
return self[clamp(x, lower: xRange.lowerBound, upper: xRange.upperBound), clamp(y, lower: yRange.lowerBound, upper: yRange.upperBound)]
}
@usableFromInline
internal func extrapolatedPixelByRepeatAt(x: Int, y: Int, minX: Int, minY: Int, width: Int, height: Int) -> Pixel {
let x2 = reminder(x - minX, width) + minX
let y2 = reminder(y - minY, height) + minY
return self[x2, y2]
}
@usableFromInline
internal func extrapolatedPixelByReflectionAt(
x: Int,
y: Int,
minX: Int,
minY: Int,
doubleWidth: Int,
doubleHeight: Int,
doubleWidthMinusOne: Int,
doubleHeightMinusOne: Int
) -> Pixel {
let width = self.width
let height = self.height
let x2 = reminder(x - minX, doubleWidth)
let y2 = reminder(y - minY, doubleHeight)
let x3 = (x2 < width ? x2 : doubleWidthMinusOne - x2) + minX
let y3 = (y2 < height ? y2 : doubleHeightMinusOne - y2) + minY
return self[x3, y3]
}
}
extension ImageProtocol {
public subscript(xRange: Range<Int>, yRange: Range<Int>, extrapolation extrapolationMethod: ExtrapolationMethod<Pixel>) -> AnyImage<Pixel> {
return ExtrapolatedImage<Self>(
image: self,
extrapolationMethod: extrapolationMethod
)[xRange, yRange]
}
public subscript<R1: RangeExpression, R2: RangeExpression>(xRange: R1, yRange: R2, extrapolation extrapolationMethod: ExtrapolationMethod<Pixel>) -> AnyImage<Pixel> where R1.Bound == Int, R2.Bound == Int {
return self[range(from: xRange, relativeTo: self.xRange), range(from: yRange, relativeTo: self.yRange), extrapolation: extrapolationMethod]
}
public subscript<R1: RangeExpression>(xRange: R1, yRange: UnboundedRange, extrapolation extrapolationMethod: ExtrapolationMethod<Pixel>) -> AnyImage<Pixel> where R1.Bound == Int {
return self[range(from: xRange, relativeTo: self.xRange), self.yRange, extrapolation: extrapolationMethod]
}
public subscript<R2: RangeExpression>(xRange: UnboundedRange, yRange: R2, extrapolation extrapolationMethod: ExtrapolationMethod<Pixel>) -> AnyImage<Pixel> where R2.Bound == Int {
return self[self.xRange, range(from: yRange, relativeTo: self.yRange), extrapolation: extrapolationMethod]
}
public subscript(xRange: UnboundedRange, yRange: UnboundedRange, extrapolation extrapolationMethod: ExtrapolationMethod<Pixel>) -> AnyImage<Pixel> {
return self[self.xRange, self.yRange, extrapolation: extrapolationMethod]
}
}
| [
-1
] |
0e0775868480b6e2a173f351b89b94f4b20a94ce | 824a088f16b238f110a93d0e63498c872813fb9e | /GeoTrackKitExample/GeoTrackKitExampleTests/GeoTrackLocationEventTests.swift | d4a06d564c58921754b335f738849c7f627894d4 | [
"MIT"
] | permissive | dericgayle/GeoTrackKit | 4004190f96c9b63e6f0ee04f6376888fd6143f7a | 7b62cf760aa310b0bf188bcc19631a03efaf2815 | refs/heads/master | 2021-06-24T16:48:15.148276 | 2017-03-19T23:55:32 | 2017-03-19T23:55:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,461 | swift | //
// GeoTrackLocationEventTests.swift
// GeoTrackKitExample
//
// Created by Eric Internicola on 11/27/16.
// Copyright © 2016 Eric Internicola. All rights reserved.
//
import XCTest
import Quick
import Nimble
import GeoTrackKit
import GeoTrackKitExample
class GeoTrackLocationEventTests: QuickSpec {
override func spec() {
describe("Factory Creation") {
it("does create a start tracking event") {
let event = GeoTrackLocationEvent.startedTracking(message: "hello world")
expect(event.type).to(equal(GeoTrackLocationEvent.EventType.startedTrack))
expect(event.timestamp).toNot(beNil())
expect(event.message).to(equal("hello world"))
expect(event.index).to(beNil())
}
}
describe("Serialization") {
it("does serialize to a map") {
let event = GeoTrackLocationEvent.startedTracking(message: "hello world")
let map = event.map
expect(map).toNot(beNil())
// required values
expect(map["type"] as? Int).to(equal(event.type.rawValue))
expect(map["timestamp"] as? TimeInterval).to(equal(event.timestamp.msse))
// optional values
expect(map["message"] as? String).to(equal(event.message))
expect(map["index"]).to(beNil())
expect(map["index"] as? Int).to(beNil())
}
}
describe("Deserialization") {
it("does not deserialize an empty map") {
let event = GeoTrackLocationEvent.from(map: [:])
expect(event).to(beNil())
}
it("does deserialize from a map") {
let date = Date()
let map: [String:Any] = [
"type": GeoTrackLocationEvent.EventType.custom.rawValue,
"timestamp": date.msse,
"message": "hello world",
"index": 12
]
let event = GeoTrackLocationEvent.from(map: map)
expect(event).toNot(beNil())
expect(event?.type).to(equal(GeoTrackLocationEvent.EventType.custom))
expect(event?.timestamp.msse).to(equal(date.msse))
expect(event?.message).to(equal("hello world"))
expect(event?.index).to(equal(12))
}
}
}
}
| [
-1
] |
5cf10c2b2b017ecb53b522f810457c0c92df47b4 | 137d1c39505692940753c9cd68646301a3fd14ad | /app/FriendlyApi/FriendlyApi/RatingScore.swift | 568993b3d672a3e6e982a342e6a2e7ad38dffc63 | [] | no_license | chrisfisher/kdfy | e3e7279a40560dd211ec2eab5e34ed3dd7d04bea | adb7f648b7cc4044503d0b941a3e9408de048738 | refs/heads/master | 2021-01-02T23:03:39.345206 | 2017-08-06T01:01:21 | 2017-08-06T01:01:21 | 99,456,038 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 510 | swift | //
// RatingScore.swift
// FriendlyApi
//
// Created by Chris Fisher on 28/01/16.
// Copyright © 2016 Department of Architecture. All rights reserved.
//
import Foundation
import ObjectMapper
public class RatingScore: Mappable {
public var ratingScoreId: Int!
public var ratingScore: Int!
public var value: Int!
required public init?(_ map: Map){}
public func mapping(map: Map) {
ratingScoreId <- map["id"]
ratingScore <- map["ratingScore"]
value <- map["value"]
}
}
| [
-1
] |
5c061896f6ebb758ab25882cfc4fead8e3900403 | 023be021b823a32d4095e67b2eaa8d387bb572b2 | /LocNotes/PhotoCollectionViews/AddNewPhotoCollectionViewCell.swift | b260b7394b404634b2c71ab850a2afd0c6ccdff6 | [
"MIT"
] | permissive | axesoota/LocNotes | 6b52adaac6b6373a9befc9dcddb5b8288787d26f | 7c592da748a3a605bb8f249500f5a09a82a66c91 | refs/heads/master | 2021-06-01T01:50:18.639538 | 2016-07-28T16:44:38 | 2016-07-28T16:44:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 860 | swift | //
// AddNewPhotoCollectionViewCell.swift
// LocNotes
//
// Created by Akshit (Axe) Soota on 7/8/16.
// Copyright © 2016 axe. All rights reserved.
//
import UIKit
class AddNewPhotoCollectionViewCell: UICollectionViewCell {
// Functions that will be called when the add photo button is clicked
var addPhotoButtonClickedFunction: ((sender: AnyObject) -> Void)?
override init(frame: CGRect) {
super.init(frame: frame) // Let the super do its job
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder) // Let the super do its job
}
// MARK: - Actions handled here
@IBAction func addPhotoButtonClicked(sender: AnyObject) {
if( addPhotoButtonClickedFunction != nil ) {
addPhotoButtonClickedFunction!(sender: sender) // Call the function
}
}
} | [
-1
] |
d35e0a69683375547bf519bcf9ea6468f8153f45 | 170daa0496e1986a80371a84e8efc6aa1dad0223 | /VDUIExtensions/Classes/UIButton++.swift | 8bac74abcd67e593e133def4a95340795a5b22cd | [
"MIT"
] | permissive | dankinsoid/UIKitExtensions | 16e4e52bdca8892dbc7ff473f43928a86eecbe49 | a161109df9d9cdff6073a52d2d379ebc1d24553a | refs/heads/master | 2020-07-02T14:37:05.238817 | 2019-09-29T22:07:53 | 2019-09-29T22:07:53 | 201,559,389 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,292 | swift | //
// UIButton++.swift
// Pods-UIKitExtensions_Tests
//
// Created by Daniil on 10.08.2019.
//
import UIKit
import ObjectiveC
public extension UIButton {
fileprivate struct AssociatedKey {
static var stateColors = "stateColors"
static var stateColorsObservers = "stateColorsObservers"
}
fileprivate var colors: [UInt: UIColor] {
get {
return (objc_getAssociatedObject(self, &AssociatedKey.stateColors) as? [UInt: UIColor]) ?? [:]
}
set {
objc_setAssociatedObject(self, &AssociatedKey.stateColors, newValue, objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN)
}
}
fileprivate var stateObservers: [NSKeyValueObservation] {
get {
return (objc_getAssociatedObject(self, &AssociatedKey.stateColorsObservers) as? [NSKeyValueObservation]) ?? []
}
set {
objc_setAssociatedObject(self, &AssociatedKey.stateColorsObservers, newValue, objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN)
}
}
func setBackground(color: UIColor, for state: UIControl.State) {
var stateColor = self.colors
stateColor[state.rawValue] = color
if state == self.state {
DispatchQueue.main.async { self.backgroundColor = color }
} else {
stateColor[self.state.rawValue] = stateColor[self.state.rawValue] ?? backgroundColor ?? .clear
}
if stateObservers.isEmpty {
var observers: [NSKeyValueObservation] = []
observers.append(self.observe(\.isEnabled) { (button, _) in button.setColor() })
observers.append(self.observe(\.isHighlighted) { (button, _) in button.setColor() })
observers.append(self.observe(\.isFocused) { (button, _) in button.setColor() })
observers.append(self.observe(\.isSelected) { (button, _) in button.setColor() })
observers.append(self.observe(\.state) { (button, _) in button.setColor() })
stateObservers = observers
}
self.colors = stateColor
}
fileprivate func setColor() {
UIView.animate(withDuration: 0.2, animations: {
self.backgroundColor = self.colors[self.state.rawValue] ?? self.backgroundColor
})
}
}
| [
-1
] |
c43a2c22cc445483e19d896e776b059c31621b0b | 563387027196bad1fb9ae0f797472bf739e8a0fd | /QuoteBook/AuthorWikiImageCell.swift | 1e69cb7d5bea7a77cf7d0d6a8e5bb677deaad332 | [] | no_license | Lxrd-AJ/QuoteBook | 0540ef82f2cda9e98081e0caf322d661cc0d424f | d414e05d640c29f296f86fc1d866aff65782ce32 | refs/heads/master | 2021-01-21T04:54:34.637698 | 2016-03-03T23:12:21 | 2016-03-03T23:12:21 | 24,859,204 | 0 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 283 | swift | //
// AuthorWikiImageCell.swift
// QuoteBook
//
// Created by AJ Ibraheem on 14/01/2016.
// Copyright © 2016 The Leaf Enterprise. All rights reserved.
//
import UIKit
class AuthorWikiImageCell: UICollectionViewCell {
@IBOutlet weak var imageView: UIImageView!
}
| [
-1
] |
4a4bc1f85f11a9001d1ec2155ee07025582b7eb7 | 11fc41316ddf2a8b0de7dc6389ad49f62ca56148 | /CleanArchitectureWithCoordinatorPatternDemo/Source/Modules/Flows/Onboarding/OnboardingCoordinatorOutput.swift | 0330807ce2a12150505d2e4133b60aac7eadeea7 | [
"MIT"
] | permissive | abdelwahababdo/iOS-Clean-Architecture-with-Coordinator-pattern | e06c3a771f3e8c37d4f080c51efbd6be0a21ab2e | 02c5f4ede8dc901e77dbd27eed0e55c858316047 | refs/heads/master | 2022-05-30T21:32:41.778749 | 2017-11-11T19:24:37 | 2017-11-11T19:24:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 263 | swift | //
// AuthorizationCoordinatorOutput.swift
// Worker Dashy
//
// Created by Maksim Kazachkov on 17.08.17.
// Copyright © 2017 Umbrella. All rights reserved.
//
protocol OnboardingCoordinatorOutput: class {
var finishFlow: CompletionBlock? { get set }
}
| [
-1
] |
42bf6261f0821c331c0aae5c437b73a8006fa4d3 | 6d010a4bab30f7c56f2d78e10963ef5155c0c241 | /AudioKit/Common/Nodes/Effects/Filters/Low Shelf Filter/AKLowShelfFilter.swift | 53e34201739da20a71da3c6590515c135c4e12b6 | [
"MIT"
] | permissive | stonehouse/AudioKit | 5043a91ba3cb0bdde6d4697329306621e55cbc18 | d7207730465e8299205a88af6be54332ae5235bc | refs/heads/master | 2021-09-15T12:49:52.958900 | 2018-01-03T05:18:09 | 2018-01-03T05:18:09 | 100,455,523 | 0 | 1 | null | 2017-08-16T06:27:59 | 2017-08-16T06:27:59 | null | UTF-8 | Swift | false | false | 3,457 | swift | //
// AKLowShelfFilter.swift
// AudioKit
//
// Created by Aurelius Prochazka, revision history on Github.
// Copyright © 2017 Aurelius Prochazka. All rights reserved.
//
/// AudioKit version of Apple's LowShelfFilter Audio Unit
///
open class AKLowShelfFilter: AKNode, AKToggleable, AUEffect {
/// Four letter unique description of the node
public static let ComponentDescription = AudioComponentDescription(appleEffect: kAudioUnitSubType_LowShelfFilter)
private var au: AUWrapper
private var mixer: AKMixer
/// Cutoff Frequency (Hz) ranges from 10 to 200 (Default: 80)
open dynamic var cutoffFrequency: Double = 80 {
didSet {
cutoffFrequency = (10...200).clamp(cutoffFrequency)
au[kAULowShelfParam_CutoffFrequency] = cutoffFrequency
}
}
/// Gain (dB) ranges from -40 to 40 (Default: 0)
open dynamic var gain: Double = 0 {
didSet {
gain = (-40...40).clamp(gain)
au[kAULowShelfParam_Gain] = gain
}
}
/// Dry/Wet Mix (Default 100)
open dynamic var dryWetMix: Double = 100 {
didSet {
dryWetMix = (0...100).clamp(dryWetMix)
inputGain?.volume = 1 - dryWetMix / 100
effectGain?.volume = dryWetMix / 100
}
}
private var lastKnownMix: Double = 100
private var inputGain: AKMixer?
private var effectGain: AKMixer?
// Store the internal effect
fileprivate var internalEffect: AVAudioUnitEffect
// MARK: - Initialization
/// Tells whether the node is processing (ie. started, playing, or active)
open dynamic var isStarted = true
/// Initialize the low shelf filter node
///
/// - Parameters:
/// - input: Input node to process
/// - cutoffFrequency: Cutoff Frequency (Hz) ranges from 10 to 200 (Default: 80)
/// - gain: Gain (dB) ranges from -40 to 40 (Default: 0)
///
public init(
_ input: AKNode?,
cutoffFrequency: Double = 80,
gain: Double = 0) {
self.cutoffFrequency = cutoffFrequency
self.gain = gain
inputGain = AKMixer(input)
inputGain?.volume = 0
mixer = AKMixer(inputGain)
effectGain = AKMixer(input)
effectGain?.volume = 1
let effect = _Self.effect
self.internalEffect = effect
au = AUWrapper(effect)
super.init(avAudioNode: mixer.avAudioNode)
AudioKit.engine.attach(effect)
if let node = effectGain?.avAudioNode {
AudioKit.engine.connect(node, to: effect)
}
AudioKit.engine.connect(effect, to: mixer.avAudioNode)
au[kAULowShelfParam_CutoffFrequency] = cutoffFrequency
au[kAULowShelfParam_Gain] = gain
}
// MARK: - Control
/// Function to start, play, or activate the node, all do the same thing
open func start() {
if isStopped {
dryWetMix = lastKnownMix
isStarted = true
}
}
/// Function to stop or bypass the node, both are equivalent
open func stop() {
if isPlaying {
lastKnownMix = dryWetMix
dryWetMix = 0
isStarted = false
}
}
/// Disconnect the node
override open func disconnect() {
stop()
disconnect(nodes: [inputGain!.avAudioNode, effectGain!.avAudioNode, mixer.avAudioNode])
AudioKit.engine.detach(self.internalEffect)
}
}
| [
351790,
351809,
351798,
351791
] |
1484a2da82201135669fd5ac78f66c09c82960cd | 0a5b7529db1a74a7495e13d9b885d71f33385cdc | /Todoey HW/Data Model/Item.swift | 6ab42a289b06137f7192834341fe11c2869730ed | [] | no_license | ozarie/Todoey-HW | 60aaefeba4146c94d684a7479fd396639fda9d3c | 0da059216d5bf27585ca8123fd0fd9d30c7e7a9f | refs/heads/master | 2021-04-30T08:46:55.685795 | 2018-02-26T12:32:10 | 2018-02-26T12:32:10 | 121,383,906 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 423 | swift | //
// Item.swift
// Todoey HW
//
// Created by Oz Arie Tal Shachar on 22.2.2018.
// Copyright © 2018 Oz Arie Tal Shachar. All rights reserved.
//
import Foundation
import RealmSwift
class Item: Object {
@objc dynamic var title : String = ""
@objc dynamic var done : Bool = false
@objc dynamic var dateCreated : Date?
var parentCategory = LinkingObjects(fromType: Category.self, property: "items")
}
| [
-1
] |
3f27a9b29c8ca2b69008f59438b9e3752c6f6ffc | 10e483145b93d977244cb7585323e5c5357d78e8 | /MudFramework_Swift/UIKit/MudNavigationBar.swift | ec35f726631268e0dfd3d22389fdde0ebddd4f87 | [] | no_license | Mudmen/MudFramework_Swift | 9b70cbab3c53ed4b8036e06d562c75279857ffe8 | a6f9a7e2923550b7a61edd4badf3233efc98bcd1 | refs/heads/master | 2021-06-01T09:03:14.027865 | 2016-07-08T07:47:26 | 2016-07-08T07:47:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,196 | swift | //
// MudNavigationBar.swift
// Travel
//
// Created by TimTiger on 1/27/15.
// Copyright (c) 2015 Mudmen. All rights reserved.
//
import UIKit
public class MudNavigationBar: UINavigationBar {
override public func layoutSubviews() {
super.layoutSubviews()
// //2.方案二
// if (IOS_7_BELOW) {
// return;
// }
//
// NSInteger rightBarButtonItemsCount = self.topItem.rightBarButtonItems.count;
// if (rightBarButtonItemsCount > 0) {
// NSMutableArray *rightItems = [NSMutableArray arrayWithArray:self.topItem.rightBarButtonItems];
// UIBarButtonItem *item = [rightItems objectAtIndex:0];
// if (item.tag != 299) {
// UIBarButtonItem *rightSpacer = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
// rightSpacer.width = -10;
// rightSpacer.tag = 299;
// [rightItems insertObject:rightSpacer atIndex:0];
// self.topItem.rightBarButtonItems = rightItems;
// }
// }
// NSInteger leftBarButtonItemsCount = self.topItem.leftBarButtonItems.count;
// if (leftBarButtonItemsCount > 0) {
// NSMutableArray *leftItems = [NSMutableArray arrayWithArray:self.topItem.leftBarButtonItems];
// UIBarButtonItem *rightItem = [leftItems objectAtIndex:0];
// if (rightItem.tag != 300) {
// UIBarButtonItem *leftSpacer = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
// leftSpacer.width = -10;
// leftSpacer.tag = 300;
// [leftItems insertObject:leftSpacer atIndex:0];
// self.topItem.leftBarButtonItems = leftItems;
// }
// }
//方案1
let rightBarButtonItemsCount = self.topItem?.rightBarButtonItems?.count
if rightBarButtonItemsCount > 0 {
var rightItems: [UIBarButtonItem] = self.topItem!.rightBarButtonItems!
let item: UIBarButtonItem = rightItems[0]
if item.tag != 299 {
let rightSpace: UIBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.FixedSpace, target:nil ,action:nil)
rightSpace.width = -5;
rightSpace.tag = 299;
rightItems.insert(rightSpace, atIndex: 0)
self.topItem!.rightBarButtonItems = rightItems
}
}
let leftBarButtonItemsCount = self.topItem?.leftBarButtonItems?.count
if leftBarButtonItemsCount > 0 {
var leftItems: [UIBarButtonItem] = self.topItem!.leftBarButtonItems!
let item: UIBarButtonItem = leftItems[0]
if item.tag != 300 {
let leftSpace: UIBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.FixedSpace, target:nil ,action:nil)
leftSpace.width = -5;
leftSpace.tag = 300;
leftItems.insert(leftSpace, atIndex: 0)
self.topItem!.leftBarButtonItems = leftItems
}
}
}
}
| [
-1
] |
f1d0f8b6b0a5ebdb9670da9597da60f272f51f4f | 12315266a0e8a893a00f14fa336caedc6c0eb37f | /CALayerDemo/CALayerDemo/ViewController.swift | 003f48630e50ebc13dc7bbbe8623340094b9b137 | [] | no_license | Wishell/Swiftbook | 0dba4696c096b28f714b3118e037d760298d848e | 36d2fe3cf7924a85544a67c3bbc59eddb182af88 | refs/heads/master | 2020-04-09T03:33:02.070214 | 2019-02-13T19:51:15 | 2019-02-13T19:51:15 | 159,986,975 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 382 | swift | //
// ViewController.swift
// CALayerDemo
//
// Created by Ivan Akulov on 07/12/2016.
// Copyright © 2016 Ivan Akulov. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var button: UIButton!
@IBOutlet weak var imageView: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
}
}
| [
358079
] |
be22b2f24962aa6d3ed3438e3afa4f7da40ad5bb | ae724c466e7f725fb5d06767fa6cdf1f37dc1704 | /Planti/Views/Components/FloatingButton.swift | 1dcdee9105a2b9a827d5e23690a43a0ecedfcd58 | [] | no_license | dwieners/planti-ios | 3dcd5d5adc854f9ddb71cfa5df18b1000756b0f0 | bfc0a4ddd94654dd1baf81ee991236dd84f9f7be | refs/heads/main | 2023-03-16T04:31:44.398497 | 2021-03-02T19:57:38 | 2021-03-02T19:57:38 | 313,671,781 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,133 | swift | //
// FloatingClassifyButton.swift
// Planti
//
// Created by Dominik Wieners on 02.01.21.
//
import SwiftUI
struct FloatingButton: View {
let action: () -> Void
var image: Image
var label: String
var body: some View {
Button(action: action,
label: {
LazyVStack{
HStack{
image
.resizable()
.foregroundColor(.white)
.frame(width: 28, height: 28, alignment: /*@START_MENU_TOKEN@*/.center/*@END_MENU_TOKEN@*/)
Text(label)
.font(.headline)
.foregroundColor(.white)
.lineLimit(0)
}
}.frame(height: 50)
})
.background(Color.green)
.cornerRadius(25)
}
}
struct FloatingButton_Previews: PreviewProvider {
static var previews: some View {
FloatingButton(action: {}, image: Image(systemName: "camera.viewfinder"), label: "Pflanze bestimmen")
}
}
| [
-1
] |
f89ddf56a74cc4aaf9d0eeabb7bc33908776098c | 832b4b81bcdbed9a4987d470d1753cb021690170 | /Calculator/CalculatorBrain.swift | 8412c4800f72f62a206c241fb7add07a95afdb3b | [] | no_license | hesandoval/495Calculator | 1660b23299c5e145f99dc719983919d8b3cdf3d8 | 896809027018b189408c54f932e018fdf1b723aa | refs/heads/master | 2020-04-11T07:21:19.027168 | 2015-09-30T05:56:57 | 2015-09-30T05:56:57 | 41,385,671 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,650 | swift | //
// CalculatorBrain.swift
// Calculator
//
// Created by Hector Sandoval on 9/28/15.
// Copyright © 2015 Hector Sandoval. All rights reserved.
//
import Foundation
class CalculatorBrain{
//private***********************************************************************
private enum Op: CustomStringConvertible{
case Operand(Double)
case UnaryOperation(String, Double->Double)
case BinaryOperation(String, (Double,Double)->Double);
case Variable(String)
var description: String{
get{
switch self{
case .Operand(let operand):
return "\(operand)"
case .UnaryOperation(let symbol, _):
return symbol
case .BinaryOperation(let symbol, _):
return symbol
case .Variable(let variable):
return "\(variable)"
}
}
}
}
//******************************************************************************
private func evaluate(ops: [Op])->(result: Double?, remainingOps:[Op]){
if !ops.isEmpty {
var remainingOps = ops
let op = remainingOps.removeLast()
switch op{
case .Operand(let operand):
return (operand, remainingOps)
case .Variable(let variable):
print(variable)
if let variableValue = variableValues[variable]{
return (variableValue, remainingOps)
}
case .UnaryOperation(_,let operation):
let operandEvaluation = evaluate(remainingOps)
if let operand = operandEvaluation.result{
return(operation(operand), operandEvaluation.remainingOps)
}
case .BinaryOperation(_, let operation):
let op1Evaluation = evaluate(remainingOps)
if let operand1 = op1Evaluation.result{
let op2Evaluation = evaluate(op1Evaluation.remainingOps)
if let operand2 = op2Evaluation.result{
return (operation(operand1, operand2), op2Evaluation.remainingOps)
}
}
}
}
return (nil, ops)
}
private func brainContentHelper(ops: [Op]) -> (result: String?, remainingOps:[Op]){
if !ops.isEmpty{
var remainingOps = ops
let op = remainingOps.removeLast()
switch op{
case .Operand(let operand):
return("\(operand)", remainingOps)
case .Variable(let variable):
if let val = variableValues[variable]{
return("\(val)", remainingOps)
}else{
return ("M", remainingOps)
}
case .UnaryOperation(let operation, _):
let unaryOperandHelper = brainContentHelper(remainingOps)
if let operand = unaryOperandHelper.result{
return (operation+"(\(operand))", unaryOperandHelper.remainingOps)
}
case .BinaryOperation(let operation, _):
let binaryOperand1 = brainContentHelper(remainingOps)
if let operand1 = binaryOperand1.result{
let binaryOperand2 = brainContentHelper(binaryOperand1.remainingOps)
if let operand2 = binaryOperand2.result{
return("("+operand2 + " " + operation + " " + operand1+")"
, binaryOperand2.remainingOps)
}
}
}
}
return (nil, ops)
}
private var opStack = [Op]()
private var knownOps = [String: Op]();
private var variableValues = [String: Double]()
//public************************************************************************
init(){
func learnOp(op: Op){
knownOps[op.description] = op
}
learnOp(Op.UnaryOperation("π", {$0 * M_PI}))
learnOp(Op.BinaryOperation("×", *))
learnOp(Op.BinaryOperation("÷"){$1 / $0})
learnOp(Op.BinaryOperation("-"){$1 - $0})
learnOp(Op.BinaryOperation("+", +))
learnOp(Op.UnaryOperation("√", sqrt))
learnOp(Op.UnaryOperation("sin", sin))
learnOp(Op.UnaryOperation("cos", cos))
}
var brainContents: String?{
get{
if let result = brainContentHelper(opStack).result{
return result
}
return nil
}
}
func pushOperand(operand:Double) ->Double?{
opStack.append(Op.Operand(operand))
return evaluate()
}
func pushOperand(operand:String)->Double?{
opStack.append(Op.Variable(operand))
return evaluate()
}
func performOperation(symbol: String)->Double?{
//knownOps[symbol]
//whenever you look up something in a dictionary it comes back as
//an optional
if let operation = knownOps[symbol]{
opStack.append(operation)
}
return evaluate()
}
func setVar(value: Double)->Double?{
variableValues["M"] = value
return evaluate()
}
func evaluate() ->Double?{
let (result, remainder) = evaluate(opStack)
print("\(opStack) = \(result) with \(remainder) left over")
return result
}
func clearVariables(){
variableValues = [String: Double]()
}
}
| [
-1
] |
3e15269f37903ddb7f5550bb6968b2cf7eea1691 | f41994fbe5cd666e803d056290b2241d90330dab | /MasterDetailTests/MasterDetailTests.swift | 7c8dab1060e40a59f301ef770e551b2a6dac7b0f | [] | no_license | uniquecourage/MasterDetail | 9743a04bd69cbae25ca44b364ed645c7a63e2868 | be30233e0d1a7d78247dda78a006026ccf173ae0 | refs/heads/master | 2019-01-02T03:17:01.824184 | 2015-09-01T03:46:01 | 2015-09-01T03:46:01 | 41,715,369 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 915 | swift | //
// MasterDetailTests.swift
// MasterDetailTests
//
// Created by 林金龍 on 2015/9/1.
// Copyright (c) 2015年 林金龍. All rights reserved.
//
import UIKit
import XCTest
class MasterDetailTests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// This is an example of a functional test case.
XCTAssert(true, "Pass")
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measureBlock() {
// Put the code you want to measure the time of here.
}
}
}
| [
276481,
276484,
276489,
276492,
305179,
276509,
278558,
307231,
313375,
102437,
227370,
360491,
276534,
159807,
276543,
286788,
280649,
223316,
315476,
223318,
288857,
227417,
194653,
194656,
309345,
227428,
276581,
276582,
43109,
276585,
276589,
278638,
227439,
276592,
131189,
227446,
223350,
276606,
292992,
276613,
141450,
215178,
311435,
311438,
276627,
276631,
276632,
184475,
227492,
196773,
227495,
129203,
299187,
131256,
280762,
223419,
176314,
299198,
309444,
227528,
276682,
276684,
278742,
278746,
155867,
280802,
276709,
276710,
276715,
233715,
157944,
211193,
227576,
168188,
276737,
276744,
276753,
129301,
309529,
278810,
299293,
282919,
262450,
276787,
315706,
278846,
311621,
280902,
278856,
227658,
276813,
278862,
278863,
6481,
6482,
276821,
276822,
6489,
323935,
276831,
276835,
321894,
276839,
416104,
276847,
285040,
278898,
278908,
280961,
178571,
227725,
178578,
190871,
293274,
61857,
61859,
276900,
278951,
278961,
278965,
293303,
276920,
278969,
33211,
276925,
278978,
278985,
278993,
279002,
287198,
276958,
227809,
358882,
276962,
276963,
227813,
279013,
279019,
279022,
281072,
279039,
276998,
287241,
279050,
186893,
279054,
303631,
223767,
223769,
291358,
277029,
293419,
281138,
277048,
301634,
369220,
277066,
277083,
295519,
66150,
277094,
189036,
189037,
277101,
287346,
189043,
189042,
277111,
279164,
277118,
291454,
184962,
303746,
152203,
277133,
133774,
277138,
225943,
230040,
225944,
164512,
225956,
285353,
225962,
209581,
205487,
285361,
303793,
299699,
293556,
342706,
154294,
285371,
199366,
225997,
226001,
277204,
226004,
203477,
279252,
226007,
119513,
201442,
226019,
285415,
342762,
277227,
226033,
226035,
226036,
230134,
234234,
226043,
279294,
234238,
234241,
226051,
234245,
277254,
209670,
203529,
226058,
234250,
234253,
234256,
234263,
369432,
234268,
105246,
228129,
234277,
279336,
289576,
277289,
234283,
234280,
277294,
234286,
226097,
234289,
234294,
230199,
162621,
234301,
289598,
281408,
293693,
162626,
234304,
277316,
234305,
234311,
234312,
299849,
234317,
277325,
277327,
293711,
234323,
234326,
277339,
234331,
297822,
301918,
279392,
297826,
349026,
234340,
174949,
234343,
234346,
277354,
277360,
234355,
213876,
277366,
234360,
279417,
277370,
209785,
177019,
234361,
234366,
234367,
226170,
158593,
234372,
226181,
213894,
113542,
226184,
277381,
228234,
234377,
226189,
234381,
295824,
226194,
234386,
234387,
234392,
324507,
234395,
234400,
279456,
234404,
226214,
289703,
234409,
275371,
236461,
226223,
234419,
226227,
234425,
277435,
234427,
287677,
234430,
234436,
275397,
234438,
52172,
234444,
234445,
183248,
234450,
234451,
234454,
234457,
234463,
234466,
277479,
277480,
234472,
234473,
234477,
234482,
287731,
277492,
314355,
234492,
234495,
277505,
234498,
234500,
277509,
277510,
234503,
277513,
230410,
234506,
234509,
275469,
197647,
295953,
277523,
234517,
230423,
197657,
281625,
281626,
175132,
234530,
234531,
234534,
234539,
310317,
277550,
234542,
275505,
234548,
234555,
238651,
277563,
277566,
230463,
234560,
207938,
281666,
234565,
277574,
234569,
277579,
300111,
207953,
277585,
296018,
234577,
296019,
234583,
234584,
234594,
230499,
281700,
277603,
300135,
234603,
275565,
156785,
312434,
275571,
300151,
234616,
398457,
234622,
300158,
275585,
285828,
302213,
275590,
275591,
253063,
234632,
277640,
302217,
234642,
226451,
226452,
308372,
119963,
234652,
234656,
330913,
306338,
234659,
277665,
234663,
275625,
300201,
208043,
275628,
238769,
226481,
277686,
277690,
208058,
230588,
277694,
283840,
279747,
279760,
290000,
189652,
203989,
275671,
363744,
195811,
298212,
304356,
285929,
279792,
298228,
204022,
234742,
228600,
120055,
208124,
204041,
292107,
277792,
339234,
199971,
259363,
304421,
277800,
113962,
277806,
113966,
226608,
277809,
277814,
277815,
300343,
277821,
226624,
277824,
277825,
15686,
226632,
294218,
177484,
142669,
222541,
277838,
296273,
277841,
222548,
277845,
314709,
283991,
357719,
277852,
218462,
224606,
277856,
142689,
230756,
277862,
163175,
281962,
173420,
277868,
284014,
277871,
279919,
277878,
275831,
181625,
277882,
277883,
142716,
275839,
277890,
277891,
226694,
277896,
281992,
277897,
277900,
230799,
112017,
296338,
306579,
206228,
277907,
226711,
226712,
277911,
277919,
277920,
310692,
277925,
279974,
277927,
282024,
370091,
277936,
277939,
277940,
279989,
296375,
277943,
277946,
277949,
277952,
296387,
415171,
163269,
277957,
296391,
300487,
277962,
277965,
280013,
312782,
284116,
277974,
277977,
277980,
226781,
277983,
277988,
310757,
316902,
277993,
296425,
278002,
278005,
306677,
278008,
300542,
306693,
278023,
175625,
192010,
280077,
149007,
65041,
282136,
204313,
278060,
286254,
226875,
194110,
128583,
226888,
276040,
366154,
276045,
276046,
286288,
226897,
276050,
280147,
300630,
226906,
147036,
243292,
370271,
282213,
317032,
222832,
276085,
276088,
278140,
188031,
192131,
276100,
276101,
229001,
310923,
312972,
282259,
276116,
276120,
280220,
276126,
282273,
276129,
282276,
278191,
276146,
198324,
286388,
296628,
278201,
276156,
276165,
278214,
276172,
276173,
302797,
212688,
302802,
276180,
286423,
216795,
276195,
153319,
313065,
280300,
419569,
276210,
276219,
194303,
288512,
311042,
288516,
278285,
276238,
184086,
294678,
284442,
278299,
276253,
278307,
288547,
278316,
159533,
276279,
276282,
276283,
288574,
276287,
345919,
276294,
282438,
276298,
216918,
307031,
188246,
276318,
237408,
276325,
282474,
288619,
276332,
173936,
276344,
194429,
276350,
227199,
40850,
40853,
44952,
247712,
276385,
294823,
276394,
276400,
276408,
290746,
276421,
276430,
231375,
153554,
276444,
280541,
276450,
276451,
276454,
276459,
296941,
276462,
276463,
276468,
276469,
276475,
276478
] |
5c5acfc8e3e2bacf903404b243bbb4d60cdb0605 | dc0c59bfce8141e2116fc518c95afaee6d1f94b5 | /Push-Up-My-Soul/ViewController1.swift | de1ee0a0689376dda86a866e2657fccbf5610ab5 | [] | no_license | taichi-kato-00/Push-Up-My-Soul | 381729eb24088c5fba33a96ad6581ad9b65b922c | 0635359f1ceafa2e2c18b6d01ec5a8a5ae93eba0 | refs/heads/master | 2022-12-28T01:06:31.045159 | 2020-09-27T04:38:40 | 2020-09-27T04:38:40 | 298,954,524 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,740 | swift | //
// ViewController1.swift
// Push-Up-My-Soul
//
// Created by 加藤太一 on 2020/09/25.
// Copyright © 2020 taichi. All rights reserved.
//
import UIKit
import AVFoundation
class ViewController1: UIViewController {
// 音
var resultAudioPlayer: AVAudioPlayer = AVAudioPlayer()
// 音の処理
func setupSound() {
if let sound = Bundle.main.path(forResource: "Gunshot01-1", ofType: ".mp3") {
resultAudioPlayer = try! AVAudioPlayer(contentsOf: URL(fileURLWithPath: sound))
resultAudioPlayer.prepareToPlay()
}
}
// カウントの配列
var count :Int = 0
// 日付の配列
@IBOutlet weak var countLabel: UILabel!
//カウントの配列を作成しておく。
var arrayBox = [String]()
// dateを配列へ格納
var appendDate:[String] = []
@IBAction func countButton(_ sender: Any) {
self.resultAudioPlayer.play()
// 1ずつ増える
count = count + 1
countLabel.text = String(count)
}
/// 日付のインスタンス
let dateFormatter = DateFormatter()
// saveボタンの処理
@IBAction func saveButton(_ sender: Any) {
//countLabelの数字をarrayBoxに入れる。
arrayBox.append(String(count))
/// カレンダー、ロケール、タイムゾーンの設定(未指定時は端末の設定が採用される)
dateFormatter.calendar = Calendar(identifier: .gregorian)
dateFormatter.locale = Locale(identifier: "ja_JP")
dateFormatter.timeZone = TimeZone(identifier: "Asia/Tokyo")
/// 変換フォーマット定義(未設定の場合は自動フォーマットが採用される)
dateFormatter.dateFormat = "yyyy年M月d日(EEEEE) H時m分"
/// データ変換(Date→テキスト)
let dateString = dateFormatter.string(from: Date())
appendDate.append(dateString)
// print(appendDate)
// ユーザーデフォルトに保存する
UserDefaults.standard.set(appendDate, forKey: "date")
//arrayというキー名でarrayBoxをアプリに保存する。
UserDefaults.standard.set(arrayBox, forKey: "array")
}
// リセットボタンの処理
@IBAction func resetButton(_ sender: Any) {
count = 0
self.countLabel.text = "0"
}
override func viewDidLoad() {
super.viewDidLoad()
//次の1行を追加 -> 結果表示のときに音を再生(Play)する!
setupSound()
}
}
| [
-1
] |
70145e90c97c5ea482452e6111220384a217c277 | 57f17a648f1d59941f326290ac58b4fc210f8717 | /Stormy/Stormy/DarkSkyError.swift | 3ac518e6760174dc2e5315e029844136dc856071 | [] | no_license | aananya27/weatherApp | 93412a7b2fda1a2d47a7c85e5d9257225d88ab00 | 92aef2451a588c1b2d02934ba9c20b86ae0f64e9 | refs/heads/master | 2020-03-18T17:09:19.426252 | 2018-05-27T04:03:20 | 2018-05-27T04:03:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 331 | swift | //
// DarkSkyError.swift
// Stormy
//
// Created by Aananya on 27/05/18.
// Copyright © 2017 Aananya. All rights reserved.
//
import Foundation
enum DarkSkyError: Error{
case requestFailed
case responseUnsuccessful
case invalidData
case jsonConversionFailure
case invalidURL
case jsonParsingFailure
}
| [
-1
] |
5a3504009b9f16f273923cef0116330085984696 | 5a1be70a6042d573f4ffbb66ac6e6643a215bf0e | /Library/HeaderView.swift | 3631f35f259e6e40726dff254c56c43776ae6acf | [
"MIT"
] | permissive | mronus/Viewer | 9014589fe28887401ac8cbffede0c49724c19ec8 | f66807bea29ac8deca53d2af4b2ef862e7d9c25f | refs/heads/master | 2020-08-07T21:46:06.111684 | 2019-10-08T14:02:25 | 2019-10-08T14:02:25 | 213,595,599 | 0 | 2 | NOASSERTION | 2019-10-08T14:02:26 | 2019-10-08T09:00:36 | null | UTF-8 | Swift | false | false | 1,969 | swift | import UIKit
protocol HeaderViewDelegate: class {
func headerView(_ headerView: HeaderView, didPressClearButton button: UIButton)
func headerView(_ headerView: HeaderView, didPressMenuButton button: UIButton)
}
class HeaderView: UIView {
weak var viewDelegate: HeaderViewDelegate?
static let ButtonSize = CGFloat(50.0)
static let TopMargin = CGFloat(15.0)
lazy var clearButton: UIButton = {
let image = UIImage.close
let button = UIButton(type: .custom)
button.setImage(image, for: .normal)
button.addTarget(self, action: #selector(HeaderView.clearAction(button:)), for: .touchUpInside)
return button
}()
lazy var menuButton: UIButton = {
let image = UIImage(named: "menu", in: Bundle(for: type(of: self)), compatibleWith: nil)!
let button = UIButton(type: .custom)
button.setImage(image, for: .normal)
button.addTarget(self, action: #selector(HeaderView.menuAction(button:)), for: .touchUpInside)
return button
}()
override init(frame: CGRect) {
super.init(frame: frame)
self.addSubview(self.clearButton)
self.addSubview(self.menuButton)
}
required init?(coder _: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func layoutSubviews() {
super.layoutSubviews()
self.clearButton.frame = CGRect(x: 0, y: HeaderView.TopMargin, width: HeaderView.ButtonSize, height: HeaderView.ButtonSize)
let x = UIScreen.main.bounds.size.width - HeaderView.ButtonSize
self.menuButton.frame = CGRect(x: x, y: HeaderView.TopMargin, width: HeaderView.ButtonSize, height: HeaderView.ButtonSize)
}
@objc func clearAction(button: UIButton) {
self.viewDelegate?.headerView(self, didPressClearButton: button)
}
@objc func menuAction(button: UIButton) {
self.viewDelegate?.headerView(self, didPressMenuButton: button)
}
}
| [
-1
] |
a496cbd18b64c26e53e4e86312a60d2ad99012a0 | 03edd394a4af8ea28900c7f55f5545c96f58dc77 | /TelegramChartApp/Extensions/UIColor+Hex.swift | 820020f3f66c5709b78d7290124ff0fcae707cee | [
"MIT"
] | permissive | t0a0/TelegramChartApp | 70527fcaae27daf0a76a154accc5a2d70788ce98 | f6600ccb80c91227d47bdff89c61a95d4463bbae | refs/heads/master | 2020-04-27T22:11:58.296178 | 2019-04-27T22:09:24 | 2019-04-27T22:09:24 | 174,726,892 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 794 | swift | //
// UIColor+Hex.swift
// TelegramChartApp
//
// Created by Igor on 10/03/2019.
// Copyright © 2019 Fedotov Igor. All rights reserved.
//
import Foundation
import UIKit
extension UIColor {
convenience init?(hex: String, a: CGFloat = 1.0) {
var cString:String = hex.trimmingCharacters(in: .whitespacesAndNewlines).uppercased()
if (cString.hasPrefix("#")) {
cString.remove(at: cString.startIndex)
}
if ((cString.count) != 6) {
return nil
}
var rgbValue:UInt32 = 0
Scanner(string: cString).scanHexInt32(&rgbValue)
self.init(
red: CGFloat((rgbValue & 0xFF0000) >> 16) / 255.0,
green: CGFloat((rgbValue & 0x00FF00) >> 8) / 255.0,
blue: CGFloat(rgbValue & 0x0000FF) / 255.0,
alpha: a
)
}
}
| [
193965
] |
e3371233c67f51887722886d83b056dd81b2d59e | f8e961a08ea58db65c25d26b5b8ab194cc9c1823 | /EcoSoapBank/Model/Property.swift | 5dc29266cf04f4c9bcd43c9a58bf75d7389ab0d2 | [
"MIT"
] | permissive | DeVitoC/Labs25-Ecosoap-TeamA-IOS | c59175be70fd3ea07be141f4085a98c608e1361d | 1e091e666ea72b7371ee9b85eb57cd579e1d3b79 | refs/heads/master | 2023-03-23T19:56:22.902490 | 2021-03-15T17:28:00 | 2021-03-15T17:28:00 | 340,436,957 | 0 | 0 | MIT | 2021-03-15T17:28:00 | 2021-02-19T17:08:57 | null | UTF-8 | Swift | false | false | 4,032 | swift | //
// Property.swift
// EcoSoapBank
//
// Created by Jon Bash on 8/7/20.
// Copyright © 2020 Spencer Curtis. All rights reserved.
//
import Foundation
import Combine
struct Property: Codable, Equatable, Identifiable, Hashable {
let id: String
let name: String
let propertyType: PropertyType
let rooms: Int
let services: [HospitalityService]
let collectionType: Pickup.CollectionType
let logo: String?
let phone: String?
let billingAddress: Address?
let shippingAddress: Address?
let shippingNote: String?
let notes: String?
enum PropertyType: String, Codable, CaseIterable, Identifiable, Hashable {
case bedAndBreakfast = "BED_AND_BREAKFAST"
case guesthouse = "GUESTHOUSE"
case hotel = "HOTEL"
case other = "OTHER"
var id: String { rawValue }
var display: String {
if case .bedAndBreakfast = self {
return "Bed & Breakfast"
} else {
return rawValue.capitalized
}
}
}
enum BillingMethod: String, Codable, CaseIterable {
case ach = "ACH"
case credit = "CREDIT"
case debit = "DEBIT"
case invoice = "INVOICE"
}
}
// MARK: - Property Selection
enum PropertySelection: Hashable {
case all
case select(Property)
var property: Property? {
if case .select(let property) = self {
return property
}
return nil
}
var display: String { property?.name ?? "All" }
init(_ property: Property?) {
if let prop = property {
self = .select(prop)
} else {
self = .all
}
}
}
extension UserDefaults {
@UserDefault(Key("selectedPropertyIDsByUser")) static var selectedPropertyIDsByUser: [String: String]?
private static let propertySelectionByUserID = PassthroughSubject<[String: PropertySelection], Never>()
func propertySelection(forUser user: User) -> PropertySelection {
PropertySelection(selectedProperty(forUser: user))
}
// Subscribe to observe the selected property via Combine
func selectedPropertyPublisher(forUser user: User) -> AnyPublisher<PropertySelection, Never> {
UserDefaults.propertySelectionByUserID
.compactMap({ propertySelectionByUserID -> PropertySelection? in
if let propertySelection = propertySelectionByUserID[user.id] {
return propertySelection
} else { return nil }
}).eraseToAnyPublisher()
}
// Get selected property from user defaults
func selectedProperty(forUser user: User) -> Property? {
guard
let propertyIDsByUserID = Self.selectedPropertyIDsByUser,
let propertyID = propertyIDsByUserID[user.id]
else { return nil }
return user.properties?.first(where: { $0.id == propertyID })
}
// Set selected property to user defaults
func setSelectedProperty(_ property: Property?, forUser user: User) {
if Self.selectedPropertyIDsByUser == nil {
Self.selectedPropertyIDsByUser = [:] // add user default if not there
}
Self.selectedPropertyIDsByUser?[user.id] = property?.id
UserDefaults.propertySelectionByUserID.send([user.id: PropertySelection(property)])
}
}
// MARK: - Editable Property Info
struct EditablePropertyInfo: Encodable, Equatable {
let id: String?
var name: String
var propertyType: Property.PropertyType
var billingAddress: EditableAddressInfo
var shippingAddress: EditableAddressInfo
var phone: String
init(_ property: Property?) {
self.id = property?.id
self.name = property?.name ?? ""
self.propertyType = property?.propertyType ?? .hotel
self.billingAddress = EditableAddressInfo(property?.billingAddress)
self.shippingAddress = EditableAddressInfo(property?.shippingAddress)
self.phone = property?.phone ?? ""
}
}
| [
-1
] |
1934f396725d0d2c68fcbdb3044c4f54876fb247 | aea4d293708f022ca0f0589e4f3215e7f0ebc65d | /SwiftUiLogin in/SwiftUiLogin in/SceneDelegate.swift | 9a966d1043b31329456b867c2db79e28e29eaff3 | [] | no_license | well-59/SwiftPractic | 58db27f2d38bd5eb147b82cda9acc6e3e765633a | d61fd0f765090b0c9503b97955b17c6d9372cd8e | refs/heads/main | 2023-07-14T21:21:58.107359 | 2021-08-17T13:55:17 | 2021-08-17T13:55:17 | 377,101,201 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,270 | swift | //
// SceneDelegate.swift
// SwiftUiLogin in
//
// Created by 黃士豪 on 2021/8/1.
//
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 necessarily discarded (see `application:didDiscardSceneSessions` instead).
}
func sceneDidBecomeActive(_ scene: UIScene) {
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
}
func sceneWillResignActive(_ scene: UIScene) {
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).
}
func sceneWillEnterForeground(_ scene: UIScene) {
// Called as the scene transitions from the background to the foreground.
// Use this method to undo the changes made on entering the background.
}
func sceneDidEnterBackground(_ scene: UIScene) {
// Called as the scene transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
// Save changes in the application's managed object context when the application transitions to the background.
(UIApplication.shared.delegate as? AppDelegate)?.saveContext()
}
}
| [
372739,
393221,
350214,
219144,
354314,
268299,
393228,
393231,
350225,
186388,
350241,
374819,
393251,
350245,
344103,
350249,
350252,
393260,
393269,
213049,
385082,
16444,
337980,
393277,
350272,
436290,
254020,
217158,
350281,
376906,
337995,
421961,
378956,
254032,
436307,
286804,
356440,
368728,
254045,
368736,
342113,
376932,
430181,
100454,
286833,
356467,
374904,
329853,
266365,
192640,
262284,
381069,
225425,
225430,
360598,
356507,
411806,
225439,
286880,
346273,
225442,
438434,
333989,
225445,
362661,
225448,
286889,
356521,
438441,
225451,
377003,
377013,
225462,
379067,
225468,
164029,
387261,
389309,
225472,
372931,
225476,
377030,
389322,
225485,
377037,
225488,
225491,
225494,
377047,
411862,
225497,
411865,
385243,
225500,
225503,
225506,
411874,
356580,
350436,
379108,
411877,
395496,
217319,
225511,
377063,
387303,
225515,
387307,
205037,
225519,
393457,
387314,
358645,
350454,
393461,
381177,
436474,
321787,
336124,
379135,
336129,
385281,
411905,
397572,
262405,
325895,
268553,
194829,
43279,
262417,
368913,
379154,
387350,
262423,
432406,
387353,
356631,
325915,
381212,
325918,
182559,
356638,
356641,
377121,
356644,
262437,
194854,
356647,
389417,
356650,
254253,
391469,
356656,
307507,
262455,
397623,
358714,
358717,
225599,
362823,
348489,
262473,
151884,
190797,
344404,
430422,
362844,
258399,
262497,
379234,
383331,
418145,
262501,
383334,
213354,
391531,
262508,
383342,
262512,
213374,
356734,
389503,
438657,
389507,
356741,
385420,
393613,
420237,
366991,
379279,
348566,
262553,
373146,
340380,
373149,
250272,
176545,
385444,
262567,
354728,
385452,
262574,
393649,
375220,
342453,
385460,
338363,
262587,
336326,
393671,
201158,
358857,
272849,
338387,
360917,
195041,
334306,
182755,
162289,
328178,
127473,
217590,
199165,
416255,
254463,
98819,
350724,
164362,
199182,
350740,
199189,
393748,
334359,
262679,
420377,
334364,
377372,
188959,
385571,
416294,
377384,
33322,
350762,
356908,
381483,
252463,
334386,
358962,
356917,
352822,
197178,
418364,
358973,
348734,
152128,
252483,
356935,
369224,
348745,
381513,
385610,
352844,
385617,
199250,
244309,
399957,
389724,
373344,
346722,
262761,
381546,
352875,
346736,
191093,
346743,
352888,
377473,
336517,
344710,
385671,
119432,
213642,
346769,
326291,
184983,
352919,
373399,
260767,
150184,
344745,
361130,
434868,
342711,
336568,
381626,
164539,
350207,
260798,
363198,
260802,
350918,
344777,
385743,
273109,
385749,
264919,
391895,
416476,
183006,
139998,
338661,
369382,
338665,
361196,
113389,
264942,
330479,
203508,
363252,
375541,
418555,
348926,
391938,
207620,
344837,
191240,
346891,
344843,
391949,
361231,
375569,
394002,
375572,
418581,
375575,
418586,
434971,
369436,
375580,
363294,
418591,
369439,
162592,
418594,
389927,
418600,
336681,
418606,
328498,
271154,
326452,
383794,
348979,
326455,
340792,
348983,
355123,
369464,
361274,
375613,
398141,
326463,
326468,
355141,
127815,
355144,
361289,
326474,
326479,
355151,
357202,
389971,
326486,
213848,
357208,
387929,
342875,
357212,
197469,
326494,
254813,
355167,
357215,
361307,
361310,
389979,
430940,
439138,
326503,
361318,
355176,
433001,
361323,
201580,
326508,
355180,
201583,
400238,
349041,
330612,
201589,
361335,
211832,
430967,
398202,
119675,
392061,
351105,
252801,
260993,
373635,
400260,
211846,
381834,
361361,
330643,
342931,
430996,
400279,
392092,
400286,
422817,
252838,
359335,
373672,
252846,
222129,
111539,
400307,
412600,
351169,
359362,
170950,
359367,
379849,
347082,
340940,
345036,
209874,
386004,
359383,
359389,
431073,
398307,
437219,
209896,
338928,
201712,
209904,
257009,
435188,
261109,
261112,
201724,
431100,
383999,
431107,
418822,
261130,
361490,
386070,
261148,
359452,
250915,
357411,
261155,
261160,
396329,
347178,
357419,
404526,
359471,
361525,
386102,
388155,
209980,
375868,
361537,
347208,
377931,
209996,
431180,
345172,
189525,
349268,
156762,
210011,
343132,
373853,
402523,
412765,
361568,
257121,
322660,
148580,
384102,
210026,
367724,
384108,
326767,
210032,
349296,
343155,
330869,
210037,
248952,
386168,
420985,
212095,
349313,
330886,
214150,
351366,
210056,
345224,
386187,
384144,
259217,
210068,
345247,
44199,
351399,
380071,
361645,
337072,
367795,
337076,
402615,
367801,
361657,
210108,
351424,
337093,
244934,
367817,
322763,
253132,
402636,
333010,
210132,
351450,
165086,
66783,
210144,
388320,
363757,
386286,
251123,
218355,
386292,
218361,
351483,
388348,
275713,
115973,
275717,
343307,
261391,
175376,
359695,
253202,
349460,
251161,
345377,
253218,
345380,
175397,
353572,
208167,
345383,
384299,
273709,
349486,
372016,
437553,
347442,
175416,
396601,
378170,
369979,
415034,
386366,
437567,
175425,
372035,
437571,
384324,
337224,
212296,
437576,
251211,
212304,
331089,
437584,
437588,
210261,
331094,
365912,
396634,
175451,
437596,
367966,
259423,
429408,
374113,
365922,
353634,
374118,
343399,
345449,
333164,
367981,
271731,
390518,
175484,
175487,
271746,
175491,
181639,
155021,
384398,
136591,
374161,
349591,
230810,
175517,
396706,
175523,
155045,
40358,
114093,
181682,
396723,
210357,
343478,
370105,
359867,
259516,
388543,
415168,
380353,
339401,
380364,
327118,
359887,
372177,
208338,
359891,
415187,
249303,
413143,
155103,
271841,
366057,
343535,
366064,
249329,
116211,
368120,
343545,
69114,
402943,
423424,
409092,
253445,
372229,
359948,
419341,
208399,
359951,
419345,
419351,
405017,
245275,
419357,
345631,
370208,
134689,
419360,
394787,
419363,
370214,
382503,
349739,
144940,
339504,
359984,
419377,
343610,
419386,
206397,
349762,
214594,
413251,
339524,
419401,
333387,
353868,
400977,
419412,
224854,
374359,
400982,
224858,
366173,
403040,
343650,
345702,
224871,
423529,
423533,
333423,
257647,
372338,
210547,
339572,
155255,
370298,
415354,
353920,
403073,
403076,
421509,
267910,
224905,
155274,
198282,
345737,
403085,
345750,
403321,
126618,
140955,
419484,
345758,
333472,
368289,
245415,
257705,
419498,
419502,
370351,
257713,
419507,
425652,
224949,
257717,
419510,
257721,
224954,
325309,
257725,
425663,
155328,
337601,
403139,
257733,
224966,
333512,
419528,
224970,
333515,
419531,
257740,
259789,
339664,
224976,
257745,
272083,
257748,
155352,
257752,
419545,
345819,
155356,
366301,
419548,
153311,
419551,
257762,
155364,
345829,
366308,
419560,
155372,
419564,
399086,
366319,
339696,
370416,
210673,
366322,
212723,
431852,
366326,
245495,
409336,
141052,
257788,
257791,
155394,
257796,
362249,
257802,
155404,
210700,
395022,
257805,
225039,
257808,
362252,
362256,
210707,
225044,
167701,
372500,
257815,
333593,
399129,
257820,
155423,
116512,
210720,
257825,
360224,
362274,
378664,
257837,
413485,
155439,
204592,
366384,
257843,
155444,
210740,
225077,
257846,
155448,
225080,
358201,
354107,
345916,
339773,
257853,
384829,
397113,
354112,
247618,
397116,
366403,
225094,
155463,
360262,
225097,
341835,
323404,
345932,
257869,
370510,
341839,
257872,
225105,
339795,
354132,
155477,
225109,
415574,
370520,
225113,
376665,
341852,
155484,
257884,
261982,
425823,
257887,
155488,
225120,
350046,
257891,
155492,
354143,
376672,
399200,
225128,
257897,
261997,
376686,
345965,
358256,
354157,
268144,
339827,
345968,
225138,
262003,
425846,
345971,
257909,
225142,
262006,
345975,
262009,
257914,
372598,
243584,
262012,
155517,
333699,
225150,
257922,
155523,
225156,
380803,
155526,
257927,
376715,
155532,
262028,
399244,
262031,
262034,
337814,
380823,
225176,
329625,
262040,
262043,
155550,
253854,
262046,
262049,
155560,
155563,
382891,
155566,
362414,
333767,
350153,
346059,
311244,
212945,
393170,
155604,
346069,
399318,
372698,
372704,
419810,
354275,
155620,
253924,
155622,
253927,
190440,
372707,
356336,
350194,
393204,
360439,
253944,
393209,
393215,
350204,
155647
] |
827469a5bf730aff81aa8262387516fbe23d6dc5 | a11fb03fc495e5dce3cff1382a330ecb4d74fdbf | /CodeTestWeather/CodeTestWeatherTests/CodeTestWeatherTests.swift | 0643d74d63c4aabcf6401ecdc074e0ed39e5efb5 | [] | no_license | rickychauhk/CodeTestWeather | 9c47c6f8779b0253e63f42d649b3db31338ca2f1 | 05e7360c420d47d05423a52fb1664f3da04b5001 | refs/heads/main | 2023-06-19T12:53:41.243658 | 2021-07-19T09:39:02 | 2021-07-19T09:39:02 | 385,571,932 | 0 | 0 | null | 2021-07-19T08:58:45 | 2021-07-13T10:57:37 | Swift | UTF-8 | Swift | false | false | 1,792 | swift | //
// CodeTestWeatherTests.swift
// CodeTestWeatherTests
//
// Created by Ricky on 17/7/2021.
//
import XCTest
@testable import CodeTestWeather
class CodeTestWeatherTests: XCTestCase {
var viewModel: Weather!
var weather: [Weather] = []
override func setUp() {
}
override func tearDown() {
viewModel = nil
super.tearDown()
}
func testJSONDecoding() {
// Convert weather.json to Data
let testBundle = Bundle(for: type(of: self))
let path = testBundle.path(forResource: "weather", ofType: "json")
guard let data = try? Data(contentsOf: URL(fileURLWithPath: path!), options: .alwaysMapped) else {
fatalError("Data is nil")
}
let resource = try! JSONDecoder().decode(Weather.self, from: data)
XCTAssertEqual(resource.name, "HongKong")
}
func testResourceDetailViewModel() {
let testBundle = Bundle(for: type(of: self))
let path = testBundle.path(forResource: "weather", ofType: "json")
guard let data = try? Data(contentsOf: URL(fileURLWithPath: path!), options: .alwaysMapped) else {
fatalError("Data is nil")
}
let resource = try! JSONDecoder().decode(Weather.self, from: data)
viewModel = Weather(value: resource)
self.weather.append(resource)
XCTAssertEqual(viewModel.name, "HongKong")
XCTAssertEqual(viewModel.weather[0].weatherDescription, "few clouds")
XCTAssertEqual(viewModel.main?.temp.stringValue , "308.17")
XCTAssertEqual(viewModel.main?.humidity, 5)
XCTAssertEqual(viewModel.weather[0].iconStringURL, "https://openweathermap.org/img/wn/[email protected]")
}
}
| [
-1
] |
ef60b96fea7be47a355d7a0ba1c83fcd3205639d | be0fe0b9bfb93641e470375066de7f23b44393f5 | /submodules/TelegramUI/Sources/ChatSearchResultsContollerNode.swift | 2f791a6e9bb1ed73558e91df688682bf9bd008d1 | [] | no_license | vaverkax/Telegram-iOS | 96bdf954adb25482d9f6253f797525886da40613 | 6a495f84c6bef56b554526218b26795fc0e15488 | refs/heads/master | 2023-03-15T21:49:44.618172 | 2022-12-29T17:00:49 | 2022-12-29T17:00:49 | 585,850,031 | 0 | 0 | null | 2023-01-09T07:34:36 | 2023-01-06T08:45:39 | null | UTF-8 | Swift | false | false | 19,546 | swift | import Foundation
import UIKit
import Display
import AsyncDisplayKit
import SwiftSignalKit
import Postbox
import TelegramCore
import TelegramPresentationData
import TelegramStringFormatting
import MergeLists
import ChatListUI
import AccountContext
import ContextUI
import ChatListSearchItemHeader
import AnimationCache
import MultiAnimationRenderer
private enum ChatListSearchEntryStableId: Hashable {
case messageId(MessageId)
public static func ==(lhs: ChatListSearchEntryStableId, rhs: ChatListSearchEntryStableId) -> Bool {
switch lhs {
case let .messageId(messageId):
if case .messageId(messageId) = rhs {
return true
} else {
return false
}
}
}
}
private enum ChatListSearchEntry: Comparable, Identifiable {
case message(Message, RenderedPeer, CombinedPeerReadState?, ChatListPresentationData)
public var stableId: ChatListSearchEntryStableId {
switch self {
case let .message(message, _, _, _):
return .messageId(message.id)
}
}
public static func ==(lhs: ChatListSearchEntry, rhs: ChatListSearchEntry) -> Bool {
switch lhs {
case let .message(lhsMessage, lhsPeer, lhsCombinedPeerReadState, lhsPresentationData):
if case let .message(rhsMessage, rhsPeer, rhsCombinedPeerReadState, rhsPresentationData) = rhs {
if lhsMessage.id != rhsMessage.id {
return false
}
if lhsMessage.stableVersion != rhsMessage.stableVersion {
return false
}
if lhsPeer != rhsPeer {
return false
}
if lhsPresentationData !== rhsPresentationData {
return false
}
if lhsCombinedPeerReadState != rhsCombinedPeerReadState {
return false
}
return true
} else {
return false
}
}
}
public static func <(lhs: ChatListSearchEntry, rhs: ChatListSearchEntry) -> Bool {
switch lhs {
case let .message(lhsMessage, _, _, _):
if case let .message(rhsMessage, _, _, _) = rhs {
return lhsMessage.index < rhsMessage.index
}
}
return false
}
public func item(context: AccountContext, interaction: ChatListNodeInteraction) -> ListViewItem {
switch self {
case let .message(message, peer, readState, presentationData):
return ChatListItem(
presentationData: presentationData,
context: context,
chatListLocation: .chatList(groupId: .root),
filterData: nil,
index: .chatList(EngineChatList.Item.Index.ChatList(pinningIndex: nil, messageIndex: message.index)),
content: .peer(ChatListItemContent.PeerData(
messages: [EngineMessage(message)],
peer: EngineRenderedPeer(peer),
threadInfo: nil,
combinedReadState: readState.flatMap { EnginePeerReadCounters(state: $0, isMuted: false) },
isRemovedFromTotalUnreadCount: false,
presence: nil,
hasUnseenMentions: false,
hasUnseenReactions: false,
draftState: nil,
inputActivities: nil,
promoInfo: nil,
ignoreUnreadBadge: true,
displayAsMessage: true,
hasFailedMessages: false,
forumTopicData: nil,
topForumTopicItems: [],
autoremoveTimeout: nil
)),
editing: false,
hasActiveRevealControls: false,
selected: false,
header: nil,
enableContextActions: false,
hiddenOffset: false,
interaction: interaction
)
}
}
}
public struct ChatListSearchContainerTransition {
public let deletions: [ListViewDeleteItem]
public let insertions: [ListViewInsertItem]
public let updates: [ListViewUpdateItem]
public init(deletions: [ListViewDeleteItem], insertions: [ListViewInsertItem], updates: [ListViewUpdateItem]) {
self.deletions = deletions
self.insertions = insertions
self.updates = updates
}
}
private func chatListSearchContainerPreparedTransition(from fromEntries: [ChatListSearchEntry], to toEntries: [ChatListSearchEntry], context: AccountContext, interaction: ChatListNodeInteraction) -> ChatListSearchContainerTransition {
let (deleteIndices, indicesAndItems, updateIndices) = mergeListsStableWithUpdates(leftList: fromEntries, rightList: toEntries)
let deletions = deleteIndices.map { ListViewDeleteItem(index: $0, directionHint: nil) }
let insertions = indicesAndItems.map { ListViewInsertItem(index: $0.0, previousIndex: $0.2, item: $0.1.item(context: context, interaction: interaction), directionHint: nil) }
let updates = updateIndices.map { ListViewUpdateItem(index: $0.0, previousIndex: $0.2, item: $0.1.item(context: context, interaction: interaction), directionHint: nil) }
return ChatListSearchContainerTransition(deletions: deletions, insertions: insertions, updates: updates)
}
class ChatSearchResultsControllerNode: ViewControllerTracingNode, UIScrollViewDelegate {
private let context: AccountContext
private var presentationData: PresentationData
private let animationCache: AnimationCache
private let animationRenderer: MultiAnimationRenderer
private let location: SearchMessagesLocation
private let searchQuery: String
private var searchResult: SearchMessagesResult
private var searchState: SearchMessagesState
private var interaction: ChatListNodeInteraction?
private let listNode: ListView
private var enqueuedTransitions: [(ChatListSearchContainerTransition, Bool)] = []
private var validLayout: (ContainerViewLayout, CGFloat)?
var resultsUpdated: ((SearchMessagesResult, SearchMessagesState) -> Void)?
var resultSelected: ((Int) -> Void)?
private let presentationDataPromise: Promise<ChatListPresentationData>
private let disposable = MetaDisposable()
private var isLoadingMore = false
private let loadMoreDisposable = MetaDisposable()
private let previousEntries = Atomic<[ChatListSearchEntry]?>(value: nil)
init(context: AccountContext, location: SearchMessagesLocation, searchQuery: String, searchResult: SearchMessagesResult, searchState: SearchMessagesState, presentInGlobalOverlay: @escaping (ViewController) -> Void) {
self.context = context
self.location = location
self.searchQuery = searchQuery
self.searchResult = searchResult
self.searchState = searchState
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
self.presentationData = presentationData
self.presentationDataPromise = Promise(ChatListPresentationData(theme: self.presentationData.theme, fontSize: self.presentationData.listsFontSize, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, nameSortOrder: self.presentationData.nameSortOrder, nameDisplayOrder: self.presentationData.nameDisplayOrder, disableAnimations: true))
self.animationCache = context.animationCache
self.animationRenderer = context.animationRenderer
self.listNode = ListView()
self.listNode.verticalScrollIndicatorColor = self.presentationData.theme.list.scrollIndicatorColor
self.listNode.accessibilityPageScrolledString = { row, count in
return presentationData.strings.VoiceOver_ScrollStatus(row, count).string
}
super.init()
self.backgroundColor = self.presentationData.theme.chatList.backgroundColor
self.isOpaque = false
self.addSubnode(self.listNode)
let signal = self.presentationDataPromise.get()
|> map { presentationData -> [ChatListSearchEntry] in
var entries: [ChatListSearchEntry] = []
for message in searchResult.messages {
var peer = RenderedPeer(message: message)
if let group = message.peers[message.id.peerId] as? TelegramGroup, let migrationReference = group.migrationReference {
if let channelPeer = message.peers[migrationReference.peerId] {
peer = RenderedPeer(peer: channelPeer)
}
}
entries.append(.message(message, peer, searchResult.readStates[peer.peerId], presentationData))
}
return entries
}
let interaction = ChatListNodeInteraction(context: context, animationCache: self.animationCache, animationRenderer: self.animationRenderer, activateSearch: {
}, peerSelected: { _, _, _, _ in
}, disabledPeerSelected: { _, _ in
}, togglePeerSelected: { _, _ in
}, togglePeersSelection: { _, _ in
}, additionalCategorySelected: { _ in
}, messageSelected: { [weak self] peer, _, message, _ in
if let strongSelf = self {
if let index = strongSelf.searchResult.messages.firstIndex(where: { $0.index == message.index }) {
if message.id.peerId.namespace == Namespaces.Peer.SecretChat {
strongSelf.resultSelected?(index)
} else {
strongSelf.resultSelected?(strongSelf.searchResult.messages.count - index - 1)
}
}
strongSelf.listNode.clearHighlightAnimated(true)
}
}, groupSelected: { _ in
}, addContact: { _ in
}, setPeerIdWithRevealedOptions: { _, _ in
}, setItemPinned: { _, _ in
}, setPeerMuted: { _, _ in
}, setPeerThreadMuted: { _, _, _ in
}, deletePeer: { _, _ in
}, deletePeerThread: { _, _ in
}, setPeerThreadStopped: { _, _, _ in
}, setPeerThreadPinned: { _, _, _ in
}, setPeerThreadHidden: { _, _, _ in
}, updatePeerGrouping: { _, _ in
}, togglePeerMarkedUnread: { _, _ in
}, toggleArchivedFolderHiddenByDefault: {
}, toggleThreadsSelection: { _, _ in
}, hidePsa: { _ in
}, activateChatPreview: { [weak self] item, _, node, gesture, _ in
guard let strongSelf = self else {
gesture?.cancel()
return
}
switch item.content {
case let .peer(peerData):
if let message = peerData.messages.first {
let chatController = strongSelf.context.sharedContext.makeChatController(context: strongSelf.context, chatLocation: .peer(id: peerData.peer.peerId), subject: .message(id: .id(message.id), highlight: true, timecode: nil), botStart: nil, mode: .standard(previewing: true))
chatController.canReadHistory.set(false)
let contextController = ContextController(account: strongSelf.context.account, presentationData: strongSelf.presentationData, source: .controller(ContextControllerContentSourceImpl(controller: chatController, sourceNode: node)), items: .single(ContextController.Items(content: .list([]))), gesture: gesture)
presentInGlobalOverlay(contextController)
} else {
gesture?.cancel()
}
default:
gesture?.cancel()
}
}, present: { _ in
}, openForumThread: { _, _ in
})
interaction.searchTextHighightState = searchQuery
self.interaction = interaction
self.disposable.set((signal
|> deliverOnMainQueue).start(next: { [weak self] entries in
if let strongSelf = self {
let previousEntries = strongSelf.previousEntries.swap(entries)
let firstTime = previousEntries == nil
let transition = chatListSearchContainerPreparedTransition(from: previousEntries ?? [], to: entries, context: context, interaction: interaction)
strongSelf.enqueueTransition(transition, firstTime: firstTime)
}
}))
self.listNode.visibleBottomContentOffsetChanged = { [weak self] offset in
guard let strongSelf = self else {
return
}
guard case let .known(value) = offset, value < 100.0 else {
return
}
if strongSelf.searchResult.completed {
return
}
if strongSelf.isLoadingMore {
return
}
strongSelf.loadMore()
}
}
deinit {
self.disposable.dispose()
self.loadMoreDisposable.dispose()
}
private func loadMore() {
self.isLoadingMore = true
self.loadMoreDisposable.set((self.context.engine.messages.searchMessages(location: self.location, query: self.searchQuery, state: self.searchState)
|> deliverOnMainQueue).start(next: { [weak self] (updatedResult, updatedState) in
guard let strongSelf = self else {
return
}
guard let interaction = strongSelf.interaction else {
return
}
strongSelf.isLoadingMore = false
strongSelf.searchResult = updatedResult
strongSelf.searchState = updatedState
strongSelf.resultsUpdated?(updatedResult, updatedState)
let context = strongSelf.context
let signal = strongSelf.presentationDataPromise.get()
|> map { presentationData -> [ChatListSearchEntry] in
var entries: [ChatListSearchEntry] = []
for message in updatedResult.messages {
var peer = RenderedPeer(message: message)
if let group = message.peers[message.id.peerId] as? TelegramGroup, let migrationReference = group.migrationReference {
if let channelPeer = message.peers[migrationReference.peerId] {
peer = RenderedPeer(peer: channelPeer)
}
}
entries.append(.message(message, peer, nil, presentationData))
}
return entries
}
strongSelf.disposable.set((signal
|> deliverOnMainQueue).start(next: { entries in
if let strongSelf = self {
let previousEntries = strongSelf.previousEntries.swap(entries)
let firstTime = previousEntries == nil
let transition = chatListSearchContainerPreparedTransition(from: previousEntries ?? [], to: entries, context: context, interaction: interaction)
strongSelf.enqueueTransition(transition, firstTime: firstTime)
}
}))
}))
}
func updatePresentationData(_ presentationData: PresentationData) {
self.presentationData = presentationData
self.presentationDataPromise.set(.single(ChatListPresentationData(theme: self.presentationData.theme, fontSize: self.presentationData.listsFontSize, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, nameSortOrder: self.presentationData.nameSortOrder, nameDisplayOrder: self.presentationData.nameDisplayOrder, disableAnimations: true)))
self.listNode.forEachItemHeaderNode({ itemHeaderNode in
if let itemHeaderNode = itemHeaderNode as? ChatListSearchItemHeaderNode {
itemHeaderNode.updateTheme(theme: presentationData.theme)
}
})
}
private func enqueueTransition(_ transition: ChatListSearchContainerTransition, firstTime: Bool) {
self.enqueuedTransitions.append((transition, firstTime))
if self.validLayout != nil {
while !self.enqueuedTransitions.isEmpty {
self.dequeueTransition()
}
}
}
private func dequeueTransition() {
if let (transition, _) = self.enqueuedTransitions.first {
self.enqueuedTransitions.remove(at: 0)
var options = ListViewDeleteAndInsertOptions()
options.insert(.PreferSynchronousDrawing)
options.insert(.PreferSynchronousResourceLoading)
self.listNode.transaction(deleteIndices: transition.deletions, insertIndicesAndItems: transition.insertions, updateIndicesAndItems: transition.updates, options: options, updateSizeAndInsets: nil, updateOpaqueState: nil, completion: { _ in
})
}
}
func containerLayoutUpdated(_ layout: ContainerViewLayout, navigationBarHeight: CGFloat, transition: ContainedViewLayoutTransition) {
let hadValidLayout = self.validLayout != nil
self.validLayout = (layout, navigationBarHeight)
let (duration, curve) = listViewAnimationDurationAndCurve(transition: transition)
self.listNode.frame = CGRect(origin: CGPoint(), size: layout.size)
self.listNode.transaction(deleteIndices: [], insertIndicesAndItems: [], updateIndicesAndItems: [], options: [.Synchronous], scrollToItem: nil, updateSizeAndInsets: ListViewUpdateSizeAndInsets(size: layout.size, insets: UIEdgeInsets(top: navigationBarHeight, left: layout.safeInsets.left, bottom: layout.insets(options: [.input]).bottom, right: layout.safeInsets.right), duration: duration, curve: curve), stationaryItemRange: nil, updateOpaqueState: nil, completion: { _ in })
if !hadValidLayout {
while !self.enqueuedTransitions.isEmpty {
self.dequeueTransition()
}
}
}
}
private final class ContextControllerContentSourceImpl: ContextControllerContentSource {
let controller: ViewController
weak var sourceNode: ASDisplayNode?
let navigationController: NavigationController? = nil
let passthroughTouches: Bool = true
init(controller: ViewController, sourceNode: ASDisplayNode?) {
self.controller = controller
self.sourceNode = sourceNode
}
func transitionInfo() -> ContextControllerTakeControllerInfo? {
let sourceNode = self.sourceNode
return ContextControllerTakeControllerInfo(contentAreaInScreenSpace: CGRect(origin: CGPoint(), size: CGSize(width: 10.0, height: 10.0)), sourceNode: { [weak sourceNode] in
if let sourceNode = sourceNode {
return (sourceNode.view, sourceNode.bounds)
} else {
return nil
}
})
}
func animatedIn() {
}
}
| [
-1
] |
1770d126643d35b6e9b6bf04ce9a7c4eb83585fe | 7cf38acae6ac12d26dbd092867c72a9b87f46533 | /04 Poredjenje agregatnih fja - Car Inventory/Car Inventory/CoreDataStack.swift | 99e9e5c251c8a2d18e8ff82d0386dd2a60cfe726 | [] | no_license | Vukovi/Core-Data-Projects | 7999b30e90a8cad38d8169fea067cb0ddc3b1c39 | a754f6092696848f3a44161015153dca38f7e634 | refs/heads/master | 2020-05-03T16:36:58.131416 | 2019-04-05T12:36:21 | 2019-04-05T12:36:21 | 178,725,759 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,407 | swift | //
// CoreDataStack.swift
// Home Report
//
//
import Foundation
import CoreData
public class CoreDataStack {
public init() {}
public lazy var persistentContainer: NSPersistentContainer = {
/*
The persistent container for the application. This implementation
creates and returns a container, having loaded the store for the
application to it. This property is optional since there are legitimate
error conditions that could cause the creation of the store to fail.
*/
let container = NSPersistentContainer(name: "Car_Inventory")
container.loadPersistentStores(completionHandler: { (storeDescription, error) in
if let error = error as NSError? {
// Replace this implementation with code to handle the error appropriately.
// fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
/*
Typical reasons for an error here include:
* The parent directory does not exist, cannot be created, or disallows writing.
* The persistent store is not accessible, due to permissions or data protection when the device is locked.
* The device is out of space.
* The store could not be migrated to the current model version.
Check the error message to determine what the actual problem was.
*/
fatalError("Unresolved error \(error), \(error.userInfo)")
}
})
return container
}()
// MARK: - Core Data Saving support
func saveContext () {
let context = persistentContainer.viewContext
if context.hasChanges {
do {
try context.save()
} catch {
// Replace this implementation with code to handle the error appropriately.
// fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
let nserror = error as NSError
fatalError("Unresolved error \(nserror), \(nserror.userInfo)")
}
}
}
}
| [
287328,
358338,
241506,
328612,
288517,
386154,
300779,
175474,
97237,
175479,
110011,
336316
] |
4c4ca36492f08c8c152fc4500a97d3d4ff9765f9 | 01123c8f848dd7dff7d85b7fe3593fb71f418997 | /FinalRetake/PostVC.swift | 909e5d53da6fd7d63635c2a277d1d981517c2711 | [] | no_license | Tristifano/FinalRetake | aba8d178dfd8f176063c69c544ea424defe852e0 | ce45597b30344f767e6161af0cf08262d6516362 | refs/heads/master | 2020-03-21T00:58:37.382674 | 2018-06-19T16:35:00 | 2018-06-19T16:35:00 | 135,770,286 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 6,875 | swift | //
// PostVC.swift
// FinalRetake
//
// Created by MacBook on 6/1/18.
// Copyright © 2018 Macbook. All rights reserved.
//
import UIKit
import FirebaseAuth
import FirebaseDatabase
import FirebaseStorage
class PostVC: UIViewController {
let currentUser = Auth.auth().currentUser
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBOutlet weak var imageView: UIImageView!
@IBOutlet weak var addImageButton: UIButton!
@IBOutlet weak var addTextTextField: UITextView!
@IBAction func addImage(_ sender: UIButton) {
addImageButton.isEnabled = false
addTextTextField.isEditable = false
let picker = UIImagePickerController()
picker.allowsEditing = true
picker.delegate = self
present(picker, animated: true)
}
@IBAction func createPost(_ sender: UIBarButtonItem) {
let dbRef = Database.database().reference()
let storageRef = Storage.storage().reference()
let key = dbRef.child("posts").childByAutoId().key
let uploadImageRef = storageRef.child("images/\(key)")
let currentDateTime = Date()
let formatter = DateFormatter()
formatter.timeStyle = .short
formatter.dateStyle = .short
if addImageButton.isEnabled == false && addTextTextField.text == "" {
let image = imageView.image
guard let email = currentUser?.email else { return }
guard let userId = currentUser?.uid else { return }
let post = ["email" : "\(email)",
"text" : "",
"timestamp" : "\(formatter.string(from: currentDateTime))",
"type" : "image",
"userId" : "\(userId)",
"imageURL" : ""]
let childUpdates = ["/posts/\(key)": post]
dbRef.updateChildValues(childUpdates) { (error, dbRef) in
if let error = error {
print("Error Creating Post: \(error.localizedDescription)")
}
}
guard let data = UIImageJPEGRepresentation(image!, 1.0) else { print("image is nil"); return}
let metadata = StorageMetadata()
metadata.contentType = "image/jpeg"
let uploadTask = uploadImageRef.putData(data, metadata: metadata) { (storageMetadata, error) in
if let error = error {
print("uploadTask error: \(error.localizedDescription)")
} else if let storageMetadata = storageMetadata {
print("storageMetadata: \(storageMetadata)")
}
}
// Listen for state changes, errors, and completion of the upload.
uploadTask.observe(.resume) { snapshot in
// Upload resumed, also fires when the upload starts
}
uploadTask.observe(.pause) { snapshot in
// Upload paused
}
uploadTask.observe(.progress) { snapshot in
// Upload reported progress
let percentProgress = 100.0 * Double(snapshot.progress!.completedUnitCount)
/ Double(snapshot.progress!.totalUnitCount)
print(percentProgress)
}
uploadTask.observe(.success) { snapshot in
// Upload completed successfully
// set post's imageURL
//let imageURL = String(describing: snapshot.metadata!.downloadURL()!)
guard let imageURL = snapshot.metadata?.downloadURLs?.first?.absoluteString else { return }
dbRef.child("posts/\(key)").updateChildValues(["imageURL" : imageURL], withCompletionBlock: { (error, dbRef) in
if let error = error {
print("image url error: \(error.localizedDescription)")
} else {
print("dbRef: \(dbRef)")
}
})
}
} else {
guard let email = currentUser?.email else { return }
guard let text = addTextTextField.text else { return }
guard let userId = currentUser?.uid else { return }
let post = ["email" : "\(email)",
"text" : "\(text)",
"timestamp" : "\(formatter.string(from: currentDateTime))",
"type" : "text",
"userId" : "\(userId)",
"imageURL" : ""]
let childUpdates = ["/posts/\(key)": post]
dbRef.updateChildValues(childUpdates) { (error, dbRef) in
if let error = error {
print("Error Creating Post: \(error.localizedDescription)")
}
}
}
addTextTextField.text = ""
addTextTextField.isEditable = true
addImageButton.isEnabled = true
imageView.image = nil
tabBarController?.selectedIndex = 0
}
}
extension PostVC: UIImagePickerControllerDelegate, UINavigationControllerDelegate {
func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
addImageButton.isEnabled = true
addTextTextField.isEditable = true
dismiss(animated: true)
}
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
var newImage: UIImage
if let possibleImage = info["UIImagePickerControllerEditedImage"] as? UIImage {
newImage = possibleImage
} else if let possibleImage = info["UIImagePickerControllerOriginalImage"] as? UIImage {
newImage = possibleImage
} else {
return
}
imageView.image = newImage
dismiss(animated: true)
}
}
| [
-1
] |
4673dcb4982ccfd114bc4469ee30319a7d7f0901 | 43d69f9c346d32918cb686da40893a7415ea1300 | /Travelling/Travelling/Scenes/Login/LoginWorker.swift | c60cf7d8d3c1b9f2c54c7abf7c621a351c033df7 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | BeeWise/travelling-ios-app | 78d8c0abbf2a1e5d27b37cf54f8b34c299ad593a | 0791a3fe79a4037dbd201eddbe098bb09ea07705 | refs/heads/master | 2023-05-30T18:58:54.026705 | 2020-10-25T13:08:53 | 2020-10-25T13:08:53 | 295,088,627 | 2 | 0 | MIT | 2023-05-15T11:29:17 | 2020-09-13T06:00:32 | Swift | UTF-8 | Swift | false | false | 1,264 | swift | //
// LoginWorker.swift
// Travelling
//
// Created by Dimitri Strauneanu on 04/10/2020.
// Copyright (c) 2020 Travelling. All rights reserved.
//
// This file was generated by the Clean Swift Xcode Templates so
// you can apply clean architecture to your iOS and Mac projects,
// see http://clean-swift.com
//
import UIKit
protocol LoginWorkerDelegate: class {
func successDidLoginUser(user: User)
func failureDidLoginUser(details: LoginModels.LoginDetails, error: OperationError)
}
class LoginWorker {
weak var delegate: LoginWorkerDelegate?
var authenticationTask: AuthenticationTaskProtocol = TaskConfigurator.shared.authenticationTask()
init(delegate: LoginWorkerDelegate?) {
self.delegate = delegate
}
func loginUser(details: LoginModels.LoginDetails) {
self.authenticationTask.loginUser(model: AuthenticationTaskModels.LoginUser.Request(account: details.account, password: details.password)) { result in
switch result {
case .success(let response): self.delegate?.successDidLoginUser(user: response.user); break
case .failure(let error): self.delegate?.failureDidLoginUser(details: details, error: error); break
}
}
}
}
| [
-1
] |
fe8d8bd3d096b2b283839f1cf028b756d8275acd | 4a3cc33f1c3b159fac21e1837690172cbdefc5ca | /Sources/Guise/Common/Resolvable.swift | e260b5acd118cb18aee093fbe3efe62df97985fe | [
"MIT"
] | permissive | Prosumma/Guise | 53a8e16442fbb98054a2d2c6b75d3bc764882d9b | 76bb5442c3ffa1cf2992c49aa5c267ad800502d1 | refs/heads/master | 2022-11-30T18:02:34.402593 | 2022-11-01T16:28:09 | 2022-11-01T16:28:09 | 53,304,703 | 56 | 4 | MIT | 2022-10-03T05:58:34 | 2016-03-07T07:27:47 | Swift | UTF-8 | Swift | false | false | 300 | swift | //
// Resolvable.swift
// Guise
//
// Created by Gregory Higley on 2022-10-06.
//
public protocol Resolvable {
var lifetime: Lifetime { get }
func resolve(_ resolver: any Resolver, _ argument: Any) throws -> Any
func resolve(_ resolver: any Resolver, _ argument: Any) async throws -> Any
}
| [
-1
] |
a34f7a87766abad09e87b88139c3107a4fdb371f | a243d31bde2c7eea3e315ea8f165937aa62e09fe | /20170503/AppDelegate.swift | 4e5aed35044acc49dc2871003a9622955acde3f7 | [] | no_license | jasmine888tw/20170503 | 5a2a2fc1ad7f61c18179258d2df8340b5b07b82b | 984ee8dbccffc64bf8bd5d6ec18cdfd7724f3402 | refs/heads/master | 2021-01-20T08:21:30.201290 | 2017-05-04T06:01:18 | 2017-05-04T06:01:18 | 90,134,903 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,174 | swift | //
// AppDelegate.swift
// 20170503
//
// Created by juicemeart on 2017/5/3.
// Copyright © 2017年 juicemeart. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
| [
229380,
229383,
229385,
278539,
294924,
229388,
278542,
327695,
229391,
278545,
229394,
278548,
229397,
229399,
229402,
352284,
278556,
229405,
278559,
229408,
294950,
229415,
229417,
327722,
237613,
229422,
360496,
229426,
237618,
229428,
311349,
286774,
286776,
319544,
286778,
204856,
229432,
286791,
237640,
286797,
278605,
311375,
163920,
196692,
319573,
311383,
278623,
278626,
319590,
311400,
278635,
303212,
278639,
131192,
278648,
237693,
303230,
327814,
303241,
131209,
417930,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
286916,
286922,
286924,
286926,
319694,
286928,
131281,
278743,
278747,
295133,
155872,
319716,
237807,
303345,
286962,
303347,
229622,
327930,
278781,
278783,
278785,
237826,
319751,
286987,
319757,
311569,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
295220,
155966,
319809,
319810,
278849,
319814,
311623,
319818,
311628,
229709,
319822,
287054,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
319879,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
278980,
278983,
319945,
278986,
278990,
278994,
311767,
279003,
279006,
188895,
172512,
287202,
279010,
279015,
172520,
319978,
279020,
172526,
311791,
279023,
172529,
279027,
319989,
172534,
180727,
164343,
279035,
311804,
287230,
279040,
303617,
287234,
279045,
172550,
303623,
172552,
320007,
287238,
279051,
172558,
279055,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
279082,
311850,
279084,
172591,
172598,
172607,
172609,
172612,
377413,
172614,
213575,
172618,
303690,
33357,
303696,
279124,
172634,
262752,
172644,
311911,
189034,
295533,
172655,
172656,
352880,
295538,
189040,
172660,
287349,
189044,
189039,
287355,
287360,
295553,
172675,
295557,
311942,
303751,
287365,
352905,
311946,
287371,
279178,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
172702,
287390,
303773,
172705,
287394,
172707,
303780,
164509,
287398,
205479,
287400,
279208,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
328384,
172737,
279231,
287427,
312005,
312006,
107208,
172748,
287436,
107212,
172751,
287440,
295633,
172755,
303827,
279255,
287450,
303835,
279258,
189149,
303838,
213724,
312035,
279267,
295654,
279272,
230128,
312048,
312050,
230131,
205564,
303871,
230146,
328453,
295685,
230154,
33548,
312077,
295695,
295701,
230169,
369433,
295707,
328476,
295710,
230175,
295720,
303914,
279340,
279353,
230202,
312124,
328508,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
279390,
230241,
303976,
336744,
303981,
303985,
303987,
328563,
303991,
303997,
295806,
295808,
295813,
304005,
320391,
304007,
213895,
304009,
304011,
304013,
295822,
213902,
279438,
189329,
295825,
304019,
189331,
58262,
304023,
304027,
279452,
279461,
279462,
304042,
213931,
230327,
304055,
287675,
197564,
230334,
304063,
238528,
304065,
213954,
189378,
156612,
197580,
312272,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
295945,
230413,
197645,
295949,
320528,
140312,
295961,
238620,
304164,
304170,
304175,
238641,
312374,
238652,
238655,
230465,
238658,
336964,
132165,
296004,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
205931,
296044,
164973,
205934,
279661,
312432,
279669,
337018,
189562,
279679,
304258,
279683,
222340,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
238766,
165038,
230576,
238770,
304311,
230592,
312518,
279750,
230600,
230607,
148690,
320727,
279769,
304348,
304354,
296163,
320740,
304360,
320748,
279788,
279790,
304370,
296189,
320771,
312585,
296202,
296205,
230674,
320786,
230677,
296213,
296215,
320792,
230681,
230679,
214294,
304416,
230689,
173350,
312622,
296243,
312630,
222522,
296253,
222525,
296255,
312639,
296259,
296262,
230727,
238919,
296264,
320840,
296267,
296271,
222545,
230739,
312663,
222556,
337244,
230752,
312676,
230760,
173418,
148843,
410987,
230763,
230768,
296305,
312692,
230773,
304505,
304506,
181626,
279929,
181631,
148865,
312711,
312712,
296331,
288140,
288144,
230800,
304533,
288154,
337306,
288160,
173472,
288162,
288164,
279975,
304555,
370092,
279983,
173488,
288176,
279985,
312755,
296373,
312759,
337335,
288185,
279991,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
148946,
370130,
222676,
288210,
288212,
288214,
239064,
329177,
288217,
288218,
280027,
288220,
239070,
288224,
370146,
280034,
288226,
288229,
280036,
280038,
288230,
288232,
288234,
320998,
288236,
288238,
288240,
288242,
296435,
288244,
288250,
296446,
321022,
402942,
148990,
296450,
206336,
230916,
230919,
230923,
304651,
304653,
370187,
230940,
222752,
108066,
296486,
296488,
157229,
230961,
157236,
288320,
288325,
124489,
280145,
288338,
280149,
288344,
280152,
239194,
280158,
403039,
370272,
239202,
312938,
280183,
280185,
280188,
280191,
116354,
280194,
280208,
280211,
288408,
280218,
280222,
190118,
198310,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
313027,
280260,
206536,
280264,
206539,
206541,
206543,
313044,
280276,
321239,
280283,
313052,
18140,
288478,
313055,
321252,
313066,
288494,
280302,
313073,
321266,
419570,
288499,
288502,
280314,
288510,
124671,
67330,
280324,
198405,
280331,
198416,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
296767,
288576,
345921,
280388,
304968,
280402,
173907,
313171,
313176,
42842,
280419,
321381,
296809,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
313258,
321458,
296883,
124853,
214966,
296890,
10170,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
239586,
313320,
231404,
124913,
165876,
321528,
239612,
313340,
288764,
239617,
313347,
288773,
313358,
305176,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
378941,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
149599,
280671,
149601,
321634,
149603,
223327,
280681,
313451,
223341,
280687,
149618,
215154,
313458,
280691,
313464,
329850,
321659,
288895,
321670,
215175,
288909,
141455,
275606,
280725,
313498,
100520,
288936,
280747,
288940,
288947,
280755,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
313548,
321740,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
280811,
280817,
125171,
280819,
157940,
182517,
280823,
280825,
280827,
280830,
280831,
280833,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
280888,
305464,
280891,
289087,
280897,
280900,
305480,
239944,
280906,
239947,
305485,
305489,
280919,
354653,
354656,
313700,
313705,
280937,
190832,
280946,
223606,
313720,
280956,
239997,
280959,
313731,
199051,
240011,
289166,
240017,
297363,
190868,
240021,
297365,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
289210,
305594,
281024,
289218,
289221,
289227,
281047,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
240132,
281095,
223752,
150025,
338440,
223757,
281102,
223763,
223765,
322074,
281116,
182819,
281127,
281135,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
338528,
338532,
199273,
281196,
19053,
158317,
313973,
297594,
281210,
158347,
133776,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
199364,
297671,
158409,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322314,
322318,
281361,
281372,
322341,
215850,
281388,
289593,
281401,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
281442,
174955,
224110,
207733,
207737,
158596,
183172,
338823,
322440,
314249,
183184,
289687,
240535,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
183260,
289762,
322534,
297961,
183277,
322550,
134142,
322563,
314372,
175134,
322599,
322610,
314421,
281654,
314427,
314433,
207937,
314441,
322642,
314456,
281691,
314461,
281702,
281704,
281711,
289912,
248995,
306341,
306344,
306347,
322734,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
216376,
380226,
298306,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
290171,
314747,
306555,
298365,
290174,
224641,
281987,
298372,
314756,
281990,
224647,
298377,
314763,
314768,
224657,
306581,
314773,
314779,
314785,
314793,
282025,
282027,
241068,
241070,
241072,
282034,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
290291,
282101,
241142,
191992,
290298,
151036,
290302,
290305,
306694,
192008,
323084,
257550,
282127,
290321,
282130,
290325,
282133,
241175,
290328,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
28219,
282186,
224849,
282195,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
282261,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
306856,
282295,
323260,
282300,
323266,
282310,
282319,
306897,
241362,
306904,
282328,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
241450,
282410,
306988,
306991,
315184,
323376,
315190,
241464,
159545,
282425,
298811,
118593,
307009,
413506,
307012,
241475,
298822,
315211,
307027,
315221,
315223,
241496,
241498,
307035,
307040,
110433,
282465,
241509,
110438,
298860,
110445,
282478,
315249,
315253,
315255,
339838,
315267,
282499,
315269,
241544,
282505,
241546,
241548,
298896,
298898,
282514,
241556,
298901,
44948,
241560,
282520,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
241581,
241583,
323504,
241586,
290739,
241588,
282547,
241590,
241592,
241598,
290751,
241600,
241605,
151495,
241610,
298975,
241632,
298984,
241643,
298988,
241646,
241649,
241652,
323574,
290807,
299003,
241661,
299006,
282623,
315396,
241669,
315397,
282632,
307211,
282639,
290835,
282645,
241693,
241701,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
307278,
192596,
307287,
307290,
217179,
315482,
192605,
315483,
233567,
299105,
200801,
217188,
299109,
307303,
315495,
356457,
45163,
307307,
315502,
192624,
307314,
323700,
299126,
233591,
299136,
307329,
315524,
307338,
233613,
241813,
307352,
299164,
299167,
315552,
184479,
184481,
315557,
184486,
307370,
307372,
307374,
307376,
323763,
184503,
299191,
176311,
307386,
258235,
307388,
176316,
307390,
307385,
299200,
307394,
299204,
307396,
184518,
307399,
323784,
233679,
307409,
307411,
299225,
233701,
307432,
282881,
282893,
323854,
291089,
282906,
291104,
233766,
295583,
307508,
315701,
332086,
307510,
307512,
307515,
307518,
282942,
282947,
323917,
282957,
110926,
233808,
323921,
315733,
323926,
233815,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
315801,
283033,
242075,
291226,
61855,
291231,
283042,
291238,
291241,
127403,
127405,
291247,
299440,
127407,
299444,
127413,
291254,
283062,
127417,
291260,
127421,
127424,
299457,
127429,
127431,
127434,
315856,
127440,
176592,
315860,
176597,
127447,
283095,
299481,
127449,
176605,
242143,
127455,
127457,
291299,
127463,
242152,
291305,
127466,
176620,
127469,
127474,
291314,
291317,
127480,
135672,
291323,
233979,
127485,
291330,
127490,
127494,
283142,
135689,
233994,
127497,
127500,
233998,
127506,
234003,
127509,
234006,
127511,
152087,
283161,
234010,
135707,
242202,
135710,
242206,
242208,
291361,
242220,
291378,
152118,
234038,
234041,
315961,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
135808,
291456,
373383,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
135839,
299680,
225954,
299684,
135844,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
119509,
226005,
226008,
299740,
201444,
299750,
283368,
234219,
283372,
226037,
283382,
316151,
234231,
234236,
226045,
242431,
234239,
209665,
234242,
299778,
242436,
234246,
226056,
291593,
234248,
242443,
234252,
242445,
234254,
291601,
234258,
242450,
242452,
234261,
348950,
201496,
234264,
234266,
234269,
283421,
234272,
234274,
152355,
299814,
234278,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
160572,
283452,
234302,
234307,
242499,
234309,
316233,
234313,
316235,
234316,
283468,
234319,
242511,
234321,
234324,
185173,
201557,
234329,
234333,
308063,
234336,
242530,
349027,
234338,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
226171,
234364,
291711,
234368,
291714,
234370,
291716,
234373,
316294,
226182,
234375,
308105,
226185,
234379,
201603,
324490,
234384,
234388,
234390,
226200,
234393,
209818,
308123,
234396,
324508,
291742,
324504,
234398,
234401,
291747,
291748,
234405,
291750,
324518,
324520,
234407,
324522,
234410,
291756,
291754,
226220,
324527,
291760,
234417,
201650,
324531,
234414,
234422,
226230,
324536,
275384,
234428,
291773,
242623,
324544,
234431,
234434,
324546,
324548,
234437,
226239,
226245,
234439,
234443,
291788,
234446,
193486,
193488,
234449,
316370,
275406,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234475,
234478,
316400,
234481,
316403,
234484,
234485,
234487,
324599,
234490,
234493,
316416,
234496,
308226,
234501,
275462,
308231,
234504,
234507,
234510,
234515,
300054,
316439,
234520,
234519,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
234543,
234546,
275508,
300085,
234549,
300088,
234553,
234556,
234558,
316479,
234561,
316483,
160835,
234563,
308291,
234568,
234570,
316491,
234572,
300108,
234574,
300115,
234580,
234581,
234585,
275545,
234590,
234593,
234595,
234597,
300133,
234601,
300139,
234605,
160879,
234607,
275569,
234610,
316530,
300148,
234614,
398455,
144506,
234618,
234620,
275579,
234623,
226433,
234627,
275588,
234629,
234634,
234636,
177293,
234640,
275602,
234643,
308373,
226453,
234647,
234648,
275608,
234650,
308379,
324757,
300189,
324766,
119967,
234653,
324768,
283805,
234657,
242852,
300197,
234661,
283813,
234664,
275626,
234667,
316596,
308414,
234687,
300223,
300226,
308418,
234692,
300229,
308420,
308422,
283844,
300234,
283850,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
300267,
300270,
300272,
120053,
300278,
275703,
316663,
300284,
275710,
300287,
292097,
300289,
300292,
300294,
275719,
234760,
177419,
300299,
242957,
300301,
275725,
177424,
283917,
349464,
283939,
259367,
292143,
283951,
300344,
243003,
283963,
226628,
300357,
283973,
283983,
316758,
357722,
316766,
316768,
292192,
218464,
292197,
316774,
218473,
284010,
136562,
324978,
333178,
275834,
275836,
275840,
316803,
316806,
316811,
316814,
226703,
300433,
234899,
300436,
226709,
357783,
316824,
316826,
300448,
144807,
144810,
144812,
284076,
144814,
227426,
144820,
374196,
284084,
292279,
284087,
144826,
144828,
144830,
144832,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
226787,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
292338,
226802,
316917,
292343,
308727,
300537,
316933,
316947,
308757,
308762,
284191,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
194101,
284213,
316983,
194103,
284215,
308790,
284218,
226877,
292414,
284223,
284226,
284228,
292421,
243268,
284231,
226886,
128584,
284234,
366155,
317004,
276043,
284238,
226895,
284241,
194130,
284243,
300628,
284245,
292433,
284247,
317015,
235097,
243290,
276052,
276053,
284249,
300638,
284251,
284253,
284255,
284258,
292452,
292454,
284263,
284265,
292458,
284267,
292461,
284272,
284274,
284278,
292470,
276086,
292473,
284283,
276093,
284286,
292479,
284288,
292481,
284290,
325250,
284292,
292485,
325251,
276095,
276098,
284297,
317066,
284299,
317068,
284301,
276109,
284303,
284306,
276114,
284308,
284312,
284314,
276122,
284316,
276127,
284320,
284322,
284327,
284329,
317098,
284331,
276137,
284333,
284335,
276144,
284337,
284339,
300726,
284343,
284346,
284350,
358080,
276160,
284354,
358083,
284358,
276166,
358089,
284362,
276170,
284365,
276175,
284368,
276177,
284370,
358098,
284372,
317138,
284377,
284379,
284381,
284384,
358114,
284386,
358116,
317158,
358119,
284392,
325353,
358122,
284394,
284397,
358126,
284399,
358128,
276206,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
300819,
317207,
284440,
300828,
300830,
276255,
300832,
325408,
300834,
317221,
227109,
358183,
276268,
300845,
243504,
300850,
284469,
276280,
325436,
358206,
366406,
276295,
292681,
153417,
358224,
276308,
284502,
317271,
178006,
276315,
292700,
317279,
284511,
292715,
300912,
292721,
284529,
300915,
292729,
317306,
284540,
292734,
325512,
276365,
317332,
358292,
284564,
284566,
350106,
284572,
276386,
284579,
276388,
358312,
317353,
284585,
276395,
292784,
358326,
161718,
358330,
276411,
276418,
301009,
301011,
301013,
292823,
358360,
301017,
301015,
292828,
276446,
153568,
276448,
276452,
292839,
276455,
292843,
276460,
178161,
227314,
276466,
325624,
276472,
317435,
276476,
276479,
276482,
276485,
317446,
276490,
292876,
317456,
276496,
317458,
178195,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
276528,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
276544,
284739,
325700,
292934,
243785,
276553,
350293,
350295,
309337,
227418,
350299,
194649,
350302,
194654,
350304,
178273,
309346,
227423,
194660,
350308,
309350,
309348,
292968,
309352,
309354,
301163,
350313,
350316,
227430,
301167,
276583,
350321,
276590,
284786,
276595,
350325,
252022,
227440,
350328,
292985,
301178,
350332,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
350366,
350375,
350379,
350381,
350383,
129200,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
301258,
309450,
276685,
309455,
276689,
309462,
301272,
194780,
309468,
309471,
301283,
317672,
317674,
325867,
243948,
309491,
227571,
309494,
243960,
227583,
276735,
227587,
276739,
276742,
227596,
325910,
309530,
342298,
211232,
317729,
276775,
211241,
325937,
325943,
211260,
260421,
276809,
285002,
276811,
235853,
235858,
276829,
276833,
391523,
276836,
293227,
293232,
276848,
186744,
211324,
227709,
285061,
317833,
178572,
285070,
285077,
227738,
317853,
276896,
317858,
342434,
285093,
317864,
285098,
276907,
235955,
276917,
293304,
293307,
293314,
309707,
293325,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
293346,
227810,
276964,
293352,
236013,
293364,
301562,
293370,
317951,
309764,
301575,
121352,
293387,
236043,
342541,
113167,
309779,
317971,
309781,
277011,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
23094,
277054,
219714,
129603,
301636,
318020,
301639,
301643,
285265,
399955,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
309871,
121458,
277106,
170619,
309885,
309888,
277122,
277128,
301706,
318092,
326285,
334476,
318094,
277136,
277139,
227992,
318108,
285340,
318110,
227998,
137889,
383658,
285357,
318128,
277170,
293555,
318132,
342707,
154292,
277173,
285368,
277177,
277181,
318144,
277187,
277194,
277196,
277201,
137946,
113378,
228069,
277223,
342760,
285417,
56043,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
228113,
285459,
277273,
293659,
326430,
228128,
285474,
293666,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
285494,
301880,
301884,
293696,
310080,
277317,
293706,
277322,
162643,
310100,
301911,
301913,
277337,
301921,
236397,
162671,
326514,
310134,
236408,
15224,
277368,
416639,
416640,
113538,
310147,
416648,
39817,
187274,
277385,
301972,
424853,
277405,
277411,
310179,
293798,
293802,
236460,
277426,
293811,
276579,
293817,
293820,
203715,
326603,
276586,
293849,
293861,
228327,
228328,
318442,
228330,
228332,
326638,
277486,
318450,
293876,
293877,
285686,
302073,
121850,
293882,
302075,
244731,
285690,
293887,
277504,
277507,
138246,
277511,
293899,
277519,
293908,
302105,
293917,
293939,
318516,
277561,
277564,
310336,
293956,
277573,
228422,
293960,
310344,
277577,
277583,
203857,
293971,
310355,
310359,
236632,
277594,
138332,
277598,
203872,
277601,
285792,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
367737,
285817,
302205,
285821,
392326,
285831,
253064,
294026,
302218,
285835,
162964,
384148,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
302241,
285862,
277671,
302248,
64682,
277678,
294063,
294065,
302258,
277687,
294072,
318651,
294076,
277695,
318657,
244930,
302275,
130244,
302277,
228550,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
310486,
302296,
384222,
310498,
285927,
318698,
302315,
228592,
294132,
138485,
228601,
204026,
228606,
64768,
310531,
138505,
228617,
318742,
277798,
130345,
113964,
285997,
285999,
113969,
318773,
318776,
286010,
417086,
286016,
302403,
294211,
384328,
294221,
294223,
326991,
179547,
146784,
302436,
294246,
327015,
310632,
327017,
351594,
351607,
310648,
310651,
310657,
351619,
294276,
310659,
327046,
253320,
310665,
318858,
310672,
351633,
310689,
130468,
228776,
277932,
310703,
310710,
130486,
310712,
310715,
302526,
228799,
302534,
310727,
245191,
64966,
302541,
302543,
310737,
228825,
163290,
310749,
310755,
187880,
310764,
286188,
310772,
40440,
212472,
40443,
286203,
310780,
40448,
228864,
286214,
228871,
302603,
302614,
302617,
286233,
302621,
286240,
146977,
187939,
40484,
294435,
40486,
286246,
294440,
40488,
294439,
294443,
40491,
294445,
310831,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
327240,
40521,
286283,
40525,
40527,
212560,
400976,
228944,
40533,
147032,
40537,
40539,
40541,
278109,
40544,
40548,
40550,
40552,
286312,
40554,
286313,
310892,
40557,
40560,
294521,
343679,
294537,
310925,
286354,
278163,
302740,
122517,
278168,
179870,
327333,
229030,
212648,
278188,
302764,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
294601,
302793,
343757,
212690,
319187,
286420,
278227,
229076,
286425,
319194,
278235,
229086,
278238,
294625,
294634,
302838,
319226,
286460,
278274,
302852,
278277,
302854,
294664,
311048,
352008,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
319280,
278320,
319290,
229192,
302925,
188247,
280021,
188252,
237409,
294776,
360317,
294785,
327554,
40851,
294811,
237470,
319390,
40865,
319394,
294817,
294821,
311209,
180142,
343983,
294831,
188340,
40886,
294844,
294847,
237508,
393177,
294876,
294879,
294883,
294890,
311279,
278513,
237555,
311283,
278516,
278519,
237562
] |
381c21306b011e9ef1f9508f7dfb697fcaf03189 | b6a0ec3180fab8332ee6cb82d1b24883481affbb | /Alttex safe/Models/WalletsModel/BitocModel/TransactionDataStoreManager.swift | 583e4f4021f4ea763ce8c3d070b2bd1765f28a14 | [] | no_license | alttex/Safe | 33930b0712da351e5d5133d405957f6c4d03926f | ad984f1d2a836ff2189d2dc07eebdc47f7e43eab | refs/heads/master | 2021-09-10T07:56:43.381743 | 2018-03-22T13:13:04 | 2018-03-22T13:13:04 | 117,847,062 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,840 | swift |
import Foundation
import RealmSwift
public class TransactionDataStoreManager {
//This method must be called after validaing Merkle Block.
public static func add(tx: Transaction) {
//Check if the tx is already received and stored in the local-DB.
if let _ = TransactionInfo.fetch(txHash: tx.hash.data.toHexString()) {
return
}
let txInfo = TransactionInfo.create(tx)
txInfo.save()
let extractedInputs = extractRelevantInputs(tx)
if extractedInputs.count != 0 {
incomingInputCheck(extractedInputs)
}
updateUTXOInfo()
let balance = calculateBalance()
print(balance)
}
public static func calculateBalance() -> Int64 {
var balance: Int64 = 0
for userkey in UserKeyInfo.loadAll() {
balance += userkey.balance
}
return balance
}
//Set relevant UTXO's isSpent flag to true and update UTXO info.
private static func incomingInputCheck(_ inputs: [Transaction.Input]) {
for input in inputs {
let txHash = input.outPoint.transactionHash.data.toHexString()
guard let outpointTx = TransactionInfo.fetch(txHash: txHash) else {
continue
}
let outputIndex = input.outPoint.index
let targetOutput = outpointTx.outputs[Int(outputIndex)]
targetOutput.update {
targetOutput.isSpent = true
}
}
}
private static func updateUTXOInfo() {
for userkey in UserKeyInfo.loadAll() {
userkey.update {
//Delete all old chached UTXOs first.
userkey.UTXOs.removeAll()
}
let txs = TransactionInfo.loadAll()
for tx in txs {
for output in tx.outputs {
if userkey.publicKeyHash == output.pubKeyHash && !output.isSpent {
userkey.update {
userkey.UTXOs.append(output)
}
}
}
}
}
}
private static func extractRelevantInputs(_ tx: Transaction) -> [Transaction.Input] {
var inputs_res: [Transaction.Input] = []
for key in UserKeyInfo.loadAll() {
for input in tx.inputs {
if let extractedKeyHash = input.parsedScript?.hash160.data.toHexString() {
if key.publicKeyHash == extractedKeyHash {
inputs_res.append(input)
}
}
}
}
return inputs_res
}
}
| [
-1
] |
91c967996b03cfe68663ab5ab967d69e0ac32845 | e180d7b882a39fcc0410ef063d3c6c6f25fb9c46 | /learn-swift-installing-and-uninstalling-views/learn-swiftTests/learn_swiftTests.swift | 30adc2f51cac0a483ec2f7e08caa06da7f2e6ad4 | [] | no_license | ericsonyc/IOS_Projects | 932d8761c37d877b6b93d516856c6e3ff8e5c1b0 | f4d7238d4e68f2b1fe3562d96c780d9ea1137d0a | refs/heads/master | 2021-01-21T14:01:14.849136 | 2016-05-22T10:18:55 | 2016-05-22T10:18:55 | 48,229,520 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 896 | swift | //
// learn_swiftTests.swift
// learn-swiftTests
//
// Created by why on 9/11/14.
// Copyright (c) 2014 why. All rights reserved.
//
import UIKit
import XCTest
class learn_swiftTests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// This is an example of a functional test case.
XCTAssert(true, "Pass")
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measureBlock() {
// Put the code you want to measure the time of here.
}
}
}
| [
305179,
276509,
278558,
307231,
313375,
102437,
227370,
360491,
276534,
241720,
159807,
286788,
280649,
223316,
315476,
223318,
288857,
227417,
278618,
194652,
194656,
276577,
309345,
227428,
276582,
276589,
278638,
227439,
276592,
131189,
223350,
276606,
292992,
141450,
215178,
311435,
311438,
276627,
276632,
184475,
227492,
196773,
129203,
299187,
131256,
280762,
223419,
299198,
309444,
227528,
276682,
276687,
278742,
280802,
196834,
233715,
157944,
211193,
168188,
276737,
276748,
276753,
157970,
129301,
276760,
309529,
278810,
276764,
299293,
282919,
262450,
315706,
164162,
311621,
280902,
278856,
227658,
276813,
278862,
6481,
6482,
276821,
6489,
276831,
323935,
276835,
321894,
416104,
276847,
285040,
278898,
280961,
227725,
178578,
190871,
293274,
61857,
61859,
276900,
278961,
278965,
293303,
276920,
33211,
276925,
278978,
281037,
278993,
279002,
287198,
227809,
358882,
227813,
279013,
279019,
279022,
281072,
279039,
276998,
287241,
279050,
186893,
303631,
223767,
223769,
291358,
277029,
293419,
281138,
277048,
277049,
301634,
295519,
66150,
277094,
166507,
189036,
277101,
189037,
295535,
287346,
189042,
189043,
277111,
279164,
291454,
184962,
303746,
152203,
277133,
133774,
230040,
285353,
205487,
285361,
303793,
299699,
293556,
342706,
285371,
285372,
285374,
199366,
225997,
226004,
203477,
279252,
226007,
203478,
226019,
279269,
285415,
342762,
277227,
226033,
226036,
230134,
234234,
279294,
234241,
209670,
226058,
234250,
234253,
234263,
369432,
234268,
234277,
279336,
289576,
277289,
234283,
234286,
234289,
234294,
230199,
162621,
234301,
289598,
277312,
281408,
293693,
162626,
277316,
234311,
234312,
299849,
234317,
277325,
293711,
234323,
234326,
234331,
301918,
279392,
349026,
297826,
234340,
234343,
234346,
277360,
234355,
277366,
234360,
279417,
209785,
177019,
234361,
277370,
234366,
234367,
158593,
234372,
226181,
113542,
213894,
226184,
277381,
228234,
295824,
234386,
234387,
234392,
324507,
234400,
279456,
277410,
234404,
289703,
234409,
275371,
277419,
236461,
234419,
234425,
277435,
234427,
287677,
234430,
234436,
275397,
234438,
52172,
234444,
234445,
183248,
275410,
234451,
234454,
234457,
234463,
234466,
277479,
234472,
234473,
179176,
234477,
234482,
287731,
277492,
314355,
277505,
234498,
234500,
277509,
277510,
230410,
234506,
275469,
277517,
197647,
277523,
230423,
197657,
281625,
281626,
175132,
234531,
234534,
310317,
234542,
275506,
234548,
234555,
238651,
156733,
277566,
277563,
230463,
234560,
207938,
7229,
7231,
234565,
277574,
234569,
277579,
300111,
277585,
234577,
296019,
234583,
234584,
275547,
230499,
281700,
277603,
300135,
281707,
275565,
156785,
312434,
275571,
300151,
234616,
398457,
234622,
300158,
226435,
285828,
302213,
253063,
234632,
275591,
277640,
234642,
308372,
275607,
119963,
234656,
277665,
330913,
306338,
234659,
275620,
234663,
275625,
300201,
226481,
238769,
208058,
277690,
230588,
283840,
279747,
279760,
290000,
189652,
363744,
195811,
298212,
304356,
279792,
298228,
204022,
234742,
228600,
120056,
208124,
204041,
292107,
277792,
339234,
199971,
304421,
277800,
113962,
113966,
226608,
300343,
226624,
15686,
226632,
294218,
177484,
222541,
142669,
296273,
222548,
314709,
283991,
357719,
218462,
224606,
142689,
230756,
163175,
281962,
284014,
226675,
275831,
181625,
277883,
277890,
226694,
281992,
230799,
318864,
112017,
306579,
206228,
310692,
277925,
279974,
282024,
370091,
277936,
279989,
296375,
296387,
415171,
163269,
296391,
300487,
280013,
312782,
284116,
226781,
310757,
316902,
296425,
226805,
306677,
300542,
306693,
192010,
149007,
65041,
282136,
204313,
278060,
286254,
228917,
194110,
128583,
276040,
366154,
276045,
286288,
226897,
276050,
280147,
300630,
147036,
243292,
370271,
282213,
317032,
222832,
276084,
276085,
276088,
278140,
188031,
276097,
192131,
229001,
310923,
278162,
282259,
276116,
276120,
278170,
276126,
282273,
282276,
278191,
278195,
198324,
286388,
296628,
276156,
276165,
276173,
302797,
212688,
302802,
286423,
216795,
276195,
153319,
313065,
280300,
419569,
276210,
276211,
276219,
194303,
288512,
171776,
311042,
288516,
278285,
276238,
227091,
294678,
284442,
278299,
276253,
159533,
165677,
276282,
276283,
276287,
345919,
276294,
282438,
276298,
296779,
216918,
307031,
276318,
237408,
282474,
288619,
276332,
276344,
194429,
227199,
40850,
40853,
44952,
247712,
294823,
276400,
276401,
276408,
290746,
161722,
276413,
276421,
276430,
231375,
153554,
276443,
276444,
280541,
153566,
276454,
276459,
296941
] |
676beddadc3ac98d83083ec5b6c57b1a9adec47d | 2eeafee7fc4d29ba9ab14e84f4f78761587b89a6 | /ManufactoriaSwift/GameProgressData.swift | 025c1f0de08ced7947e03629b48da24dbefc845c | [] | no_license | warrenwhipple/manufactoria-ios | 2604062a828ba47d3b3643b01db8381077e42cf2 | 204f7a5eab59ff6b275ce1e8add006249268019f | refs/heads/master | 2020-03-26T13:09:50.294100 | 2018-08-19T19:49:50 | 2018-08-19T19:49:50 | 144,926,126 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,039 | swift | //
// GameProgressData.swift
// ManufactoriaSwift
//
// Created by Warren Whipple on 7/24/14.
// Copyright (c) 2014 Warren Whipple. All rights reserved.
//
import Foundation
private let _classSharedInstance = GameProgressData()
private let filePath = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0].stringByAppendingPathComponent("gameProgressData")
private let _classLevelKeyLinks: [String:[String]] = [
"move": ["read"],
"read": ["readseq"],
"exclude": ["gte3n"],
"readseq": ["exclude"],
"last": ["last2", "firstislast", "alternates"],
"gte3n": ["last", "exclude2", "write"],
"write": ["firsttolast", "recolor"],
"nisn": ["nis2n"],
"recolor": ["enclose"],
"nn": ["nisn", "nnn"],
"remove": ["sort", "nn"],
"enclose": ["remove", "swap", "odd"],
"swap": ["copy", "lasttofirst"],
"nnn": ["symmetric", "halve"],
"odd": ["times8"],
"lasttofirst": ["reverse"],
"halve": ["copied"],
"times8": ["gt15", "increment"],
"increment": ["length", "decrement"],
"divide": ["modulo"],
"subtract": ["divide"],
"decrement": ["subtract", "greaterthan", "add"],
"multiply": ["power"],
"add": ["multiply"],
]
class GameProgressData: NSObject, NSCoding {
class var sharedInstance: GameProgressData {return _classSharedInstance}
class var levelKeyLinks: [String:[String]] {return _classLevelKeyLinks}
var levelProgressDictionary: [String:LevelProgressData]
override init() {
if let loadedGameProgressData = NSKeyedUnarchiver.unarchiveObjectWithFile(filePath) as? GameProgressData {
levelProgressDictionary = loadedGameProgressData.levelProgressDictionary
} else {
levelProgressDictionary = LevelLibrary.map {return LevelProgressData(levelSetup: $0)}
}
levelProgressDictionary["move"]?.isUnlocked = true
}
required init(coder aDecoder: NSCoder) {
levelProgressDictionary = aDecoder.decodeObjectForKey("levelProgressDictionary") as? [String:LevelProgressData] ?? [String:LevelProgressData]()
for key in LevelLibrary.keys {
if levelProgressDictionary[key] == nil {
levelProgressDictionary[key] = LevelProgressData(levelSetup: LevelLibrary[key]!)
}
}
}
func encodeWithCoder(aCoder: NSCoder) {
aCoder.encodeObject(levelProgressDictionary, forKey: "levelProgressDictionary")
}
func save() {
NSKeyedArchiver.archivedDataWithRootObject(self).writeToFile(filePath, atomically: true)
}
func resetAllGameProgressData() {
levelProgressDictionary = LevelLibrary.map {return LevelProgressData(levelSetup: $0)}
levelProgressDictionary["move"]?.isUnlocked = true
save()
}
func unlockAllLevels() {
for levelProgressData in levelProgressDictionary.values {
levelProgressData.isUnlocked = true
}
save()
}
func completedLevelWithKey(levelKey: String) {
if let levelProgressData = levelProgressDictionary[levelKey] {
levelProgressData.isComplete = true
levelProgressData.tutorialIsOn = false
if let unlockKeys = GameProgressData.levelKeyLinks[levelKey] {
for unlockKey in unlockKeys {
levelProgressDictionary[unlockKey]?.isUnlocked = true
}
}
save()
}
}
func level(key: String) -> LevelProgressData? {
return levelProgressDictionary[key]
}
}
class LevelProgressData: NSObject, NSCoding {
var isComplete: Bool = false
var isUnlocked: Bool = false
var tutorialIsOn: Bool = true
override init() {
}
init(levelSetup: LevelSetup) {
}
required init(coder aDecoder: NSCoder) {
isComplete = aDecoder.decodeObjectForKey("isComplete") as? Bool ?? false
isUnlocked = aDecoder.decodeObjectForKey("isUnlocked") as? Bool ?? false
tutorialIsOn = aDecoder.decodeObjectForKey("tutorialIsOn") as? Bool ?? true
}
func encodeWithCoder(aCoder: NSCoder) {
aCoder.encodeObject(isComplete, forKey: "isComplete")
aCoder.encodeObject(isUnlocked, forKey: "isUnlocked")
aCoder.encodeObject(tutorialIsOn, forKey: "tutorialIsOn")
}
} | [
-1
] |
9f248e71ad7342761fe8e5c42f70a2f70f3edbbd | 7754cd85b8edd4133acaa985bd6d8809e4d9fc52 | /FudanBBS_V3/TopDetailTableViewController.swift | f5755f911af154ff0bc5318599e527c552ef89a6 | [] | no_license | gaoliuliu/FudanBBS | 476b77563abfc630a5266996caf9312ff37b8f6e | f26160438b890edd262577be244d4991b7e0cd24 | refs/heads/master | 2021-01-10T18:31:30.220632 | 2015-08-27T14:45:30 | 2015-08-27T14:45:30 | 33,188,532 | 1 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 9,007 | swift | //
// TopDetailTableViewController.swift
// FudanBBS_V3
//
// Created by gaowei on 14/12/23.
// Copyright (c) 2014年 gaowei. All rights reserved.
//
import UIKit
class TopDetailTableViewController: UITableViewController,UITableViewDelegate, UITableViewDataSource {
var bbs = bbstcon()
var new1:String! = ""
var board:String! = ""
var f:String! = ""
var p:Bool = false
let handler = Top10HTTPHandler()
override func viewDidLoad() {
super.viewDidLoad()
self.tableView.estimatedRowHeight = 100.0
self.tableView.rowHeight = UITableViewAutomaticDimension
if p
{
bbs = handler.getPostPA(new1, board: board, f: f)
}else {
bbs = handler.getTop10PostPA(new1, board: board, f: f)
}
self.setupRefresh()
}
func setupRefresh(){
self.tableView.addHeaderWithCallback({
/*self.fakeData!.removeAllObjects()
for (var i:Int = 0; i<15; i++) {
var text:String = "内容"+String( arc4random_uniform(10000))
self.fakeData!.addObject(text)
}*/
var tempbbs = self.handler.getTop10PostPA_PREV(self.new1,bid: self.bbs.bid,gid: self.bbs.gid,fid: self.bbs.fid,a: "p")
if(tempbbs.paList.count != 0)
{
self.bbs = tempbbs
}
let delayInSeconds:Int64 = 100000000 * 2
var popTime:dispatch_time_t = dispatch_time(DISPATCH_TIME_NOW,delayInSeconds)
dispatch_after(popTime, dispatch_get_main_queue(), {
self.tableView.reloadData()
self.tableView.headerEndRefreshing()
self.tableView.setContentOffset(CGPointMake(0,0), animated:false)
})
})
self.tableView.addFooterWithCallback({
/* for (var i:Int = 0; i<10; i++) {
var text:String = "内容"+String( arc4random_uniform(10000))
self.fakeData!.addObject(text)
}*/
var tempbbs = self.handler.getTop10PostPA_NEXT(self.new1,bid: self.bbs.bid,gid: self.bbs.gid,fid: self.bbs.fid,a: "n")
if(tempbbs.paList.count != 0)
{
self.bbs = tempbbs
}
let delayInSeconds:Int64 = 100000000 * 2
var popTime:dispatch_time_t = dispatch_time(DISPATCH_TIME_NOW,delayInSeconds)
dispatch_after(popTime, dispatch_get_main_queue(), {
self.tableView.reloadData()
self.tableView.footerEndRefreshing()
self.tableView.setContentOffset(CGPointMake(0,0), animated:false)
//self.tableView.setFooterHidden(true)
})
})
}
override func viewDidAppear(animated: Bool) {
//println("reload")
//self.tableView.reloadData()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// MARK: - Table view data source
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
// #warning Potentially incomplete method implementation.
// Return the number of sections.
return 1
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// #warning Incomplete method implementation.
// Return the number of rows in the section.
return bbs.paList.count
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cellIdentifier = "Cell"
let cell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier, forIndexPath: indexPath) as! TopDetailTableViewCell
let top = bbs.paList[indexPath.row]
//top10s[indexPath.row]
// Configure the cell...
cell.senderLabel?.text = "发信人: \(top.owner1)"
cell.titleLabel?.text = "标题: \(top.title)"
cell.dateLabel?.text = "时间: \(top.date)\n"
cell.articleLabel?.text = top.pa
cell.quoteLabel?.text = top.quote
cell.tailLabel?.text = top.tail
cell.bid = self.bbs.bid
cell.fid = top.fid
cell.reButton.tag = indexPath.row
cell.picButton.tag = indexPath.row
if top.images.count == 0
{
cell.picButton.hidden = true
}
cell.reButton.addTarget(self, action: "repost2345:", forControlEvents: UIControlEvents.TouchUpInside)
cell.contentView.userInteractionEnabled = true
return cell
}
@IBAction func repost2345(sender: UIButton!){
let cell = bbs.paList[sender.tag]
let optionMenu = UIAlertController(title: nil, message: "回复文章",
preferredStyle: .Alert)
// Add actions to the menu
optionMenu.addTextFieldWithConfigurationHandler {
(textField: UITextField!) -> Void in
textField.text = "Re:" + cell.title
}
optionMenu.addTextFieldWithConfigurationHandler {
(textField: UITextField!) -> Void in
textField.placeholder = " "
}
let cancelAction = UIAlertAction(title: "取消", style: .Cancel, handler: nil)
optionMenu.addAction(cancelAction)
let okAction = UIAlertAction(title: "确定", style: .Default, handler: {(action:UIAlertAction!) -> Void in
var title:UITextField = optionMenu.textFields?.first as! UITextField
var text:UITextField = optionMenu.textFields?.last as! UITextField
var flag:Bool = Top10HTTPHandler().postRePost(self.bbs.bid,fid:cell.fid,title:title.text,text:text.text)
var res = "失败"
if (flag){
res = "成功"
}
let logResultMenu = UIAlertController(title: nil, message: res,
preferredStyle: .Alert)
let cAction = UIAlertAction(title: "确定", style: .Cancel, handler: nil)
logResultMenu.addAction(cAction)
// Display the menu
self.presentViewController(logResultMenu, animated: true, completion: nil)
})
optionMenu.addAction(okAction)
// Display the menu
self.presentViewController(optionMenu, animated: true, completion: nil)
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) {
if segue.identifier == "putPic" {
if let indexPath = sender.tag {
let destinationController = segue.destinationViewController as! ViewController
destinationController.imgList = self.bbs.paList[indexPath].images
//println(self.bbs.paList[indexPath.row].images.count)
//println(destinationController.new1)
//println(destinationController.board)
//println(destinationController.f)
} }
}
/*
// Override to support conditional editing of the table view.
override func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool {
// Return NO if you do not want the specified item to be editable.
return true
}
*/
/*
// Override to support editing the table view.
override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
if editingStyle == .Delete {
// Delete the row from the data source
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade)
} else if editingStyle == .Insert {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
}
}
*/
/*
// Override to support rearranging the table view.
override func tableView(tableView: UITableView, moveRowAtIndexPath fromIndexPath: NSIndexPath, toIndexPath: NSIndexPath) {
}
*/
/*
// Override to support conditional rearranging of the table view.
override func tableView(tableView: UITableView, canMoveRowAtIndexPath indexPath: NSIndexPath) -> Bool {
// Return NO if you do not want the item to be re-orderable.
return true
}
*/
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
}
| [
-1
] |
91a51846a6c3286bd7059d7f6c6bc8549c2b0fd0 | b012c91125473f70150050f3ffaa7bbceff70ea7 | /aynelgul-pset6/User.swift | e605a6a6f991a147a771a66a05abe61903c62ecb | [] | no_license | Aynelgul/App-6 | efd64f4e17732ed41d1d550a3f0c5beb97e4b815 | 827f83116fa4c88db3d76f5f04a1625f60093dcc | refs/heads/master | 2020-06-11T07:09:42.763885 | 2017-01-20T12:03:03 | 2017-01-20T12:03:03 | 75,738,088 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 441 | swift | //
// User.swift
// aynelgul-pset6
//
// Created by Aynel Gül on 08-12-16.
// Copyright © 2016 Aynel Gül. All rights reserved.
//
import Foundation
import Firebase
struct User {
let uid: String
let email: String
init(authData: FIRUser) {
uid = authData.uid
email = authData.email!
}
init(uid: String, email: String) {
self.uid = uid
self.email = email
}
}
| [
-1
] |
73ff7e7eceaa9ef8fcf3cbce8000f956e472395b | a68ee47d162e502ff0bf6b0cce82569c5323f803 | /task5/ReceiverTableViewCell.swift | a0be1735add900f5711420676cc0a1b92e10b47f | [] | no_license | agarwalpalak1995/whatsapp | 68b4a39c307bf554e2ddb5e682f403e73dd12ba5 | 6b32dbfd21f053ea7a6ef191db32a6fee7256d1b | refs/heads/master | 2021-01-19T12:10:32.273311 | 2017-02-20T05:22:29 | 2017-02-20T05:22:29 | 82,292,043 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 928 | swift | //
// ReceiverTableViewCell.swift
// task5
//
// Created by Sierra 4 on 16/02/17.
// Copyright © 2017 Code-brew. All rights reserved.
//
import UIKit
class ReceiverTableViewCell: UITableViewCell {
@IBOutlet weak var lblreceiveTime: UILabel!
@IBOutlet weak var lblReceivermessage: UILabel!
@IBOutlet weak var viewreceiver: UIView!
override func awakeFromNib() {
super.awakeFromNib()
let date = Date()
let hour = Calendar.current.component(.hour, from: date )
let minute = Calendar.current.component(.minute, from: date)
lblreceiveTime.text = "\(hour):" + "\(minute)"
// Initialization code
viewreceiver.layer.cornerRadius = 10
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}
| [
-1
] |
3c193d672bb41126c82955b9a5b84525487086f8 | 54e401879e76c2b381521d32828217462de7bb16 | /SwiftDux/Sources/SwiftDux/Middleware/TypedMiddleware.swift | 7ab85e78983c7a091f4cee7b1a979d397eb87955 | [
"MIT"
] | permissive | traning-ios/LearningSwiftUI | 1bb022afa4230037c53c40debdbbdd317175581d | 8bb3032a9db94955249ae1b464444c17439240ac | refs/heads/master | 2020-11-25T18:51:42.658526 | 2020-04-02T02:05:37 | 2020-04-02T02:05:37 | 228,800,209 | 11 | 4 | null | null | null | null | UTF-8 | Swift | false | false | 1,086 | swift | import Combine
import Foundation
/// An abstract class for middleware that required a known state type when initialized.
///
/// By default, this middleware does nothing. The `run(store:action:)` method should be
/// overridden to implement the middleware functionality.
open class TypedMiddleware<State>: Middleware where State: StateType {
public init() {}
public func run<StoreState>(store: StoreProxy<StoreState>, action: Action) where StoreState: StateType {
guard let typedStore = store as? StoreProxy<State> else {
print("The state type doesn't match the expected type of the TypedMiddleware. Passing the action off.")
return store.next(action)
}
run(store: typedStore, action: action)
}
/// Subclasses should override this method to implement their functionality.
///
/// - Parameters
/// - store: The store object.
/// - action: The dispatched action.
open func run(store: StoreProxy<State>, action: Action) {
print("The TypedMiddleware's run function is unimplemented. Passing the action off.")
store.next(action)
}
}
| [
-1
] |
5d2964f87991706bc95121dcbe578f57ab67c132 | 15ef99d671c7660a6e683acce98557c8dfec553d | /playgroudDemo/GuidedTour.playground/section-45.swift | 3004b4116f8a9c1f556688504c2cdc968c73feca | [] | no_license | lixuanxian/SwiftWorkSpace | 07e205b3efe9445688d509e933ff131df4b3e993 | 6d024ff193ac678e4923708183fc3fe6b5e81651 | refs/heads/master | 2020-05-17T15:23:38.662137 | 2014-06-09T05:31:19 | 2014-06-09T05:31:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 48 | swift | numbers.map({ i in 3 * i })
println(numbers)
| [
-1
] |
cf1f6065eba65f36262c9909359fc1176a33aae8 | f2a00feec002ee812520029f1f1c932dea83fc07 | /13-locations-beacons/starter/RazeAd/ui/BillboardViewController.swift | 15a6a8a0342b6d7c711add4e353f87cd0bd19fbc | [] | no_license | threadLord/ARKit | 93abca15709f221a845cd6dd9dd25d7872663a7f | 1da6cdd0400ea75e7be4c25846847c7eccbb1784 | refs/heads/master | 2020-07-31T00:08:57.100285 | 2019-09-23T17:22:50 | 2019-09-23T17:22:50 | 210,410,341 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,956 | swift | /**
* Copyright (c) 2018 Razeware LLC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* Notwithstanding the foregoing, you may not use, copy, modify, merge, publish,
* distribute, sublicense, create a derivative work, and/or sell copies of the
* Software in any work that is designed, intended, or marketed for pedagogical or
* instructional purposes related to programming, coding, application development,
* or information technology. Permission for such use, copying, modification,
* merger, publication, distribution, sublicensing, creation of derivative works,
* or sale is expressly withheld.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
import UIKit
import ARKit
private enum Section: Int {
case images = 1
case video = 0
case webBrowser = 2
}
private enum Cell: String {
case cellWebBrowser
case cellVideo
case cellImage
}
class BillboardViewController: UICollectionViewController {
var sceneView: ARSCNView?
var billboard: BillboardContainer?
weak var mainViewController: AdViewController?
weak var mainView: UIView?
var images: [String] = ["logo_1", "logo_2", "logo_3", "logo_4", "logo_5"]
let doubleTapGesture = UITapGestureRecognizer()
override func viewDidLoad() {
super.viewDidLoad()
doubleTapGesture.numberOfTapsRequired = 2
doubleTapGesture.addTarget(self, action: #selector(didDoubleTap))
view.addGestureRecognizer(doubleTapGesture)
}
@objc func didDoubleTap() {
guard let billboard = billboard else { return }
if billboard.isFullScreen {
restoreFromFullScreen()
} else {
showFullScreen()
}
}
}
// UICollectionViewDelegate
extension BillboardViewController {
}
// UICollectionViewDataSource
extension BillboardViewController {
override func numberOfSections(in collectionView: UICollectionView) -> Int {
return 3
}
override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
guard let currentSection = Section(rawValue: section) else { return 0 }
switch currentSection {
case .images:
return images.count
case .video:
return 1
case .webBrowser:
return 1
}
}
override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
guard let currentSection = Section(rawValue: indexPath.section) else { fatalError("Unexpected collection view section") }
let cellType: Cell
switch currentSection {
case .images:
cellType = .cellImage
case .video:
cellType = .cellVideo
case .webBrowser:
cellType = .cellWebBrowser
}
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: cellType.rawValue, for: indexPath)
switch cell {
case let imageCell as ImageCell:
let image = UIImage(named: images[indexPath.row])!
imageCell.show(image: image)
case let videoCell as VideoCell:
let videoUrl = "https://www.rmp-streaming.com/media/bbb-360p.mp4"
if let sceneView = sceneView, let billboard = billboard {
videoCell.configure(videoUrl: videoUrl, sceneView: sceneView, billboard: billboard)
}
break
case let webBrowserCell as WebBrowserCell:
webBrowserCell.go(to: "https://www.raywenderlich.com")
default:
fatalError("Unrecognized cell")
}
return cell
}
}
extension BillboardViewController: UICollectionViewDelegateFlowLayout {
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
return collectionView.bounds.size
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets {
return .zero
}
}
extension BillboardViewController {
func showFullScreen() {
guard let billboard = billboard else { return }
guard billboard.isFullScreen == false else { return }
guard let mainViewController = parent as? AdViewController else { return }
self.mainViewController = mainViewController
mainView = view.superview
willMove(toParent: nil)
view.removeFromSuperview()
removeFromParent()
willMove(toParent: mainViewController)
mainViewController.view.addSubview(view)
mainViewController.addChild(self)
billboard.isFullScreen = true
}
func restoreFromFullScreen() {
guard let billboard = billboard else { return }
guard billboard.isFullScreen == true else { return }
guard let mainViewController = mainViewController else { return }
guard let mainView = mainView else { return }
willMove(toParent: nil)
view.removeFromSuperview()
removeFromParent()
willMove(toParent: mainViewController)
mainView.addSubview(view)
mainViewController.addChild(self)
billboard.isFullScreen = false
self.mainViewController = nil
self.mainView = nil
}
}
| [
-1
] |
67ec9cd6bbfe936463987c186d0d119636c4c529 | 9856fdfe38a4b79a8b43f0719a9a5dd2aed179ff | /Example/Pods/WDPRCore/Pod/Classes/WDPRUIKit/CustomUIViews/WDPRTabCollectionViewCell.swift | 86d6744a1814fc92bb85184119dbb44654fa9517 | [
"MIT"
] | permissive | PaymentKit/HaviPayment | 297fec9f45a81cc5aa0a8e67737876c1c6490494 | 14b7e099161b918cf5b10393b876eca4a03be94b | refs/heads/master | 2021-01-22T05:54:32.561316 | 2017-06-01T10:19:45 | 2017-06-01T10:19:45 | 92,505,497 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,079 | swift | //
// WDPRTabCollectionViewCell.swift
// DLR
//
// Created by german stabile on 9/9/15.
// Copyright (c) 2015 WDPRO. All rights reserved.
//
import UIKit
final class WDPRTabCollectionViewCell: UICollectionViewCell
{
static let cellReuseIdentifier: String = "TabCell"
var unselectedBackgroundColor: UIColor? {
didSet { update(if: !isSelected, view: self, withColor: unselectedBackgroundColor) }
}
var selectedBackgroundColor: UIColor? {
didSet { update(if: isSelected, view: self, withColor: selectedBackgroundColor) }
}
var unselectedIndicatorViewColor: UIColor? {
didSet { update(if: !isSelected, view: selectedIndicatorView, withColor: unselectedIndicatorViewColor) }
}
var selectedIndicatorViewColor: UIColor? {
didSet { update(if: isSelected, view: selectedIndicatorView, withColor: selectedIndicatorViewColor) }
}
var selectedTextStyle: WDPRTextStyle = .B1D {
didSet { update(if: isSelected, label: titleLabel, withStyle: selectedTextStyle) }
}
var unselectedTextStyle: WDPRTextStyle = .B1B {
didSet { update(if: !isSelected, label: titleLabel, withStyle: unselectedTextStyle) }
}
fileprivate var selectedIndicatorViewHeight : CGFloat = 4
fileprivate lazy var titleLabel: UILabel = self.initializeTitleLabel()
fileprivate lazy var selectedIndicatorView : UIView = self.initializeSelectedIndicatorView()
//MARK: View Life Cycle
override init(frame: CGRect) {
super.init(frame: frame)
configureViews()
isAccessibilityElement = true
}
required init(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)!
}
//MARK: Collection View Cell Methods
override var isSelected : Bool {
didSet {
selectedIndicatorView.backgroundColor = isSelected ?
selectedIndicatorViewColor :
unselectedIndicatorViewColor
titleLabel.apply(isSelected ? selectedTextStyle : unselectedTextStyle)
self.backgroundColor = isSelected ?
selectedBackgroundColor :
unselectedBackgroundColor
}
}
//MARK: Setters
func setTitle(_ text: String) {
titleLabel.text = text
}
}
//MARK: Private
private extension WDPRTabCollectionViewCell
{
//MARK: Lazy Initializers
func initializeTitleLabel() -> UILabel {
let label = UILabel()
label.translatesAutoresizingMaskIntoConstraints = false
label.textAlignment = .center
contentView.addSubview(label)
return label
}
func initializeSelectedIndicatorView() -> UIView {
let view = UIView()
view.translatesAutoresizingMaskIntoConstraints = false
view.backgroundColor = unselectedIndicatorViewColor
contentView.addSubview(view)
return view
}
//MARK: Views Configuration
func configureViews() {
backgroundColor = unselectedBackgroundColor
let views = ["titleLabel" : titleLabel,
"selectedIndicatorView" : selectedIndicatorView]
let metrics = ["indicatorViewHeight" : selectedIndicatorViewHeight]
addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "H:|[titleLabel]|", metrics: metrics, views: views))
addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "H:|[selectedIndicatorView]|", metrics: metrics, views: views))
addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "V:|[titleLabel][selectedIndicatorView(==indicatorViewHeight)]|", metrics: metrics, views: views))
}
func update(if needsUpdate: Bool, view: UIView!, withColor color: UIColor?) {
if needsUpdate {
view.backgroundColor = color
}
}
func update(if needsUpdate: Bool, label: UILabel!, withStyle style: WDPRTextStyle) {
if needsUpdate {
label.apply(style)
}
}
}
| [
-1
] |
d48a7f00994c7b70903a2a07e9c11bdb2ba5a504 | 099d31d41314a3c8293d5e0fa2730fd4fbd69c7c | /DLGMusicVisualizer/DLGMusicVisualizer/Visualizer/BaseVisualizer.swift | fe8dc0b1109f14111ee5e33775dbeb556b4c978b | [] | no_license | DeviLeo/DLGMusicVisualizer | fe442f935d04987d825c2252b5cdd09f79d41b92 | 54d39b47399dcbc0aeed2e2ba1a21097fe2fc5ec | refs/heads/master | 2021-01-19T21:52:10.606661 | 2017-03-04T11:21:33 | 2017-03-04T11:21:33 | 83,770,328 | 2 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,778 | swift | //
// BaseVisualizer.swift
// DLGMusicVisualizer
//
// Created by DeviLeo on 2017/3/4.
// Copyright © 2017年 DeviLeo. All rights reserved.
//
import UIKit
import AudioToolbox
import AVFoundation
class BaseVisualizer: UIView {
var player: AVAudioPlayer?
var channelNumbers: Array<Int> = [0]
var meterTable: MeterTable = MeterTable.init(minDecibels: -80.0)
var updateTimer: CADisplayLink?
var vertical: Bool = false
var useGL: Bool = false
override init(frame: CGRect) {
super.init(frame: frame)
self.doInit()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.doInit()
}
func registerNotifications() {
let nc = NotificationCenter.default
nc.addObserver(self, selector: #selector(self.stopTimer), name: .UIApplicationWillResignActive, object: nil)
nc.addObserver(self, selector: #selector(self.startTimer), name: .UIApplicationWillEnterForeground, object: nil)
}
func doInit() {
self.vertical = self.frame.size.width < self.frame.size.height
self.layoutVisualizer()
self.registerNotifications()
}
func layoutVisualizer() {
}
func refresh() {
}
func setPlayer(player: AVAudioPlayer?) {
if self.player == nil && player != nil {
if self.updateTimer != nil {
self.updateTimer?.invalidate()
}
self.updateTimer = CADisplayLink.init(target: self, selector: #selector(self.refresh))
self.updateTimer?.add(to: RunLoop.current, forMode: .defaultRunLoopMode)
}
self.player = player
if self.player != nil {
self.player?.isMeteringEnabled = true
let channelCount = (self.player?.numberOfChannels)!
if self.player?.numberOfChannels != self.channelNumbers.count {
var channels: Array<Int> = Array.init()
for i in 0 ..< channelCount {
channels.append(i)
}
self.setChannels(channels: channels)
}
}
}
func setChannels(channels: Array<Int>) {
self.channelNumbers = channels
self.layoutVisualizer()
}
func setUseGL(useGL: Bool) {
self.useGL = useGL
self.layoutVisualizer()
}
@objc func startTimer() {
if self.player != nil {
self.updateTimer = CADisplayLink.init(target: self, selector: #selector(self.refresh))
self.updateTimer?.add(to: RunLoop.current, forMode: .defaultRunLoopMode)
}
}
@objc func stopTimer() {
self.updateTimer?.invalidate()
self.updateTimer = nil
}
}
| [
-1
] |
175213eebf66b46c38210eb04dec328d81d4f526 | caae317ab49097cb9f390a5556e659e885d26f67 | /DrAtDoorStep/Model/PatientDataModel.swift | 6cb2d7938ec2170a2af2ed684beb8da579140625 | [] | no_license | fibonaccidesigning/DrAtDoorStep | d0feac55cb85c3236f4b249fe963101e3220fa62 | 64a14c4cad8bbff086203185b0dc345c481a41b9 | refs/heads/master | 2020-04-27T12:13:21.849296 | 2019-05-01T11:47:05 | 2019-05-01T11:47:05 | 174,324,596 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,023 | swift | //
// PatientDataModel.swift
// DrAtDoorStep
//
// Created by Parth Mandaviya on 08/03/19.
// Copyright © 2019 Parth Mandaviya. All rights reserved.
//
import Foundation
class PatientDataModel{
//MARK: - Patient
var NameDM = "name"
var AddressDM = "address"
var GenderDM = "gender"
var AreaDM = "area"
var AgeDM = "age"
var name : String?
var address : String?
var gender : String?
var area : String?
var age : String?
init(json: [String : Any?]) {
if let value = json[NameDM] as? String {
self.name = value
}
if let value = json[AddressDM] as? String {
self.address = value
}
if let value = json[GenderDM] as? String {
self.gender = value
}
if let value = json[AreaDM] as? String {
self.area = value
}
if let value = json[AgeDM] as? String {
self.age = value
}
}
}
| [
-1
] |
06eb6ceafad071dc4f89a7d0308eff765d54a1a1 | 4c1ac6be3cbd2f3851ab4cfd4d945522afb365fb | /BookStore/ViewControllers/BookInfoViewController.swift | 20c9d68477594769e777dd7456865c21e5d1c3af | [
"MIT"
] | permissive | bitrise-io/BookStore-iOS | 2a31c260256aea45ab40ba78d2cba369eb330050 | 136d8980062fe1fcd99eb96377fbb20712b84b98 | refs/heads/master | 2022-11-24T12:53:27.214007 | 2020-07-21T09:54:34 | 2020-07-21T09:54:34 | 281,344,762 | 1 | 2 | MIT | 2020-07-21T09:54:35 | 2020-07-21T08:47:55 | null | UTF-8 | Swift | false | false | 4,039 | swift | //
// BookInfoViewController.swift
// BookStore
//
// Created by Soojin Ro on 10/06/2019.
// Copyright © 2019 Soojin Ro. All rights reserved.
//
import UIKit
import BookStoreKit
final class BookInfoViewController: UIViewController {
static func instantiate(isbn13: String, bookStore: BookStoreService) -> BookInfoViewController {
let bookInfo = UIStoryboard.main.instantiateViewController(BookInfoViewController.self)
bookInfo.bookStore = bookStore
bookInfo.isbn13 = isbn13
return bookInfo
}
private(set) lazy var isbn13: String = unspecified()
override func viewDidLoad() {
super.viewDidLoad()
setupViews()
refreshInfo()
}
private func refreshInfo() {
activityIndicator?.startAnimating()
bookStore.fetchInfo(with: isbn13) { [weak self] (result) in
guard let self = self else { return }
self.activityIndicator?.stopAnimating()
result.success { self.bookInfo = $0 }
.catch(self.handle)
}
}
private func handle(_ error: Error) {
let alert = UIAlertController(title: error.localizedDescription, message: nil, preferredStyle: .alert)
let cancel = UIAlertAction(title: "Cancel", style: .cancel, handler: nil)
let retry = UIAlertAction(title: "Retry", style: .default) { [weak self] _ in
self?.refreshInfo()
}
alert.addActions([cancel, retry])
present(alert, animated: true, completion: nil)
}
private func setupViews() {
contentStackView?.isHidden = true
buyButton?.layer.cornerRadius = 8
buyButton?.layer.masksToBounds = true
}
private func layoutInfo() {
guard let info = bookInfo else { return }
titleLabel?.text = info.title
subtitleLabel?.text = info.subtitle
authorsLabel?.text = info.authors
priceLabel?.text = info.price
descriptionLabel?.text = info.shortDescription
publisherLabel?.text = info.publisher
yearLabel?.text = info.year
languageLabel?.text = info.language
lengthLabel?.text = info.pages
isbn10Label?.text = info.isbn10
isbn13Label?.text = info.isbn13
ratingLabel?.text = info.rating
if let thumbnailURL = info.thumbnailURL {
ImageProvider.shared.fetch(from: thumbnailURL) { [weak self] (result) in
self?.thumbnailImageView?.image = try? result.get()
}
}
contentStackView?.isHidden = false
}
@IBAction private func buyButtonTapped(_ sender: UIButton) {
if let url = bookInfo?.purchaseURL {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
}
@IBAction private func closeButtonTapped(_ sender: UIButton) {
dismiss(animated: true, completion: nil)
}
private var bookInfo: BookInfo? {
didSet {
layoutInfo()
}
}
private lazy var bookStore: BookStoreService = unspecified()
@IBOutlet private weak var contentStackView: UIStackView?
@IBOutlet private weak var activityIndicator: UIActivityIndicatorView?
@IBOutlet private weak var titleLabel: UILabel?
@IBOutlet private weak var subtitleLabel: UILabel?
@IBOutlet private weak var authorsLabel: UILabel?
@IBOutlet private weak var thumbnailImageView: UIImageView?
@IBOutlet private weak var priceLabel: UILabel?
@IBOutlet private weak var buyButton: UIButton?
@IBOutlet private weak var descriptionLabel: UILabel?
@IBOutlet private weak var publisherLabel: UILabel?
@IBOutlet private weak var yearLabel: UILabel?
@IBOutlet private weak var languageLabel: UILabel?
@IBOutlet private weak var lengthLabel: UILabel?
@IBOutlet private weak var isbn10Label: UILabel?
@IBOutlet private weak var isbn13Label: UILabel?
@IBOutlet private weak var ratingLabel: UILabel?
}
| [
-1
] |
c26bc91b9ff00fd5182f90af2bdc4ec9a221e9a8 | 36dca476978da825a5b1529b8088ae6874bfd141 | /Pokedex/movesCell.swift | bf88b07a7220b0860add9f56432d1f44333e8d84 | [] | no_license | dhullett08/pokedex | dd65b909432b256b9689860f71eba45335797981 | ee90791bf7a65b7075844b44285f491462398b52 | refs/heads/master | 2021-01-12T17:53:07.715164 | 2016-10-22T15:02:18 | 2016-10-22T15:02:18 | 71,286,502 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 336 | swift | //
// movesCell.swift
// Pokedex
//
// Created by Dustin Hullett on 10/22/16.
// Copyright © 2016 Dustin Hullett. All rights reserved.
//
import UIKit
class movesCell: UITableViewCell {
@IBOutlet weak var moveName: UILabel!
func configureCell(name: String) {
moveName.text = name
}
}
| [
-1
] |
3f74cc7c309a580f3f6e09f9f6484d8cb3496ca7 | 2d8bcdf6976cfd5bc21125fa2fb5c12667c2ce7c | /WeOwnTheNight/Constants/AppConstants/AppConstants.swift | 54058f7acf9d24ce16c18410222d492fa7775850 | [] | no_license | E-virtual/WeOwnTheNight | e99d90467737b4d8adc0e84fe033589f7037273e | d881e0421d43cae9b4ef4779830af90433eab0f1 | refs/heads/master | 2021-08-23T14:08:12.438003 | 2017-12-05T05:48:48 | 2017-12-05T05:48:48 | 113,136,738 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 8,484 | swift | //
// AppConstants.swift
// SwiftSamples
//
// Created by Nitin Kumar on 13/06/17.
// Copyright © 2017 Nitin Kumar. All rights reserved.
//
import Foundation
import UIKit
struct AppStore {
static let appID = "313719"
}
//MARK - Constant
struct APP_CONST {
static let build_name = "Wallopp"
static let kOK = "OK"
static let kCANCEL = "CANCEL"
static let kCAMERA = "Camera"
static let kGALARY = "Galary"
static let kLOGOUT_CONFIRMATION = "Are you sure you want to logout?"
static let kLOGOUT = "LOGOUT"
static let kREMOVE = "REMOVE"
static let kLOGIN = "LOGIN"
static let kNETWORK_ISSUE = "The Internet connection appears to be offline."
static let kFREATURE_NOT_IMPLIMENT = "This feature is not implemented yet."
static let kLOGIN_CONFIRM = "You’ve successfully logged in!"
static let kDEVICE_NOT_SUPPORT = "Your Device is not compatible with this features."
static let kMAKE_ADMIN = "MAKE ADMIN"
static let kEXIT = "EXIT"
}
struct APP_VALIDATION {
static let kMSG_EMPTY_FIELDS = "Fields can't be blank!"
static let kMSG_VALID_MAIL = "Please enter a valid Email ID!"
static let kMSG_NAME_LENGTH = "Name would be minimum 2 characters."
static let kMSG_ADDRESS_LENGTH = "Address would be minimum 2 characters.";
static let kMSG_PHONE_NUMBER = "Phone number would be 10 digits."
static let kMSG_MAIL_MISSMATCH = "E-mail address and confirm E-mail address is missmatch."
static let kMSG_PWD_LANGHT = "Password would be minimum 6 characters."
static let kMSG_CONFIRM_PWD = "Password and confirm password is missmatch!"
static let kMSG_COUNTRY_SELECT = "Please select a country first!"
static let kMSG_STATE_SELECT = "Please select a State first!"
static let kMSG_CITY_SELECT = "Please select a City first!"
static let kMSG_SUBJECT_LENGTH = "Subject would be minimum 2 characters.";
static let kMSG_TEACHER_NAME_LENGTH = "Teacher name would be minimum 2 characters.";
}
//MARK - StoryBoard identificatin constant
struct SB_ID {
static let SBI_WELCOME_VC = "WelcomeViewController"
static let SBI_LOGIN_VC = "LoginViewController"
static let SBI_REGISTER_VC = "RegisterViewController"
static let SBI_FORGOT_PWD_VC = "ForgotPasswordViewController"
static let SBI_DASHBOARD_VC = "DashboardViewController"
static let SBI_MENU_VC = "MenuViewController"
static let SBI_HELP_VC = "HelpViewController"
static let SBI_SETTINGS_VC = "SettingsViewController"
static let SBI_CHANGE_PWD_VC = "ChangePwdViewController"
static let SBI_EDIT_PROFILE_VC = "EditProfileViewController"
static let SBI_TERMCONDITIONS_VC = "TermCondtionsViewController"
static let SBI_ADD_SCHOOLS_VC = "AddASchoolViewController"
static let SBI_ADD_CHANGE_CLS_VC = "AddChnageClsViewController"
static let SBI_POPOVER_VC = "PopOverViewController"
static let SBI_POPOVER_ADD_CLS_VC = "PopUpAddClsViewController"
static let SBI_POPOVER_CLS_VC = "ClassPopupViewController"
static let SBI_STUDENT_LIST_VC = "StudentListViewController"
static let SBI_STUDENT_DETAILS_VC = "DetailsStudentViewController"
static let SBI_GROUP_CHAT_VC = "GroupChatViewController"
static let SBI_ADD_MEMBERS_VC = "AddMemberViewController"
static let SBI_GROUP_INFO_VC = "ShowGroupInfoViewController"
static let SBI_CREATE_GROUP = "CreateGroupViewController"
static let SBI_CHAT_VC = "ChatViewController"
static let SBI_CHAT_WITH_GRP_VC = "ChatWithGroupViewController"
static let SBI_GET_ALL_SCHOOL_VC = "GetAllSchoolsViewController"
static let SBI_ROOT_CHAT_VC = "RootChatViewController"
static let SBI_PRIVATE_CHAT_VC = "PrivateChatListViewController"
static let SBI_YOUR_SCHOOL_CLASSES_VC = "YourClassViewController"
static let SBI_CLASS_CURRENT_CHAT_VC = "CLassCurrentChatViewController"
static let SBI_CLASS_STUDENT_LIST_VC = "ClassStudentListViewController"
static let SBI_CLASS_CHAT_ROOT_VC = "ClassChatRootViewController"
static let SBI_SEND_INVITATION_VC = "SendInvitationViewController"
}
//MARK- COLOR CODE
struct COLOR_CODE {
static let NAVCOLOR = "#00C9FA"
static let COLOR_TXTBORDER = "#DCDCDC"
static let COLOR_LINE = "#BBBBBB"
static let COLOR_TEXTFIELD_BG = "#E4E4E4"
static let COLOR_REGISTER_BUTTON = "#FF3B55"
static let COLOR_TEXTFILED_PLACEHOLDER = "#D4D2D5"
static let COLOR_IMAGEVIEW_BORDER = "#4C4B56"
static let COLOR_EVEN_CELL = "#FFFFFF"
static let COLOR_ODD_CELL = "#F5F5F5"
static let COLOR_TEXTFIELD_SEARCH = "#FF3B55"
static let COLOR_INDICATOR = "#FA5667"
static let BACKGROUNDCOLOR = "#3DC2D5"
}
// MARK - Image name
struct IMG_NAME {
static let radio_select = "fill_radio.png"
static let radio_unselect = "blank_radio.png"
}
struct FONT {
static let kFONT_REGULAR = "Montserrat-Regular"
static let kFONT_BOLD = "Montserrat-Bold"
static let kFONT_MEDIUM = "Montserrat-SemiBold"
}
struct INSTRUCTION {
static let kINSTRUCTION_CLS_SCHOOL = "classListIntruction"
static let kINSTRUCTION_DASHBOARD = "dashboardIntruction"
}
enum AssetIdentifier: String
{
case chart = "pie-chart"
case Menu = "menu"
case Radio = "fill_radio"
case add = "add"
case background = "bg6"
}
struct Platform {
static let isSimulator: Bool = {
#if arch(i386) || arch(x86_64)
return true
#endif
return false
}()
}
enum UIUserInterfaceIdiom : Int
{
case Unspecified
case Phone
case Pad
}
struct ScreenSize
{
static let SCREEN_WIDTH = UIScreen.main.bounds.size.width
static let SCREEN_HEIGHT = UIScreen.main.bounds.size.height
static let SCREEN_MAX_LENGTH = max(ScreenSize.SCREEN_WIDTH, ScreenSize.SCREEN_HEIGHT)
static let SCREEN_MIN_LENGTH = min(ScreenSize.SCREEN_WIDTH, ScreenSize.SCREEN_HEIGHT)
}
struct DeviceType
{
static let IS_IPHONE_4_OR_LESS = UIDevice.current.userInterfaceIdiom == .phone && ScreenSize.SCREEN_MAX_LENGTH < 568.0
static let IS_IPHONE_5 = UIDevice.current.userInterfaceIdiom == .phone && ScreenSize.SCREEN_MAX_LENGTH == 568.0
static let IS_IPHONE_6 = UIDevice.current.userInterfaceIdiom == .phone && ScreenSize.SCREEN_MAX_LENGTH == 667.0
static let IS_IPHONE_6P = UIDevice.current.userInterfaceIdiom == .phone && ScreenSize.SCREEN_MAX_LENGTH == 736.0
static let IS_IPHONE_X = UIDevice.current.userInterfaceIdiom == .phone && ScreenSize.SCREEN_MAX_LENGTH == 812.0
static let IS_IPAD = UIDevice.current.userInterfaceIdiom == .pad && ScreenSize.SCREEN_MAX_LENGTH == 1024.0
}
| [
-1
] |
cfa8686c0b01cfe8eda3d6b74c11d086373754f5 | 5b9d20aad8226ec7d146c3894b630b5dd2b54eb1 | /FrameStepper/ViewController.swift | f04e0addbbed4135057b21fee75936a6d033d120 | [] | no_license | mani3/FrameStepper | c47114704e2c26b3ecb155527c5d4b8efbb082af | 27898cc5548558e597559de726f29d39940cecc2 | refs/heads/master | 2021-08-23T01:51:31.260192 | 2017-11-24T14:10:37 | 2017-11-24T14:10:37 | 107,988,731 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 555 | swift | //
// ViewController.swift
// FrameStepper
//
// Created by Kazuya Shida on 2017/10/23.
// Copyright © 2017 mani3. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
av_register_all()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
performSegue(withIdentifier: "MovieListSegue", sender: nil)
}
}
| [
-1
] |
8d9c17791b686dec9ddfacd12106d76ff98470eb | e3e3fabd6f26b36cb5ca9e583225622087c8cc0a | /Landmarks/Supporting Views/GraphCapsule.swift | b5d2d0327fb1b02f58cbf2b86f758751879e1b6c | [] | no_license | vcapretz/landmarks | f10374ff6fd713a1351dde7271be96a6509d539b | 1875b685bd0ac3ac3c7a1320c9c153d125e13687 | refs/heads/master | 2020-06-23T23:30:44.697303 | 2019-07-30T19:37:42 | 2019-07-30T19:37:42 | 198,785,069 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,140 | swift | //
// GraphCapsule.swift
// Landmarks
//
// Created by Vitor Capretz on 2019-07-25.
// Copyright © 2019 Vitor Capretz. All rights reserved.
//
import SwiftUI
struct GraphCapsule: View {
var index: Int
var height: Length
var range: Range<Double>
var overallRange: Range<Double>
var heightRadio: Length {
max(Length(magnitude(of: range) / magnitude(of: overallRange)), 0.15)
}
var offsetRatio: Length {
Length((range.lowerBound - overallRange.lowerBound) / magnitude(of: overallRange))
}
var animation: Animation {
Animation.spring(dampingFraction: 0.5)
.speed(2)
.delay(0.03 * Double(index))
}
var body: some View {
Capsule()
.fill(Color.white)
.frame(height: height * heightRadio, alignment: .bottom)
.offset(x: 0, y: height * -offsetRatio)
.animation(animation)
}
}
#if DEBUG
struct GraphCapsule_Previews: PreviewProvider {
static var previews: some View {
GraphCapsule(index: 0, height: 150, range: 10..<50, overallRange: 0..<100)
}
}
#endif
| [
-1
] |
a2c2473e41bf86fb40f146a1c09658a5a1e4c054 | 353c5b96ed90fd505d0a1280388d7fb3a0b2e0bb | /User.swift | f761627b9f614066586871629206c09616291b21 | [] | no_license | kerianne16/ios-guided-project-starter-animal-spotter-part-i | 3bcfe5b150270eb5d68ad093a78113038406ba89 | 8a064fe10c7578f2a16f7ad506597f528ad9bc22 | refs/heads/master | 2021-01-03T11:38:59.992317 | 2020-02-12T17:58:44 | 2020-02-12T17:58:44 | 240,067,335 | 0 | 0 | null | 2020-02-12T17:02:42 | 2020-02-12T17:02:41 | null | UTF-8 | Swift | false | false | 236 | swift | //
// User.swift
// AnimalSpotter
//
// Created by Keri Levesque on 2/12/20.
// Copyright © 2020 Lambda School. All rights reserved.
//
import Foundation
struct User: Codable {
let userName: String
let password: String
}
| [
-1
] |
3040a59cfcd00aad9d69c36aabca03f4d7a4d35b | 47b79111031914f12b10cd796dc9eae69484e88b | /Multy/Extensions/Blockchain+Extension.swift | d1bebb0e63074991e00000eeed0b832278265e04 | [
"LicenseRef-scancode-other-permissive"
] | permissive | ivlasov/Multy-IOS | bea80eb47d257a2a3de12e74e0fe9595605ff767 | 7a8c68718b4470678a69cf55826337cd451c61db | refs/heads/master | 2020-04-06T23:12:01.634343 | 2018-11-16T09:57:13 | 2018-11-16T09:57:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,864 | swift | //Copyright 2018 Idealnaya rabota LLC
//Licensed under Multy.io license.
//See LICENSE for details
import Foundation
//import MultyCoreLibrary
extension Blockchain {
static func blockchainFromString(_ string: String) -> Blockchain {
switch string {
case Constants.BlockchainString.bitcoinKey:
return BLOCKCHAIN_BITCOIN
case Constants.BlockchainString.ethereumKey:
return BLOCKCHAIN_ETHEREUM
default:
return BLOCKCHAIN_BITCOIN
}
}
var multiplyerToMinimalUnits: BigInt {
get {
switch self {
case BLOCKCHAIN_BITCOIN:
return Constants.BigIntSwift.oneBTCInSatoshiKey
case BLOCKCHAIN_ETHEREUM:
return Constants.BigIntSwift.oneETHInWeiKey
default:
return BigInt("0")
}
}
}
var dividerFromCryptoToFiat: BigInt {
get {
switch self {
case BLOCKCHAIN_BITCOIN:
return Constants.BigIntSwift.oneCentiBitcoinInSatoshiKey
case BLOCKCHAIN_ETHEREUM:
return Constants.BigIntSwift.oneHundredFinneyKey
default:
return BigInt("0")
}
}
}
var shortName : String {
var shortName = ""
switch self {
case BLOCKCHAIN_BITCOIN:
shortName = "BTC"
case BLOCKCHAIN_LITECOIN:
shortName = "LTC"
case BLOCKCHAIN_DASH:
shortName = "DASH"
case BLOCKCHAIN_ETHEREUM:
shortName = "ETH"
case BLOCKCHAIN_ETHEREUM_CLASSIC:
shortName = "ETC"
case BLOCKCHAIN_STEEM:
shortName = "STEEM"
case BLOCKCHAIN_BITCOIN_CASH:
shortName = "BCH"
case BLOCKCHAIN_BITCOIN_LIGHTNING:
shortName = "LBTC"
case BLOCKCHAIN_GOLOS:
shortName = "GOLOS"
case BLOCKCHAIN_BITSHARES:
shortName = "BTS"
case BLOCKCHAIN_ERC20:
shortName = "ERC20"
default:
shortName = ""
}
return shortName
}
var fullName : String {
var fullName = ""
switch self {
case BLOCKCHAIN_BITCOIN:
fullName = "Bitcoin"
case BLOCKCHAIN_LITECOIN:
fullName = "Litecoin"
case BLOCKCHAIN_DASH:
fullName = "Dash"
case BLOCKCHAIN_ETHEREUM:
fullName = "Ethereum"
case BLOCKCHAIN_ETHEREUM_CLASSIC:
fullName = "Ethereum Classic"
case BLOCKCHAIN_STEEM:
fullName = "Steem Dollars"
case BLOCKCHAIN_BITCOIN_CASH:
fullName = "Bitcoin Cash"
case BLOCKCHAIN_BITCOIN_LIGHTNING:
fullName = "Bitcoin lightning"
case BLOCKCHAIN_GOLOS:
fullName = "Golos"
case BLOCKCHAIN_BITSHARES:
fullName = "BitShares"
case BLOCKCHAIN_ERC20:
fullName = "ERC20 Tokens"
default:
fullName = ""
}
return fullName
}
var qrBlockchainString : String {
var fullName = ""
switch self {
case BLOCKCHAIN_BITCOIN:
//https://github.com/bitcoin/bips/blob/master/bip-0021.mediawiki
fullName = Constants.BlockchainString.bitcoinKey
case BLOCKCHAIN_LITECOIN:
fullName = "litecoin"
case BLOCKCHAIN_DASH:
fullName = "dash"
case BLOCKCHAIN_ETHEREUM:
fullName = Constants.BlockchainString.ethereumKey
case BLOCKCHAIN_ETHEREUM_CLASSIC:
fullName = ""
case BLOCKCHAIN_STEEM:
fullName = ""
case BLOCKCHAIN_BITCOIN_CASH:
fullName = ""
case BLOCKCHAIN_BITCOIN_LIGHTNING:
fullName = ""
case BLOCKCHAIN_GOLOS:
fullName = ""
case BLOCKCHAIN_BITSHARES:
fullName = ""
case BLOCKCHAIN_ERC20:
fullName = ""
default:
fullName = ""
}
return fullName
}
var maxLengthForSum: Int {
var maxLenght = 0
switch self {
case BLOCKCHAIN_BITCOIN:
maxLenght = 12
case BLOCKCHAIN_LITECOIN:
maxLenght = 0
case BLOCKCHAIN_DASH:
maxLenght = 0
case BLOCKCHAIN_ETHEREUM:
maxLenght = 12
case BLOCKCHAIN_ETHEREUM_CLASSIC:
maxLenght = 0
case BLOCKCHAIN_STEEM:
maxLenght = 0
case BLOCKCHAIN_BITCOIN_CASH:
maxLenght = 0
case BLOCKCHAIN_BITCOIN_LIGHTNING:
maxLenght = 0
case BLOCKCHAIN_GOLOS:
maxLenght = 0
case BLOCKCHAIN_BITSHARES:
maxLenght = 0
case BLOCKCHAIN_ERC20:
maxLenght = 0
default:
maxLenght = 0
}
return maxLenght
}
var maxPrecision: Int {
var maxLenght = 0
switch self {
case BLOCKCHAIN_BITCOIN:
maxLenght = 8
case BLOCKCHAIN_LITECOIN:
maxLenght = 0
case BLOCKCHAIN_DASH:
maxLenght = 0
case BLOCKCHAIN_ETHEREUM:
maxLenght = 18
case BLOCKCHAIN_ETHEREUM_CLASSIC:
maxLenght = 0
case BLOCKCHAIN_STEEM:
maxLenght = 0
case BLOCKCHAIN_BITCOIN_CASH:
maxLenght = 0
case BLOCKCHAIN_BITCOIN_LIGHTNING:
maxLenght = 0
case BLOCKCHAIN_GOLOS:
maxLenght = 0
case BLOCKCHAIN_BITSHARES:
maxLenght = 0
case BLOCKCHAIN_ERC20:
maxLenght = 0
default:
maxLenght = 0
}
return maxLenght
}
}
| [
-1
] |
cb822616d460810797afd789d90b369e5c9d6172 | eb2695672965c5934eb7c754fd997540e853ab9d | /WTKitTester/Classes/WebImageViewController.swift | 358c5cca318bd80b61bedc608d54d41f3c224cfe | [
"MIT"
] | permissive | songwentong/WTKitTester | 45769fa9f2b7b1dab3e38c3266ef73cedab834af | 5604ed05e585cd2e117b6d1c67619e3391986da9 | refs/heads/master | 2020-08-27T22:26:58.040856 | 2019-10-25T09:57:11 | 2019-10-25T09:57:11 | 217,504,959 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 994 | swift | //
// WebImageViewController.swift
// WTKitTester
//
// Created by 宋文通 on 2019/10/24.
// Copyright © 2019 宋文通. All rights reserved.
//
import UIKit
import WTKit
class WebImageViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
}
extension WebImageViewController:UITableViewDataSource{
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return ImageLoader.sampleImageURLs.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
if let iv = cell.contentView.viewWithTag(1) as? WebImageView{
iv.image = nil
iv.loadWebImage(with: ImageLoader.sampleImageURLs[indexPath.row].absoluteString)
}
return cell
}
}
| [
-1
] |
3aa2d8b8ae5c36d5226977a6972865db016f4ca7 | 3f3f67529e4b9e5d6effeaddff1f187817a7076e | /Pursuit-Core-iOS-Episodes-from-Online/Pursuit-Core-iOS-Episodes-from-Online/Models/ImageModel.swift | 80e4dad3793fe9ed9161e79046633165da4ae5ec | [] | no_license | MarielJHoepelman/Pursuit-Core-iOS-EpisodesFromOnline-HW | a99460a38650ebe6dfa4b118ad8fa02f5eaf41ac | 463be8d3e66803cc76df4a6340f485667c239bed | refs/heads/master | 2020-07-23T16:56:39.422206 | 2019-09-13T11:03:38 | 2019-09-13T11:03:38 | 207,638,193 | 0 | 0 | null | 2019-09-10T18:49:36 | 2019-09-10T18:49:36 | null | UTF-8 | Swift | false | false | 269 | swift | //
// ImageModel.swift
// Pursuit-Core-iOS-Episodes-from-Online
//
// Created by Mariel Hoepelman on 9/12/19.
// Copyright © 2019 Benjamin Stone. All rights reserved.
//
import Foundation
struct Image: Codable {
let medium: String
let original: String
}
| [
-1
] |
a0da1ed7867feeac132ce4dbf2c3495227e8356c | 5d192b76a4d6bd326377206c4dd423eeacf01604 | /Spotify/Managers/AuthManager.swift | 82a4d7b934b2ce0731ff7d84680852fbd805d137 | [
"MIT"
] | permissive | rmznaev/Spotify | efd5d3bbe6f529f4c100b031e3b1b5b6fceee9f6 | d6c726fc41c80f41882c983cb3bb1dfa6c5d2644 | refs/heads/main | 2023-04-17T10:54:15.950515 | 2021-04-27T13:14:50 | 2021-04-27T13:14:50 | 357,777,715 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 7,115 | swift | //
// AuthManager.swift
// Spotify
//
// Created by Ramazan Abdullayev on 15.04.21.
//
import Foundation
final class AuthManager {
static let shared = AuthManager()
private var refreshingToken = false
struct Constants {
static let clientID = "91a887304cf64881b90e2139bdd18953"
static let clientSecret = "9cf357712d34480d8772054cc9855243"
static let tokenAPIURL = "https://accounts.spotify.com/api/token"
static let redirectURI = "https://www.iosacademy.io"
static let scopes = "user-read-private%20playlist-modify-public%20playlist-read-private%20playlist-modify-private%20user-follow-read%20user-library-modify%20user-library-read%20user-read-email"
}
private init() {}
public var signInURL: URL? {
let baseURL = "https://accounts.spotify.com/authorize"
let string = "\(baseURL)?response_type=code&client_id=\(Constants.clientID)&scope=\(Constants.scopes)&redirect_uri=\(Constants.redirectURI)&show_dialog=TRUE"
return URL(string: string)
}
var isSignedIn: Bool {
return accessToken != nil
}
private var accessToken: String? {
return UserDefaults.standard.string(forKey: "access_token")
}
private var refreshToken: String? {
return UserDefaults.standard.string(forKey: "refresh_token")
}
private var tokenExpirationDate: Date? {
return UserDefaults.standard.object(forKey: "expirationDate") as? Date
}
private var shouldRefreshToken: Bool {
guard let expirationDate = tokenExpirationDate else { return false}
let currentDate = Date()
let fiveMinutes: TimeInterval = 300
return currentDate.addingTimeInterval(fiveMinutes) >= expirationDate
}
public func exchangeCodeForToken(code: String, completion: @escaping ((Bool) -> Void)) {
// Get token
guard let url = URL(string: Constants.tokenAPIURL) else { return }
var components = URLComponents()
components.queryItems = [
URLQueryItem(name: "grant_type",
value: "authorization_code"),
URLQueryItem(name: "code",
value: code),
URLQueryItem(name: "redirect_uri",
value: Constants.redirectURI)
]
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("application/x-www-form-urlencoded",
forHTTPHeaderField: "Content-Type")
request.httpBody = components.query?.data(using: .utf8)
let basicToken = Constants.clientID+":"+Constants.clientSecret
let data = basicToken.data(using: .utf8)
guard let base64String = data?.base64EncodedString() else {
print("failure to get base64")
completion(false)
return
}
request.setValue("Basic \(base64String)",
forHTTPHeaderField: "Authorization")
let task = URLSession.shared.dataTask(with: request) { [weak self] data, _, error in
guard let data = data, error == nil else {
completion(false)
return
}
do {
let result = try JSONDecoder().decode(AuthResponse.self, from: data)
self?.cacheToken(result: result)
completion(true)
}
catch {
print("ERROR: \(error.localizedDescription)")
completion(false)
}
}
task.resume()
}
private var onRefreshBlocks = [(String) -> Void]()
/// Supplies valid token to be used with API Calls
public func withValidToken(completion: @escaping (String) -> Void) {
guard !refreshingToken else {
// Append the completion
onRefreshBlocks.append(completion)
return
}
if shouldRefreshToken {
// Refresh
refreshIfNeeded { [weak self] success in
if let token = self?.accessToken, success {
completion(token)
}
}
} else if let token = accessToken {
completion(token)
}
}
public func refreshIfNeeded(completion: ((Bool) -> Void)?) {
guard !refreshingToken else {
return
}
guard shouldRefreshToken else {
completion?(true)
return
}
guard let refreshToken = self.refreshToken else { return }
guard let url = URL(string: Constants.tokenAPIURL) else { return }
refreshingToken = false
var components = URLComponents()
components.queryItems = [
URLQueryItem(name: "grant_type",
value: "refresh_token"),
URLQueryItem(name: "refresh_token",
value: refreshToken)
]
// Refresh the token
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("application/x-www-form-urlencoded",
forHTTPHeaderField: "Content-Type")
request.httpBody = components.query?.data(using: .utf8)
let basicToken = Constants.clientID+":"+Constants.clientSecret
let data = basicToken.data(using: .utf8)
guard let base64String = data?.base64EncodedString() else {
print("failure to get base64")
completion?(false)
return
}
request.setValue("Basic \(base64String)",
forHTTPHeaderField: "Authorization")
let task = URLSession.shared.dataTask(with: request) { [weak self] data, _, error in
self?.refreshingToken = false
guard let data = data, error == nil else {
completion?(false)
return
}
do {
let result = try JSONDecoder().decode(AuthResponse.self, from: data)
self?.onRefreshBlocks.forEach { $0(result.access_token) }
self?.onRefreshBlocks.removeAll()
self?.cacheToken(result: result)
completion?(true)
}
catch {
print("ERROR: \(error.localizedDescription)")
completion?(false)
}
}
task.resume()
}
private func cacheToken(result: AuthResponse) {
UserDefaults.standard.set(result.access_token,
forKey: "access_token")
if let refreshToken = result.refresh_token {
UserDefaults.standard.set(refreshToken,
forKey: "refresh_token")
}
UserDefaults.standard.set(Date().addingTimeInterval(TimeInterval(result.expires_in)),
forKey: "expirationDate")
}
}
| [
358927
] |
fb34770eaafc1c3fd40effbe8001dc99ecbcd699 | 571f8b380f691c3812b34352ed85df3639876add | /ViewControllerPokedex.swift | 96dd214994797ccc1227080d200a7e45f2eda64e | [] | no_license | dmorenoar/TableViewTabBar | 628c49898825f869350a2f324546fb560c1ad0b3 | db216c112c35713826644ce743230eead48e1678 | refs/heads/master | 2020-04-12T20:44:54.921958 | 2018-12-22T12:15:57 | 2018-12-22T12:15:57 | 162,741,623 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,988 | swift | //
// ViewControllerPokedex.swift
// TableViewTabBar
//
// Created by dmorenoar on 22/12/18.
// Copyright © 2018 DAM. All rights reserved.
//
import UIKit
class ViewControllerPokedex: UIViewController, UITableViewDelegate, UITableViewDataSource {
var arrayPokemons = [Pokemon]()
var tools:Tools = Tools()
let url = URL(string: "https://private-5ec35-pokemonswift.apiary-mock.com/pokemons")
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
print("Hay...",arrayPokemons.count)
return arrayPokemons.count
}
var imagen:UIImage = UIImage()
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let myCell = tableView.dequeueReusableCell(withIdentifier: "myCell", for: indexPath) as! TableViewCellPokedex
myCell.namePokemon.text = arrayPokemons[indexPath.row].nombre
myCell.typePokemon.text = arrayPokemons[indexPath.row].tipo
tools.getImage(imagenURL: arrayPokemons[indexPath.row].imagen) { (imgRecovered) -> Void in
if let imagen = imgRecovered {
DispatchQueue.main.async {
myCell.imgPokemon.image = imagen
return
}
}
}
myCell.typeImgPokemon.image = tools.getTypeImage(type: arrayPokemons[indexPath.row].tipo)
return myCell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 120
}
@IBOutlet weak var tableView: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
tableView.delegate = self
tableView.dataSource = self
decodeJsonData(url: url!)
}
func decodeJsonData(url:URL){
URLSession.shared.dataTask(with: url) { (data, response, error) in
guard let data = data else { return }
do {
let decoder = JSONDecoder()
self.arrayPokemons = try decoder.decode([Pokemon].self, from: data)
print("recojo de api",self.arrayPokemons.count)
DispatchQueue.main.async {
self.tableView.reloadData()
}
} catch let err {
print("Err", err)
}
}.resume()
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/
}
| [
-1
] |
936e681a33cb1b348d9712ca257019e84c137233 | 370c22238cb95753c567860c7a4ebb64376cf371 | /UITableView/FacebookMe/FacebookMe/MeViewController.swift | 787d476600f45db794467a360e301d386fe97467 | [] | no_license | Germtao/SwiftThirtyProjects | a8610a221b6bd8b39704fde755c52a9b929a87b8 | 24a41cf7e4417533fdf6b7816711639d6e4bcf8d | refs/heads/master | 2022-02-23T18:23:00.319697 | 2019-09-30T10:27:41 | 2019-09-30T10:27:41 | 112,555,244 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,960 | swift | //
// MeViewController.swift
// FacebookMe
//
// Created by QDSG on 2019/7/30.
// Copyright © 2019 unitTao. All rights reserved.
//
import UIKit
class MeViewController: BaseViewController {
typealias RowModel = [String: String]
private var user: User {
return User(name: "BayMax", education: "CMU")
}
private var dataSource: [[String: Any]] {
return TableKeys.populate(with: user)
}
private lazy var tableView: UITableView = {
let view = UITableView(frame: .zero, style: .grouped)
view.register(MeCell.self, forCellReuseIdentifier: MeCell.reuseIdentifier)
return view
}()
override func viewDidLoad() {
super.viewDidLoad()
setupUI()
}
}
extension MeViewController {
private func setupUI() {
title = "Facebook"
navigationController?.navigationBar.barTintColor = Specs.color.tint
tableView.delegate = self
tableView.dataSource = self
view.addSubview(tableView)
tableView.translatesAutoresizingMaskIntoConstraints = false
view.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "H:|-0-[tableView]-0-|",
options: .directionLeadingToTrailing,
metrics: nil,
views: ["tableView": tableView]))
view.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "V:|-0-[tableView]-0-|",
options: .directionLeadingToTrailing,
metrics: nil,
views: ["tableView": tableView]))
}
}
extension MeViewController: UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
return dataSource.count
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return rows(in: section).count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let modelForRow = rowModel(at: indexPath)
var cell = UITableViewCell()
guard let title = modelForRow[TableKeys.title] else { return cell }
if title == user.name {
cell = UITableViewCell(style: .subtitle, reuseIdentifier: nil)
} else {
cell = tableView.dequeueReusableCell(withIdentifier: MeCell.reuseIdentifier, for: indexPath)
}
cell.textLabel?.text = title
if let imageName = modelForRow[TableKeys.imageName] {
cell.imageView?.image = UIImage(named: imageName)
} else {
cell.imageView?.image = UIImage(named: Specs.imageName.placeholder)
}
if title == user.name {
cell.detailTextLabel?.text = modelForRow[TableKeys.subTitle]
}
return cell
}
func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
return titleForHeader(in: section)
}
}
extension MeViewController: UITableViewDelegate {
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
let modelForRow = rowModel(at: indexPath)
guard let title = modelForRow[TableKeys.title] else { return 0.0 }
if title == user.name {
return 64.0
} else {
return 44.0
}
}
func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
let modelForRow = rowModel(at: indexPath)
guard let title = modelForRow[TableKeys.title] else { return }
if title == TableKeys.seeMore ||
title == TableKeys.addFavorites {
cell.textLabel?.textColor = Specs.color.tint
cell.accessoryType = .none
} else if title == TableKeys.logout {
cell.textLabel?.centerXAnchor.constraint(equalTo: cell.centerXAnchor).isActive = true
cell.textLabel?.textColor = Specs.color.red
cell.textLabel?.textAlignment = .center
cell.accessoryType = .none
} else {
cell.accessoryType = .disclosureIndicator
}
}
}
// MARK: - Helper Functions
extension MeViewController {
private func rows(in section: Int) -> [Any] {
return dataSource[section][TableKeys.rows] as! [Any]
}
private func rowModel(at indexPath: IndexPath) -> RowModel {
return rows(in: indexPath.section)[indexPath.row] as! RowModel
}
private func titleForHeader(in section: Int) -> String? {
return dataSource[section][TableKeys.section] as? String
}
}
| [
-1
] |
9a7ebb97ddc133e511b2427c37d28e2dde68947b | e24c0e4da99518a07337d270de8eae338e6e2e89 | /PingPongChallenger/FirebaseService.swift | da9265c6842e57705e780bb95ac3a6ed30d66fcb | [] | no_license | eldercampanha/ping-pong-challenger | 6363671de9f651a12e962cf2693198e66cf673c0 | e636ed8fe24d7d443c60b2488c659d322946e8d7 | refs/heads/master | 2020-06-01T05:35:17.826702 | 2019-06-27T06:45:43 | 2019-06-27T06:45:46 | 190,658,046 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 182 | swift | //
// FirebaseService.swift
// PingPongChallenger
//
// Created by Elder-label on 2019-06-26.
// Copyright © 2019 Create Music Group. All rights reserved.
//
import Foundation
| [
-1
] |
d551f0afd53402c1f1410dd34477ef9867b1ed68 | 3d8ccb63120414e062c2f08491693119afe23212 | /twitter_alamofire_demo/ProfileViewController.swift | b57d3b535d8916e7c21281a1d6494ebae91445bd | [
"Apache-2.0"
] | permissive | Xueying-Wang/twitter | 09b48e7e2eff59f128827c150588c1f4563f4917 | 648c21ec1db0f81790774c97e358b7a9fee6eb8b | refs/heads/master | 2020-12-02T22:33:09.972711 | 2017-07-07T21:36:30 | 2017-07-07T21:36:30 | 96,149,340 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 6,497 | swift | //
// ProfileViewController.swift
// twitter_alamofire_demo
//
// Created by Xueying Wang on 7/5/17.
// Copyright © 2017 Charles Hieger. All rights reserved.
//
import UIKit
import AlamofireImage
class ProfileViewController: UIViewController,UITableViewDelegate, UITableViewDataSource, ComposeViewControllerDelegate {
@IBOutlet weak var avatarView: UIImageView!
@IBOutlet weak var nameLabel: UILabel!
@IBOutlet weak var screenNameLabel: UILabel!
@IBOutlet weak var followingCountLabel: UILabel!
@IBOutlet weak var followersCountLabel: UILabel!
@IBOutlet weak var backgroundImageView: UIImageView!
@IBOutlet weak var descriptionLabel: UILabel!
@IBOutlet weak var tableView: UITableView!
@IBOutlet weak var segmentedControl: UISegmentedControl!
var tweets: [Tweet] = []
var timeline: [Tweet] = []
var favorites: [Tweet] = []
let refreshControl = UIRefreshControl()
var user: User?
func fetchData(){
nameLabel.text = user!.name ?? "user"
screenNameLabel.text = "@" + (user!.screenName ?? "@user")
followingCountLabel.text = "\(user!.following_count ?? 0)"
followersCountLabel.text = "\(user!.followers_count ?? 0)"
descriptionLabel.text = user!.description
if user!.backgroundURL != nil {
backgroundImageView.af_setImage(withURL: user!.backgroundURL!)
}
avatarView.af_setImage(withURL: user!.avatarURL!)
avatarView.clipsToBounds = true
avatarView.layer.cornerRadius = 40
avatarView.layer.borderColor = UIColor(white: 1, alpha: 1).cgColor
avatarView.layer.borderWidth = 5
}
func fetchTweets(){
APIManager.shared.getUserTimeLine(of: user!) { (tweets, error) in
if let tweets = tweets {
self.timeline = tweets
self.tableView.reloadData()
self.refreshControl.endRefreshing()
} else if let error = error {
print("Error getting user timeline: " + error.localizedDescription)
}
}
APIManager.shared.getUserFavoriteList(of: user!) { (tweets, error) in
if let tweets = tweets {
self.favorites = tweets
self.tableView.reloadData()
self.refreshControl.endRefreshing()
} else if let error = error {
print("Error getting user favorite tweets: " + error.localizedDescription)
}
}
}
@IBAction func onSegmentedChange(_ sender: UISegmentedControl) {
let index = segmentedControl.selectedSegmentIndex
if index == 0 {
tweets = timeline
self.tableView.reloadData()
} else {
tweets = favorites
self.tableView.reloadData()
}
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
tableView.dataSource = self
tableView.delegate = self
tableView.rowHeight = UITableViewAutomaticDimension
tableView.estimatedRowHeight = 100
refreshControl.addTarget(self, action: #selector(refreshControlAction(_:)), for: UIControlEvents.valueChanged)
tableView.insertSubview(refreshControl, at: 0)
if user == nil {
user = User.current!
}
fetchData()
fetchTweets()
APIManager.shared.getUserTimeLine(of: user!) { (tweets, error) in
if let tweets = tweets {
self.timeline = tweets
self.tweets = tweets
self.tableView.reloadData()
self.refreshControl.endRefreshing()
} else if let error = error {
print("Error getting user timeline: " + error.localizedDescription)
}
}
tableView.reloadData()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func refreshControlAction(_ refreshControl: UIRefreshControl) {
fetchData()
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return tweets.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "TweetCell", for: indexPath) as! TweetCell
cell.tweet = tweets[indexPath.row]
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
}
func insertIntoTimeline(tweet: Tweet) {
tweets.insert(tweet, at: 0)
tableView.reloadData()
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "composeSegue" {
let composeViewController = segue.destination as! ComposeViewController
composeViewController.delegate = self
}
if segue.identifier == "detailSegue" {
let cell = sender as! UITableViewCell
if let indexPath = tableView.indexPath(for: cell){
let tweet = tweets[indexPath.row]
let detailViewController = segue.destination as! DetailViewController
detailViewController.tweet = tweet
}
}
if segue.identifier == "followerSegue" {
let navVC = segue.destination as! UINavigationController
let followerViewController = navVC.viewControllers.first as! FollowerViewController
followerViewController.user = user
}
if segue.identifier == "followingSegue" {
let navVC = segue.destination as! UINavigationController
let followingViewController = navVC.viewControllers.first as! FollowingViewController
followingViewController.user = user
}
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
| [
-1
] |
51add6bef8da3b23eca8db728f82bacee44b2293 | f59c1b682ecb22a3ba54af5ded781c6991760628 | /DPDSwift/DPDRequest.swift | 82c8b4adf8a3d314872acbe889fafb46c067b788 | [
"Apache-2.0"
] | permissive | vccabral/DPDSwift | 2a9b26a921579693a7dea4542baa3fbbdd59b939 | 451435bef96536a7479eb6742b77ab67fe741ccf | refs/heads/master | 2022-07-04T05:16:40.645724 | 2020-01-12T08:04:28 | 2020-01-12T08:04:28 | 263,461,657 | 0 | 0 | Apache-2.0 | 2020-05-12T22:00:15 | 2020-05-12T22:00:15 | null | UTF-8 | Swift | false | false | 10,707 | swift | //
// DPDRequest.swift
// DPDSwift
//
//Created by Sylveus, Steeven on 11/8/18.
//
import UIKit
public enum HTTPMethod: String {
case GET = "GET"
case POST = "POST"
case DELETE = "DELETE"
case PUT = "PUT"
}
let accessTokenHeaderFieldKey = "accessToken"
let sessionTokenKey = "SessionToken"
open class DPDRequest: NSObject {
static let sharedHelper = DPDRequest()
static var refreshTokenOperation: BackendOperation!
static var isRefreshTokenRefreshing = false
static let operationQueue: OperationQueue = {
var queue = OperationQueue()
return queue
}()
var rootUrl = ""
static var operations = [String: BackendOperation]()
static let API_TIME_OUT_PERIOD = 30.0
public class func requestWithURL(_ rootURL:String,
endPointURL: String?,
parameters: [String: Any]?,
method: HTTPMethod,
jsonString: String?,
cacheResponse: Bool? = false,
requestHeader: [String: AnyObject]? = nil,
andCompletionBlock compBlock: @escaping CompletionBlock) {
sharedHelper.rootUrl = rootURL
var urlString = rootURL + endPointURL!
if let param = parameters {
urlString = urlString + "?" + DPDHelper.toJsonString(param)!
}
print(urlString)
urlString = urlString.addingPercentEncoding(withAllowedCharacters: CharacterSet.urlQueryAllowed)!
let url = (URL(string: urlString))
var request: URLRequest?
if cacheResponse == true {
if DPDHelper.sharedHelper.networkReachable {
request = URLRequest(url: URL(string: urlString)!, cachePolicy: .returnCacheDataElseLoad, timeoutInterval: API_TIME_OUT_PERIOD)
} else {
request = URLRequest(url: URL(string: urlString)!, cachePolicy: .reloadIgnoringLocalCacheData, timeoutInterval: API_TIME_OUT_PERIOD)
}
} else {
request = URLRequest(url: url!)
}
request!.setValue("gzip", forHTTPHeaderField: "Accept-Encoding")
request!.addValue("application/json", forHTTPHeaderField: "Content-Type")
if let credential = DPDCredentials.sharedCredentials.accessToken {
request?.setValue(credential, forHTTPHeaderField: accessTokenHeaderFieldKey)
}
if let token = DPDHelper.getSessionId() {
request!.setValue(token, forHTTPHeaderField: "Cookie")
}
if let header = requestHeader {
for (key, value) in header {
request!.setValue(value as? String, forHTTPHeaderField: key)
}
}
request!.timeoutInterval = API_TIME_OUT_PERIOD
request!.httpMethod = method.rawValue
if let string = jsonString {
let postData = NSData(data: string.data(using: String.Encoding.utf8)!) as Data
request!.httpBody = postData
}
print(request?.allHTTPHeaderFields ?? "");
urlSessionFromRequest(request!, compBlock: compBlock)
}
class func urlSessionFromRequest(_ request: URLRequest, compBlock: @escaping CompletionBlock) {
var req = request
let operation = BackendOperation(session: URLSession.shared, request: request) { (data, response, error) -> Void in
if let httpResponse = response as? HTTPURLResponse {
switch httpResponse.statusCode {
case DPDConstants.expiredAccessTokenErrorCode
where DPDConstants.accessTokenRefreshEndPoint != nil:
if !isRefreshTokenRefreshing {
print("refreshtokenurl: \(request.url!)")
refreshAccessToken((request.url?.absoluteString)!, compBlock: { (response, responseHeader, error) -> Void in
if(error == nil) {
if let credential = DPDCredentials.sharedCredentials.accessToken {
req.setValue(credential, forHTTPHeaderField: accessTokenHeaderFieldKey)
}
} else {
compBlock(response, nil, error)
}
})
}
break
default:
if let url = request.url?.absoluteString {
operations.removeValue(forKey: url)
}
isRefreshTokenRefreshing = false
processJsonResponse(data, response: response, error: error, compBlock: compBlock)
break;
}
} else {
if let url = request.url?.absoluteString {
operations.removeValue(forKey: url)
}
isRefreshTokenRefreshing = false
processJsonResponse(data, response: response, error: error, compBlock: compBlock)
}
}
if refreshTokenOperation == nil || refreshTokenOperation.isFinished {
refreshTokenOperation = operation
}
if let url = request.url?.absoluteString {
operations[url] = operation
}
operationQueue.addOperation(operation)
print("\n\n \(operations)")
}
class func processJsonResponse(_ data: Data?, response: URLResponse?, error: Error?, compBlock: @escaping CompletionBlock) {
DispatchQueue.main.async {
print("\n\nPrinting Operations Count: \(operations.count)")
if error != nil {
compBlock(response, nil, error)
} else {
if error == nil {
var jsonData: Any? = nil
do {
jsonData = try JSONSerialization.jsonObject(with: data!, options: .allowFragments)
} catch {
print("Serialization Error: \(error)")
}
if let httpResponse = response as? HTTPURLResponse {
if httpResponse.statusCode == 200 || httpResponse.statusCode == 201 {
print("**Response***\n\(jsonData != nil ? jsonData! : [])")
compBlock(jsonData != nil ? jsonData! : [], httpResponse.allHeaderFields, error)
return
} else {
var message = ""
if let data = jsonData as? [String: AnyObject], let errorMessage = data["message"] as? String {
message = errorMessage
}
let error = NSError(domain: message, code: httpResponse.statusCode, userInfo: nil)
compBlock(jsonData, nil, error)
return
}
}
} else {
compBlock(response!, nil, error)
return
}
}
}
}
class func refreshAccessToken(_ forAPI: String, compBlock: @escaping CompletionBlock) {
print("***************** Refreshing Access Token ********************")
isRefreshTokenRefreshing = true
var urlString = sharedHelper.rootUrl + DPDConstants.accessTokenRefreshEndPoint!;
print(urlString);
urlString = urlString.addingPercentEncoding(withAllowedCharacters: CharacterSet.urlQueryAllowed)!
let url = (URL(string: urlString))
var request = URLRequest(url: url!)
request.timeoutInterval = API_TIME_OUT_PERIOD
request.httpMethod = HTTPMethod.GET.rawValue
request.setValue("gzip", forHTTPHeaderField: "Accept-Encoding")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
if let token = DPDHelper.getSessionId() {
request.setValue(token, forHTTPHeaderField: "Cookie")
}
let refreshOperation = BackendOperation(session: URLSession.shared, request: request) { (data, response, error) -> Void in
var jsonData: Any? = nil
do {
jsonData = try JSONSerialization.jsonObject(with: data!, options: .allowFragments)
} catch {
}
if let data = data {
do {
jsonData = try JSONSerialization.jsonObject(with: data, options: .allowFragments)
} catch {
compBlock (nil, nil, error)
return
}
}
if error == nil {
if let httpResponse = response as? HTTPURLResponse {
if httpResponse.statusCode == 200 {
if let response = jsonData as? [String: AnyObject] {
if let accessToken = response["accessToken"] as? String {
DPDCredentials.sharedCredentials.accessToken = accessToken
DPDCredentials.sharedCredentials.save()
}
refreshTokenOperation = nil
compBlock(jsonData, nil, error)
for (_, operation) in operations {
print("Remake request with new access token: \(String(describing: operation.request?.url))")
operation.start()
}
operations.removeAll()
}
} else {
let error = NSError(domain: "Unknown Error", code: httpResponse.statusCode, userInfo: nil)
compBlock(jsonData, nil, error)
return
}
}
}
}
if refreshTokenOperation == nil || refreshTokenOperation.isFinished {
refreshTokenOperation = refreshOperation
}
operationQueue.addOperation(refreshOperation)
}
}
| [
-1
] |
ba0dcdd96d45d472711dcd150b954e42d86e42d1 | e6fc0e65978d872b7dd158128754124416ee0fba | /RecordAndRecog/Protocols/Presentable.swift | fd8a75da1f30a6210aaef279d63b35bd6bfd6724 | [] | no_license | Lyine0924/RecordAndRecog | c94533a9bcc3c5d301848fece1d27f53702fab73 | 127ca105760e85907ac048b01eba3b70616278c6 | refs/heads/master | 2022-07-17T11:27:49.099935 | 2020-05-14T03:28:19 | 2020-05-14T03:28:19 | 203,084,896 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 473 | swift | //
// Presentable.swift
// RecordAndRecog
//
// Created by Myeong Soo on 2020/04/29.
// Copyright © 2020 Kiran Kumar. All rights reserved.
//
import Foundation
// 화면이동이 필요한 뷰 컨트롤러에서 사용할 프로토콜
public protocol Presentable {
associatedtype Presenter
var destination:Presenter {get} // 목적지 문자열을 저장할 프로퍼티 segue, storyboard 방식 모두에서 사용
func display(_ destination:String?)
}
| [
-1
] |
0beca8237e7a6b3dedabbb7e52bdf8a20ae4d245 | 18073bad3ec96c4b612436e905eb6373d38b358f | /MoviesViewer/MoviesViewer/ViewModel/DetailsViewModel.swift | a7b91b10fbb469601ff8be365e7e30cbe0fba1fb | [] | no_license | vishnumhn7/MoviesViewer_TestProj | 52000672e0e264391ffeb6309a96fd40a2f8c8c2 | d59b17c015d44db2243af0e13851ec62fc392a74 | refs/heads/main | 2023-04-11T08:37:47.946096 | 2021-04-22T07:49:24 | 2021-04-22T07:49:24 | 360,299,253 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,656 | swift | //
// DetailsViewModel.swift
// MoviesViewer
//
// Created by Mohan, Vishnu on 20/04/21.
//
import Foundation
import UIKit
protocol DetailsViewModelling {
func getSynopsis()
func getReviews()
func getCredits()
func getSimilarMovies()
var sections: Box<[DetailsSection]> { get set }
}
class DetailsViewModel: DetailsViewModelling {
var sections: Box<[DetailsSection]> = Box([])
private var networkManager: SourceManager
private var movieId: Int
init(networkManager: SourceManager, movieId: Int) {
self.networkManager = networkManager
self.movieId = movieId
}
func getSynopsis() {
networkManager.getSynopsis(id: movieId) { synopsis, error in
guard let synopsis = synopsis else { return }
let newSection = DetailsSection()
newSection.synopsis = [synopsis]
newSection.sectionType = .moviedetails
self.sections.value.insert(newSection, at: 0)
}
}
func getReviews() {
networkManager.getReviews(id: movieId) { (reviews, error) in
}
}
func getCredits() {
networkManager.getCredits(id: movieId) { (credits, error) in
}
}
func getSimilarMovies() {
networkManager.getSimilarMovies(id: movieId) { (similarMovies, error) in
guard let similarMovies = similarMovies else { return }
let newSection = DetailsSection()
newSection.sectionType = .similarMovies
newSection.similarMovies = similarMovies
self.sections.value.append(newSection)
}
}
}
| [
-1
] |
371718179747c411dc3216d977f668da516759d8 | a158602ba4bf8471f25e6093df747bb02a852dcc | /Swift_meipai/Swift_meipai/ViewController.swift | 57a6da049471b73278a169db965c423e1cc33df6 | [] | no_license | QA411/SwiftWithOC | ff59a743ee2de18c004ed71e4a4f7633bbf9309d | 93109f32a27d17957c8418a44baecb5d10a78a45 | refs/heads/master | 2021-01-20T04:21:58.607912 | 2017-04-28T07:36:54 | 2017-04-28T07:36:54 | 89,678,035 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,369 | swift | //
// ViewController.swift
// Swift_meipai
//
// Created by qq on 2017/2/1.
// Copyright © 2017年 fangxian. All rights reserved.
//
import UIKit
class ViewController: UIViewController,UITableViewDelegate,UITableViewDataSource,JKHTTPPageRefresDelegate {
@IBOutlet weak var tableView: UITableView!
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
APIAccountViewModel.shared().requestToLogin(withPhoneNumber: "13888445020", password: "123456", type: "1") { (resp, AccountModel, AccountAdditionalModel) in
if (resp?.isValid)!{
// print(resp?.originalData! ?? AnyObject.self)
print("2222", AccountModel!, AccountModel?.imgUrl ?? NSString(), AccountModel?.id ?? NSString()) // 模型数据的 输出
}
}
// print("getUserToken", AccountAdditionalModel.currentAccount().getUserToken())// 缓存数据的 输出
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
self.view.backgroundColor = UIColor.yellow;
// 注册Cell
let nib = UINib(nibName: "MainTableViewCell", bundle: nil)
self.tableView.register(nib, forCellReuseIdentifier: "MainTableViewCell")
// 挂上 上拉、下拉刷新 并开始请求第一页的数据
self.setUpRefresFooterControllWith(self.tableView, refresDelegate: self)
self.setUpRefresHeaderControllWith(self.tableView, refresDelegate: self)
let hiddenBool : Bool = true
self.setRefresControllFooterHidden(hiddenBool)
refresHeaderBeginRereshing()
}
//1.1默认返回一组
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1;
}
// 1.2 返回行数
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 55;
}
//1.3 返回行高
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat{
return 44;
}
// //1.4每组的头部高度
// func tableView(tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
// return 10;
// }
//
// //1.5每组的底部高度
// func tableView(tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
// return 1;
// }
//1.6 返回数据源
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "MainTableViewCell", for: indexPath as IndexPath) as! MainTableViewCell
cell.titleLabel.text = "titleLabeltitleLabeltitleLabel"
return cell
// var cell = tableView.dequeueReusableCell(withIdentifier: "MainTableViewCell")
// if (cell == nil)
// {
// cell = UITableViewCell(style: UITableViewCellStyle.default, reuseIdentifier: "MainTableViewCell")
// }
// cell?.textLabel?.text = "Storyboard"
// cell?.accessoryType=UITableViewCellAccessoryType.disclosureIndicator;
// return cell!
}
private func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: IndexPath)
{
}
// JKHTTPPageRefresDelegate
func refresHeaderBeginRereshing() {
self.standardPage = APIPageObject.init()
self.standardPage.requestPageIndex = 1;
requeseLoadList()
}
func refresFooterBeginRereshing() {
self.standardPage.requestPageIndex = self.standardPage.requestPageIndex + 1;//self.standardPage.currentPageIndex + 1;
requeseLoadList()
}
func requeseLoadList() {
// 接口请求放这里
let refreshBool : Bool = false
self.setRefresControllHeaderRefreshing(refreshBool)
self.setRefresControllFooterRefreshing(refreshBool)
self.setRefresControllFooterHidden(refreshBool)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
| [
-1
] |
98a1c78e7fd3f88f48dae14e81fb0de70cd167f2 | c91d4cb3ed286e54590281e8ea2e3a20f3d3a287 | /quiz-app-reito/Question.swift | 87c67be726553007286b97f57d508550c389ff52 | [] | no_license | reitokirihara/quiz-app-swift | fa48f0f90fd28f0340c136ccb58751e2ce11cf67 | 41d4166eb6d5fcc4c11939755a15b97d7d45f8a2 | refs/heads/master | 2021-04-15T07:25:37.182499 | 2018-03-24T20:00:14 | 2018-03-24T20:00:14 | 126,265,247 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 307 | swift | //
// Question.swift
// quiz-app-reito
//
// Created by UCode on 3/21/18.
// Copyright © 2018 UCode. All rights reserved.
//
import Foundation
class Question{
let question: String;
let answers: [Answer];
init(q:String, a:[Answer]){
question = q;
answers = a;
}
}
| [
-1
] |
3a9bab8f3fb13bc4f65f61bd803b3a5782967a03 | 380cad5e769a9c716eed4527129c56876f5254c3 | /DragnDropFileOperations/FileCollectionViewModel.swift | e238bec50cb8d6cbcba344e62e0d0c386f316f97 | [] | no_license | codergogoi/ios_file_drag_n_drop | dc9808c72f9afbd5a2e28ac2fee1c8cfae2d8865 | 1b58da256a5a4c029c6cc6816ab15390203e0dda | refs/heads/master | 2021-09-05T07:29:15.384941 | 2018-01-25T07:40:43 | 2018-01-25T07:40:43 | 118,878,711 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 865 | swift | //
// FileCollectionViewModel.swift
// DragnDropFileOperations
//
// Created by MAC01 on 24/01/18.
// Copyright © 2018 Jayanta Gogoi. All rights reserved.
//
import UIKit
struct FileStruct{
var fileName: UIImage?
}
class FileCollectionViewModel: NSObject {
var fileCollection: [FileStruct] = []
override init() {
super.init()
fileCollection.append(FileStruct(fileName: #imageLiteral(resourceName: "f1")))
fileCollection.append(FileStruct(fileName: #imageLiteral(resourceName: "f2")))
fileCollection.append(FileStruct(fileName: #imageLiteral(resourceName: "f3")))
fileCollection.append(FileStruct(fileName: #imageLiteral(resourceName: "f4")))
fileCollection.append(FileStruct(fileName: #imageLiteral(resourceName: "f5")))
}
}
| [
-1
] |
68fc4aba4b1cba1243c739fbe54ee52bdd593b44 | bc8933b68bb802f093e388552adb09476247a8c7 | /TMDBCase/TMDBCase/ViewModels/MovieDetailScreenViewModel.swift | 207bf5f8e554e4c630d3e22c4a75529a7e30db15 | [] | no_license | asuhasoft/TMDBCase | f2cf52ff4e0ef31f6aefc3aaf1e11a3822f3f5e0 | 61f684ae9feee271cf2a944d0df607d3ddebab84 | refs/heads/main | 2023-02-04T02:58:24.255676 | 2020-12-19T08:54:20 | 2020-12-19T08:54:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,072 | swift | //
// MovieDetailScreenViewModel.swift
// TMDBCase
//
// Created by AppLogist on 18.12.2020.
//
import Foundation
class MovieDetailScreenViewModel {
private let movieID: Int?
private let movieApi = BaseAPI<MovieTarget>()
var movie: Movie?
init(movieID: Int?) {
self.movieID = movieID
}
func cast(at index: Int) -> Person? { movie?.credits?.cast?[index] }
var castCount: Int { movie?.credits?.cast?.count ?? 0 }
func video(at index: Int) -> Video? { movie?.videos?.results?[index] }
var videosCount: Int { movie?.videos?.results?.count ?? 0 }
// MARK: - Service Calls
func getMovieDetail(completion: @escaping ErrorBlock) {
let request = QueryRequest(appendToResponse: [.videos,.credits], movieID: movieID)
movieApi.process(target: .details(request)) { (error) in
completion(error)
} success: { [weak self] (response: Movie) in
guard let self = self else { return }
self.movie = response
completion(nil)
}
}
}
| [
-1
] |
9309f9b309db9f8a9c708eaa14ca292177d4e109 | 0de2177aae2e421688aa67d32415ef20e5e8578c | /FinalDemo/Shared/Other/r1/remone/Source/Scenes/MyPage/EditInfo/EditSkillDetailVC.swift | 190612df6eb38bee6ddcf562caa6d1689c7bcf27 | [] | no_license | PujaGRathod/FinalDemo | a30e5f1b382da7d264701ce06ee6ee4ac9c67c25 | ddfa24c1184a096ee72c4ea4cab6b481173fd7a9 | refs/heads/master | 2020-08-27T16:46:08.764978 | 2019-10-25T02:40:47 | 2019-10-25T02:40:47 | 217,436,480 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,859 | swift | //
// EditSkillDetailVC.swift
// Remone_Office_Favorite
//
// Created by Arjav Lad on 17/01/18.
// Copyright © 2017 Inheritx. All rights reserved.
//
import UIKit
class EditSkillDetailVC: UITableViewController {
var skills : [RMSkill] = []
var reloadProfile: UserProfileReload?
@IBOutlet weak var btnComplete: UIBarButtonItem!
@IBOutlet weak var btnCancel: UIBarButtonItem!
override func viewDidLoad() {
super.viewDidLoad()
if let user = APIManager.shared.loginSession?.user {
self.skills = user.skills
}
self.tableView.reloadData()
}
override func viewWillAppear(_ animated: Bool) {
Analytics.shared.trackScreen(name: "Edit Skills")
super.viewWillAppear(animated)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
@IBAction func onCancelClick(_ sender: UIBarButtonItem) {
self.navigationController?.dismiss(animated: true, completion: nil)
}
@IBAction func onCompletedClick(_ sender: UIBarButtonItem) {
let skillIds = self.skills.map { $0.id }
self.showLoader()
APIManager.shared.updateUserSkills(with: skillIds) { (error) in
self.hideLoader()
if error != nil {
self.showAlert("Error".localized, message: error?.localizedDescription)
} else {
APIManager.shared.loginSession?.user.skills = self.skills
APIManager.shared.loginSession?.save()
self.reloadProfile?()
self.navigationController?.dismiss(animated: true, completion: nil)
}
}
}
override func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if section == 1 {
return 1
}
return self.skills.count + 1
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
let lbl = cell.viewWithTag(100) as! UILabel
if indexPath.row == self.skills.count {
lbl.text = "Add skill".localized
cell.accessoryType = .disclosureIndicator
cell.selectionStyle = .default
} else {
cell.accessoryType = .none
cell.selectionStyle = .none
lbl.text = self.skills[indexPath.row].name
}
return cell
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: false)
if indexPath.row == self.skills.count {
self.performSegue(withIdentifier: "segueShowSelectSkillsVC", sender: nil)
}
}
override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
if section == 1 {
return 0.0001
}
return 36
}
override func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return 0.001
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
if segue.identifier == "segueShowSelectSkillsVC" {
if let selectSkillvc = segue.destination as? SelectSkillsVC {
selectSkillvc.selectedSkills = self.skills
selectSkillvc.backClosure = { (selectedSkills) in
self.skills = selectedSkills
self.tableView.reloadData()
}
}
}
}
}
| [
-1
] |
1b2ee55360757406fba92b48ba2b9d2339158538 | 29b22bb61fd7adcf9095bb609290f45da6b964a4 | /watchkit Extension/BusesRowController.swift | baf6d47d3137cee11c8758cd45d87c01defe576b | [] | no_license | pond/bus_panda | 2e9878e8133028c9f8fe4af8b1a53c6a8f2f2f4f | 210303695c5f130475315e42c22764699b5ff09f | refs/heads/master | 2022-07-12T06:14:36.368501 | 2022-06-30T06:23:46 | 2022-06-30T06:23:46 | 49,165,926 | 3 | 0 | null | 2022-06-30T06:23:47 | 2016-01-06T22:34:39 | HTML | UTF-8 | Swift | false | false | 1,233 | swift | //
// BusesRowController.swift
// Bus Panda
//
// Created by Andrew Hodgkinson on 26/03/16.
// Copyright © 2016 Andrew Hodgkinson. All rights reserved.
//
import WatchKit
@available( iOS 8.2, * )
class BusesRowController: NSObject
{
@IBOutlet var nameLabel: WKInterfaceLabel!
@IBOutlet var timeLabel: WKInterfaceLabel!
@IBOutlet var numberLabel: WKInterfaceLabel!
@IBOutlet var numberBackgroundGroup: WKInterfaceGroup!
var busInfo: NSDictionary?
{
didSet
{
if let busInfo = busInfo
{
nameLabel.setText( busInfo[ "routeName" ] as? String )
timeLabel.setText( busInfo[ "dueTime" ] as? String )
let routeNumber = busInfo[ "routeNumber" ] as? String
var routeColour = busInfo[ "colour" ] as? String
if ( routeColour == nil )
{
routeColour = "888888"
}
let uiColor = RouteColours.colourFromHexString( routeColour! )
numberBackgroundGroup.setBackgroundColor( uiColor )
numberLabel.setText( routeNumber )
}
}
}
}
| [
-1
] |
e5ba77bf1dcb397e2fedc73c4184e730fb012a1c | fb65bcf8864eab5327818d27e44f82b07a02fed7 | /IOS8SwiftTableViewTutorial/CustomCell.swift | 4e6f193d63ee4706e0dcd7012ba15745d6517fe8 | [] | no_license | qx/GenericsTableView | 0b1379fadc0fa5fa7347677b021891e5be9ec646 | fa70d607fc92da8bd4c172ed22f966ca0bde0bdf | refs/heads/master | 2021-01-10T04:50:38.128969 | 2015-11-12T09:12:36 | 2015-11-12T09:12:36 | 46,041,793 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 795 | swift | //
// CustomCell.swift
// DynamicCellHeight
//
// Created by Carolina Barreiro Cancela on 30/04/15.
// Copyright (c) 2015 CarolinaBarreiro. All rights reserved.
//
import UIKit
class CustomCell: UITableViewCell {
// @IBOutlet weak var titleLabel: UILabel!
@IBOutlet weak var contentLabel: UILabel!
override func awakeFromNib() {
if Constants.Devices.iOS7 {
// http://www.raywenderlich.com/73602/dynamic-table-view-cell-height-auto-layout#comments
// You can´t use a explicit preferred width in the inspector if you want to support iOS8, therefore we need to do it programmatically for iOS7 devices so it works as expected. You can use the width of the screen, more or less.
// titleLabel.preferredMaxLayoutWidth = 510
contentLabel.preferredMaxLayoutWidth = 510
}
}
}
| [
-1
] |
f8502e935917a7ef16f7c3bf1c682add026cec6d | e7436f4a639994d0f216feb17a90108f69627eed | /SleepingBeauty/AppDelegate.swift | 6e8cd3a44229ed73d323159952f964cc5d39a62f | [] | no_license | ChristopherHimmel/Sleeping_Beauty | 68f6da3e5ac9fcb3f2c99f861be60a2e8f9c137c | fb0473c1b3e8a2e4a6384e3f64e66e9ed01125dd | refs/heads/master | 2021-04-15T13:01:05.524940 | 2018-04-09T16:46:58 | 2018-04-09T16:46:58 | 126,437,259 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,180 | swift | //
// AppDelegate.swift
// SleepingBeauty
//
// Created by Jane Appleseed on 10/17/16.
// Copyright © 2016 Apple Inc. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
| [
229380,
229383,
229385,
229388,
294924,
278542,
229391,
327695,
278545,
229394,
278548,
229397,
229399,
229402,
278556,
229405,
278559,
229408,
278564,
294950,
229415,
229417,
327722,
237613,
229422,
360496,
229426,
237618,
229428,
286774,
286776,
319544,
204856,
229432,
286778,
286791,
237640,
278605,
286797,
311375,
163920,
237646,
196692,
319573,
311383,
319590,
311400,
278635,
303212,
278639,
131192,
278648,
237693,
303230,
327814,
131209,
303241,
417930,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
131264,
286916,
286922,
286924,
286926,
319694,
286928,
131281,
278743,
278747,
295133,
155872,
319716,
237807,
303345,
286962,
303347,
131314,
229622,
327930,
278781,
278783,
278785,
237826,
319751,
278792,
286987,
319757,
311569,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
287032,
155966,
319809,
319810,
278849,
319814,
311623,
319818,
311628,
229709,
319822,
287054,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
319879,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
278980,
98756,
278983,
319945,
278986,
319947,
278990,
278994,
311767,
279003,
279006,
188895,
172512,
287202,
279010,
279015,
172520,
319978,
279020,
172526,
311791,
279023,
172529,
279027,
319989,
180727,
164343,
279035,
311804,
287230,
279040,
303617,
287234,
279045,
172550,
303623,
320007,
287238,
172552,
279051,
172558,
279055,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
279082,
311850,
279084,
172591,
172598,
279095,
172607,
172609,
172612,
377413,
172614,
213575,
172618,
303690,
33357,
287309,
303696,
279124,
172634,
262752,
172644,
311911,
189034,
295533,
172655,
172656,
352880,
189039,
295538,
172660,
189040,
189044,
287349,
287355,
287360,
295553,
295557,
311942,
303751,
287365,
352905,
311946,
279178,
287371,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
287390,
303773,
164509,
172705,
287394,
172702,
303780,
172707,
287398,
205479,
279208,
287400,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
328384,
279231,
287427,
312005,
312006,
107208,
107212,
172748,
287436,
172751,
287440,
295633,
172755,
303827,
279255,
172760,
287450,
303835,
279258,
189149,
303838,
213724,
279267,
312035,
295654,
279272,
312048,
230128,
312050,
230131,
205564,
303871,
230146,
295685,
328453,
230154,
33548,
312077,
295695,
295701,
230169,
369433,
295707,
328476,
295710,
230175,
295720,
303914,
279340,
205613,
279353,
230202,
312124,
328508,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
279390,
230241,
279394,
303976,
336744,
303981,
303985,
303987,
328563,
279413,
303991,
303997,
295806,
295808,
304005,
295813,
304007,
320391,
213895,
304009,
304011,
230284,
304013,
279438,
295822,
189329,
295825,
189331,
304019,
58262,
304023,
279452,
410526,
279461,
279462,
304042,
213931,
304055,
230327,
287675,
197564,
230334,
304063,
238528,
304065,
213954,
189378,
156612,
295873,
213963,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
312321,
295945,
295949,
230413,
197645,
320528,
140312,
295961,
238620,
197663,
304164,
304170,
304175,
238641,
312374,
238652,
238655,
230465,
238658,
296004,
132165,
336964,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
361576,
296040,
205931,
296044,
279661,
205934,
164973,
312432,
279669,
337018,
189562,
279679,
279683,
222340,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
165038,
238766,
230576,
238770,
304311,
230592,
312518,
279750,
230600,
230607,
148690,
320727,
279769,
304348,
279777,
304354,
296163,
320740,
279781,
304360,
320748,
279788,
279790,
304370,
296189,
320771,
312585,
296202,
296205,
230674,
320786,
230677,
296213,
296215,
320792,
230681,
230679,
214294,
304416,
230689,
173350,
312622,
296243,
312630,
222522,
296253,
222525,
296255,
312639,
230718,
296259,
378181,
296262,
230727,
296264,
238919,
320840,
296267,
296271,
222545,
230739,
312663,
337244,
222556,
230752,
312676,
230760,
173418,
410987,
230763,
230768,
296305,
312692,
230773,
304505,
181626,
304506,
181631,
312711,
312712,
296331,
288140,
288144,
230800,
304533,
337306,
288154,
288160,
173472,
288162,
288164,
279975,
304555,
370092,
279983,
173488,
288176,
279985,
312755,
296373,
312759,
337335,
288185,
279991,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
288210,
370130,
288212,
222676,
288214,
280021,
239064,
329177,
288217,
280027,
288220,
288218,
239070,
288224,
280034,
288226,
280036,
288229,
280038,
288230,
288232,
370146,
320998,
288234,
288236,
288238,
288240,
288242,
296435,
288244,
288250,
148990,
321022,
206336,
402942,
296450,
296446,
230916,
230919,
214535,
304651,
370187,
304653,
230923,
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,
116354,
280194,
280208,
280211,
288408,
280218,
280222,
190118,
198310,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
313027,
280260,
206536,
280264,
206539,
206541,
206543,
280276,
313044,
321239,
280283,
18140,
313052,
288478,
313055,
321252,
313066,
280302,
288494,
280304,
313073,
419570,
288499,
321266,
288502,
280314,
288510,
124671,
67330,
280324,
198405,
288519,
280331,
198416,
280337,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
296767,
288576,
345921,
280388,
304968,
280393,
280402,
173907,
313176,
280419,
321381,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280464,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
280487,
313258,
321458,
296883,
124853,
214966,
10170,
296890,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
239586,
313320,
231404,
124913,
165876,
321528,
313340,
239612,
288764,
239617,
313347,
288773,
313358,
305176,
321560,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
378941,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
149599,
280671,
149601,
321634,
223327,
149603,
329830,
280681,
313451,
223341,
280687,
215154,
313458,
280691,
149618,
313464,
329850,
321659,
280702,
288895,
321670,
215175,
141446,
288909,
141455,
141459,
280725,
313498,
100520,
288936,
280747,
288940,
280755,
288947,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
321740,
313548,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
157930,
280811,
280817,
125171,
157940,
280819,
182517,
280823,
280825,
280827,
280830,
280831,
280833,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
280888,
305464,
280891,
289087,
280897,
280900,
239944,
305480,
280906,
239947,
305485,
305489,
379218,
280919,
354653,
313700,
313705,
280937,
190832,
280946,
223606,
313720,
280956,
239997,
280959,
313731,
240011,
199051,
289166,
240017,
297363,
190868,
297365,
240021,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
305594,
289210,
281024,
289218,
289221,
289227,
281045,
281047,
215526,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
240132,
281095,
223752,
338440,
150025,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
281179,
338528,
338532,
281190,
199273,
281196,
158317,
19053,
313973,
297594,
281210,
158347,
133776,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
199364,
297671,
158409,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322314,
322318,
281361,
281372,
322341,
215850,
281388,
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,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
281567,
289762,
322534,
297961,
183277,
281581,
322550,
134142,
322563,
314372,
175134,
322599,
322610,
314421,
281654,
314427,
314433,
207937,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
289912,
248995,
306341,
306344,
306347,
322734,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
126190,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
257334,
216376,
298306,
380226,
224584,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
306555,
314747,
298365,
290171,
290174,
224641,
281987,
314756,
298372,
281990,
224647,
265604,
298377,
314763,
142733,
298381,
314768,
224657,
306581,
314773,
314779,
314785,
314793,
282025,
282027,
241068,
241070,
241072,
282034,
241077,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
290291,
282101,
241142,
191992,
290298,
151036,
290302,
282111,
290305,
175621,
306694,
192008,
323084,
257550,
290321,
282130,
323090,
282133,
290325,
241175,
290328,
282137,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
28219,
282186,
224849,
282195,
282199,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
324757,
282261,
298651,
323229,
282269,
298655,
323231,
61092,
282277,
306856,
282295,
323260,
282300,
323266,
282310,
323273,
282319,
306897,
241362,
306904,
282328,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
241450,
282410,
306988,
306991,
315184,
323376,
315190,
241464,
159545,
282425,
298811,
307009,
413506,
241475,
307012,
298822,
148946,
315211,
282446,
307027,
315221,
323414,
315223,
241496,
241498,
307035,
307040,
110433,
282465,
241509,
110438,
298860,
110445,
282478,
315249,
110450,
315251,
282481,
315253,
315255,
339838,
315267,
282499,
315269,
241544,
282505,
241546,
241548,
298896,
298898,
282514,
241556,
298901,
44948,
241560,
282520,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
36779,
241581,
282542,
241583,
323504,
241586,
282547,
241588,
290739,
241590,
241592,
241598,
290751,
241600,
241605,
151495,
241610,
298975,
241632,
298984,
241640,
241643,
298988,
241646,
241649,
241652,
323574,
290807,
241661,
299006,
282623,
315396,
241669,
315397,
282632,
307211,
282639,
290835,
282645,
241693,
282654,
241701,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
307278,
192596,
176213,
307287,
315482,
315483,
217179,
192605,
233567,
200801,
299105,
217188,
299109,
307303,
315495,
356457,
307307,
45163,
315502,
192624,
307314,
323700,
299126,
233591,
299136,
307329,
315524,
307338,
233613,
241813,
307352,
299164,
184479,
299167,
184481,
315557,
184486,
307370,
307372,
184492,
307374,
307376,
323763,
176311,
299191,
307385,
307386,
258235,
307388,
176316,
307390,
184503,
299200,
184512,
307394,
307396,
299204,
184518,
307399,
323784,
233679,
307409,
307411,
176343,
299225,
233701,
307432,
184572,
282881,
184579,
282893,
323854,
291089,
282906,
291104,
233766,
295583,
176435,
307508,
315701,
332086,
307510,
307512,
168245,
307515,
307518,
282942,
282947,
323917,
110926,
282957,
233808,
323921,
315733,
323926,
233815,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299388,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
315801,
283033,
242075,
291226,
291231,
61855,
283042,
291238,
291241,
127403,
127405,
127407,
291247,
299440,
299444,
127413,
283062,
291254,
127417,
291260,
283069,
127421,
127424,
299457,
127429,
127431,
315856,
176592,
315860,
176597,
283095,
127447,
299481,
176605,
242143,
291299,
127463,
242152,
291305,
127466,
176620,
127474,
291314,
291317,
135672,
291323,
233979,
127485,
291330,
127490,
283142,
135689,
233994,
127497,
291341,
233998,
127506,
234003,
127509,
234006,
127511,
152087,
283161,
234010,
242202,
135707,
135710,
242206,
242208,
291361,
242220,
291378,
152118,
234038,
234041,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
135808,
291456,
373383,
299655,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
225948,
135839,
299680,
225954,
135844,
299684,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
119509,
226005,
226008,
242396,
299740,
201444,
299750,
283368,
234219,
283372,
226037,
283382,
316151,
234231,
234236,
226045,
242431,
234239,
209665,
234242,
299778,
242436,
226053,
234246,
226056,
234248,
291593,
242443,
234252,
242445,
234254,
291601,
242450,
234258,
242452,
234261,
348950,
201496,
234264,
234266,
234269,
283421,
234272,
234274,
152355,
234278,
299814,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
160572,
283452,
234302,
234307,
242499,
234309,
316233,
234313,
316235,
234316,
283468,
242511,
234319,
234321,
234324,
201557,
185173,
234329,
234333,
308063,
234336,
234338,
349027,
242530,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
234364,
291711,
234368,
234370,
201603,
291714,
234373,
316294,
226182,
234375,
308105,
291716,
226185,
234379,
234384,
234388,
234390,
324504,
234393,
209818,
308123,
324508,
234396,
291742,
226200,
234398,
234401,
291747,
291748,
234405,
291750,
234407,
324520,
324518,
234410,
291754,
291756,
324522,
226220,
324527,
291760,
234417,
201650,
324531,
234414,
234422,
226230,
324536,
275384,
234428,
291773,
234431,
242623,
324544,
324546,
234434,
324548,
234437,
226245,
234439,
226239,
234443,
291788,
234446,
275406,
193486,
234449,
316370,
193488,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234475,
234478,
316400,
234481,
316403,
234484,
234485,
324599,
234487,
234490,
234493,
234496,
316416,
308226,
234501,
308231,
234504,
234507,
234510,
234515,
300054,
234519,
316439,
234520,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
144430,
234543,
234546,
275508,
234549,
300085,
300088,
234553,
234556,
234558,
316479,
234561,
308291,
316483,
160835,
234563,
234568,
234570,
316491,
300108,
234572,
234574,
300115,
234580,
234581,
242777,
234585,
275545,
234590,
234593,
234595,
300133,
234597,
234601,
300139,
234605,
160879,
234607,
275569,
234610,
316530,
300148,
234614,
398455,
144506,
234618,
275579,
234620,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
308373,
226453,
234647,
275606,
275608,
234650,
308379,
234648,
234653,
300189,
119967,
324766,
324768,
234657,
283805,
242852,
234661,
283813,
300197,
234664,
275626,
234667,
316596,
308414,
300223,
234687,
300226,
308418,
283844,
300229,
308420,
308422,
226500,
234692,
283850,
300234,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
300267,
161003,
300270,
300272,
120053,
300278,
316663,
275703,
300284,
275710,
300287,
300289,
292097,
300292,
300294,
275719,
234760,
177419,
300299,
242957,
283917,
300301,
177424,
275725,
349464,
283939,
259367,
292143,
283951,
300344,
226617,
243003,
283963,
226628,
283973,
300357,
177482,
283983,
316758,
357722,
316766,
316768,
292192,
218464,
292197,
316774,
243046,
218473,
284010,
324978,
136562,
275834,
333178,
275836,
275840,
316803,
316806,
226696,
316811,
226699,
316814,
226703,
300433,
234899,
226709,
357783,
316824,
316826,
144796,
300448,
144807,
144810,
144812,
284076,
144814,
144820,
284084,
284087,
292279,
144826,
144828,
144830,
144832,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
226802,
292338,
316917,
292343,
308727,
300537,
316933,
316947,
308757,
308762,
284191,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
284213,
308790,
284215,
194103,
316983,
284218,
194101,
226877,
284223,
284226,
284228,
292421,
226886,
284231,
128584,
243268,
284234,
366155,
317004,
276043,
284238,
226895,
284241,
292433,
284243,
300628,
284245,
194130,
284247,
317015,
235097,
243290,
276053,
284249,
284251,
300638,
284253,
284255,
243293,
284258,
292452,
292454,
284263,
177766,
284265,
292458,
284267,
292461,
284272,
284274,
276086,
284278,
292470,
292473,
284283,
276093,
284286,
276095,
284288,
292481,
284290,
325250,
284292,
292485,
292479,
276098,
284297,
317066,
284299,
317068,
276109,
284301,
284303,
284306,
276114,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
284329,
317098,
284331,
276137,
284333,
284335,
276144,
284337,
284339,
300726,
284343,
284346,
284350,
358080,
276160,
284354,
358083,
276166,
284358,
358089,
284362,
276170,
276175,
284368,
276177,
284370,
358098,
284372,
317138,
284377,
276187,
284379,
284381,
284384,
358114,
284386,
358116,
276197,
317158,
358119,
284392,
325353,
358122,
284394,
284397,
358126,
276206,
358128,
284399,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
300819,
317207,
284440,
300828,
300830,
276255,
325408,
300832,
300834,
317221,
227109,
358183,
186151,
276268,
300845,
243504,
300850,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
300872,
153417,
292681,
358224,
284499,
276308,
284502,
317271,
178006,
276315,
292700,
284511,
317279,
227175,
292715,
300912,
284529,
292721,
300915,
284533,
292729,
317306,
284540,
292734,
325512,
169868,
276365,
358292,
284564,
317332,
284566,
350106,
284572,
276386,
284579,
276388,
358312,
284585,
317353,
276395,
292776,
292784,
276402,
358326,
161718,
276410,
276411,
358330,
276418,
276425,
301009,
301011,
301013,
292823,
301015,
301017,
358360,
292828,
276446,
153568,
276448,
276452,
292839,
276455,
292843,
276460,
276464,
178161,
227314,
276466,
276472,
325624,
317435,
276476,
276479,
276482,
276485,
317446,
276490,
292876,
317456,
276496,
317458,
243733,
317468,
243740,
317472,
325666,
243751,
292904,
276528,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
276544,
284739,
325700,
292934,
243785,
276553,
350293,
350295,
309337,
194649,
227418,
350299,
350302,
227423,
194654,
178273,
309346,
194657,
309348,
350308,
309350,
227426,
309352,
350313,
309354,
301163,
350316,
194660,
227430,
276583,
276590,
350321,
284786,
276595,
301167,
350325,
227440,
350328,
292985,
301178,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
350366,
276638,
284837,
153765,
350375,
350379,
350381,
350383,
129200,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
309450,
301258,
276685,
309455,
276689,
309462,
301272,
276699,
309468,
194780,
309471,
301283,
317672,
317674,
325867,
243948,
194801,
309491,
227571,
309494,
243960,
276735,
227583,
227587,
276739,
211204,
276742,
227593,
227596,
325910,
309530,
342298,
211232,
317729,
276775,
211241,
325937,
325943,
211260,
260421,
276809,
285002,
276811,
235853,
276816,
235858,
276829,
276833,
391523,
276836,
276843,
293227,
276848,
293232,
186744,
211324,
227709,
285061,
317833,
178572,
285070,
285077,
178583,
227738,
317853,
276896,
317858,
342434,
285093,
317864,
285098,
276907,
235955,
276917,
293304,
293307,
293314,
309707,
293325,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
227810,
293346,
276964,
293352,
236013,
293364,
301562,
317951,
309764,
301575,
121352,
236043,
317963,
342541,
55822,
113167,
309779,
317971,
309781,
277011,
55837,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
285236,
23094,
277054,
244288,
219714,
129603,
318020,
301636,
301639,
301643,
277071,
285265,
399955,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
309871,
121458,
277106,
170618,
170619,
309885,
309888,
277122,
227975,
277128,
285320,
301706,
318092,
326285,
334476,
318094,
277136,
277139,
227992,
318108,
285340,
318110,
227998,
137889,
383658,
285357,
318128,
277170,
342707,
318132,
154292,
293555,
277173,
285368,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
137946,
113378,
203491,
228069,
277223,
342760,
285417,
56041,
56043,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
228113,
285459,
277273,
293659,
326430,
228128,
293666,
285474,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
285494,
301880,
285499,
301884,
310080,
293696,
277317,
277322,
293706,
277329,
162643,
310100,
301911,
277337,
301913,
301921,
400236,
236397,
162671,
326514,
310134,
15224,
236408,
277368,
416639,
416640,
113538,
310147,
416648,
39817,
187274,
277385,
301972,
424853,
277405,
277411,
310179,
293798,
293802,
236460,
277426,
276579,
293811,
293817,
293820,
203715,
326603,
276586,
293849,
293861,
228327,
228328,
228330,
318442,
228332,
326638,
277486,
318450,
293876,
293877,
285686,
302073,
285690,
293882,
302075,
121850,
244731,
293887,
277504,
277507,
277511,
293899,
277519,
293908,
293917,
293939,
318516,
277561,
277564,
310336,
7232,
293956,
277573,
228422,
310344,
277577,
293960,
277583,
203857,
310355,
293971,
310359,
236632,
277594,
138332,
277598,
203872,
277601,
285792,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
285817,
367737,
302205,
285821,
392326,
285831,
253064,
302218,
294026,
285835,
384148,
162964,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
302241,
285862,
277671,
302248,
64682,
277678,
294063,
294065,
302258,
277687,
294072,
318651,
294076,
277695,
318657,
244930,
302275,
130244,
302277,
228550,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
302296,
384222,
310498,
285927,
318698,
302315,
195822,
228592,
294132,
138485,
228601,
204026,
228606,
204031,
64768,
310531,
285958,
138505,
228617,
318742,
204067,
277798,
130345,
277801,
113964,
285997,
277804,
285999,
277807,
113969,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
417086,
277822,
286016,
302403,
294211,
384328,
277832,
277836,
294221,
326991,
294223,
277839,
277842,
277847,
277850,
179547,
277853,
146784,
277857,
302436,
277860,
294246,
327015,
310632,
327017,
351594,
277864,
277869,
277872,
351607,
310648,
277880,
310651,
277884,
277888,
310657,
310659,
351619,
294276,
327046,
277892,
253320,
310665,
318858,
277894,
277898,
277903,
310672,
351633,
277905,
277908,
277917,
310689,
277921,
130468,
228776,
277928,
277932,
310703,
277937,
310710,
130486,
310712,
277944,
310715,
277947,
302526,
228799,
277950,
277953,
302534,
245191,
310727,
64966,
163272,
277959,
292968,
302541,
277963,
302543,
277966,
310737,
277971,
228825,
163290,
277978,
310749,
277981,
277984,
310755,
277989,
277991,
187880,
277995,
310764,
286188,
278000,
228851,
310772,
278003,
278006,
40440,
212472,
278009,
40443,
286203,
310780,
40448,
228864,
286214,
228871,
302603,
65038,
302614,
302617,
286233,
302621,
286240,
146977,
187939,
40484,
294435,
40486,
286246,
40488,
278057,
294439,
40491,
294440,
294443,
294445,
310831,
286248,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
40521,
286283,
40525,
40527,
400976,
212560,
228944,
40533,
147032,
40537,
40539,
40541,
278109,
40544,
40548,
40550,
40552,
286312,
40554,
286313,
310892,
40557,
40560,
188022,
122488,
294521,
343679,
294537,
310925,
286354,
278163,
302740,
122517,
278168,
179870,
327333,
229030,
212648,
278188,
302764,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
302793,
294601,
343757,
212690,
278227,
286420,
319187,
229076,
286425,
319194,
278235,
278238,
229086,
286432,
294625,
294634,
302838,
319226,
286460,
278274,
302852,
278277,
302854,
311048,
294664,
352008,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
319280,
278320,
319290,
229192,
302925,
188247,
188252,
237409,
294776,
360317,
294785,
327554,
40840,
40851,
294803,
188312,
294811,
319390,
237470,
40865,
319394,
294817,
294821,
311209,
180142,
294831,
188340,
40886,
319419,
294844,
294847,
237508,
393177,
294876,
294879,
294883,
294890,
311279,
278513,
237555,
311283,
278516,
278519,
237562
] |
e1aa15de9304109806393644174685125ab886f0 | 5eba6b2ac4d3906dff8094382cf08532bc7f07ca | /JFTracker-Chilakala/ViewController.swift | 0841e2394916bcd41023d6ad6c2fbfcbe18501eb | [] | no_license | S530669/JFTracker-Chilakala | d5256405ac038a2fabe936c040fa098ba84f7d1e | af089e6d91ae2a91b258691a1e4776e4aed40e94 | refs/heads/master | 2021-04-06T08:24:50.180541 | 2018-03-08T19:51:31 | 2018-03-08T19:51:31 | 124,349,148 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 512 | swift | //
// ViewController.swift
// JFTracker-Chilakala
//
// Created by student on 3/7/18.
// Copyright © 2018 s530460. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
| [
279041,
279046,
277512,
215562,
275466,
307212,
278543,
281107,
279064,
281118,
294433,
284197,
289318,
296487,
296489,
286249,
304174,
309807,
292915,
300086,
234551,
279096,
286775,
300089,
234043,
288827,
238653,
226878,
290875,
230608,
288321,
129604,
301637,
226887,
293961,
243786,
284235,
286796,
158285,
288331,
226896,
212561,
284242,
292435,
300629,
276054,
237655,
307288,
212573,
40545,
200802,
284261,
281703,
306791,
286314,
296042,
164974,
307311,
312433,
281202,
284275,
277108,
300149,
314996,
276087,
189557,
294518,
234619,
284287,
284289,
278657,
276612,
280710,
284298,
303242,
278157,
311437,
226447,
234641,
349332,
117399,
307353,
280219,
282270,
285855,
228000,
282275,
278693,
287399,
100521,
198315,
313007,
302767,
277171,
307379,
284341,
286390,
300727,
184504,
282301,
283839,
277696,
285377,
280770,
227523,
302788,
285378,
228551,
279751,
280775,
279754,
282311,
230604,
284361,
276686,
298189,
282320,
229585,
302286,
307410,
287437,
239310,
299727,
189655,
302295,
226009,
282329,
239314,
363743,
282338,
228585,
282346,
199402,
358127,
234223,
312049,
286963,
289524,
280821,
120054,
226038,
234232,
282357,
280826,
286965,
358139,
282365,
286462,
280832,
282368,
309506,
358147,
292102,
226055,
278791,
282377,
299786,
312586,
300817,
295699,
282389,
288251,
282393,
329499,
228127,
287007,
315170,
282403,
281380,
233767,
283433,
130346,
282411,
293682,
159541,
282426,
289596,
283453,
307516,
279360,
289088,
293700,
283461,
300358,
238920,
311624,
234829,
230737,
307029,
230745,
241499,
308064,
289120,
289121,
227688,
313706,
290303,
306540,
296811,
299374,
162672,
199024,
276849,
300400,
315250,
284534,
292730,
333179,
291709,
303998,
290175,
275842,
224643,
183173,
298375,
304008,
324491,
304012,
304015,
300432,
226705,
310673,
304531,
304536,
294812,
304540,
277406,
285087,
284576,
234402,
289187,
284580,
304550,
304551,
284586,
276396,
370093,
286126,
277935,
324528,
305582,
285103,
282035,
230323,
292277,
296374,
130487,
234423,
277432,
278968,
144822,
293308,
278973,
292280,
295874,
299973,
296901,
165832,
306633,
286158,
280015,
310734,
286162,
301016,
163289,
292824,
286175,
234465,
168936,
294889,
231405,
183278,
282095,
293874,
227315,
296436,
293875,
281078,
290299,
233980,
287231
] |
dc29dbea91cb1ea1d4898b21fa50b67542158f0c | 17fe3474aff03a1527e5275d5144f3f83664af06 | /Sources/App/routes.swift | b4d20555338e661f789aae5475bee464d5ef00ea | [
"MIT"
] | permissive | ppjia/pcpc | a3d949a65ec33a40d9e0e78a019bbd59ddefd759 | 24719a5cf4cb40ddbaf40b532c9c73008b6f1085 | refs/heads/master | 2020-04-23T18:41:34.162824 | 2019-02-19T05:50:25 | 2019-02-20T22:24:23 | 171,376,674 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 859 | swift | import Vapor
/// Register your application's routes here.
public func routes(_ router: Router) throws {
// Basic "It works" example
router.get { req in
return "The website for Penrith Chinese Presbyterian Church is under construction! For more information, please contact: Darren, 0430066645\n彭里斯华人长老会网站还在建设中!请联系牧师助理:大海 0430066645\nAddress地址: 9 Doonmore St, Penrith NSW 2750 (Penrith 公立小学对面)"
}
// Basic "Hello, world!" example
router.get("hello") { req in
return "Hello, world!"
}
// Example of configuring a controller
let todoController = TodoController()
router.get("todos", use: todoController.index)
router.post("todos", use: todoController.create)
router.delete("todos", Todo.parameter, use: todoController.delete)
}
| [
-1
] |
d71fcc6c703cb3c714d6f62da49c80490eda4b14 | da8f5eb0b945f09b1e7ac425aec0659a28e94f0c | /FazeKit/Classes/UIResponderAdditions.swift | e369611011b0245c9a17782f0c84da0d8cad8b21 | [
"Apache-2.0"
] | permissive | NextFaze/FazeKit | 7b055d4182f8d0d6da3bf9d32fe721007e5e67bd | 7b33681328d2e70b226d2458fea19ea33e67abf6 | refs/heads/master | 2023-08-08T00:14:19.723127 | 2023-07-27T02:32:38 | 2023-07-27T02:32:38 | 65,508,191 | 5 | 5 | Apache-2.0 | 2022-10-20T23:10:55 | 2016-08-11T23:30:14 | Swift | UTF-8 | Swift | false | false | 886 | swift | //
// Copyright 2016 NextFaze
//
// 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.
//
// UIResponderAdditions.swift
// FazeKit
//
// Created by swoolcock on 17/08/2016.
//
import UIKit
public extension UIResponder {
static func resignAnyFirstResponder() {
UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil)
}
}
| [
-1
] |
9ab97e9fa61c3c0146342c98be3113ef0a77622a | e0d87f3bad4ef01ec520abfa1b7469b8a23c6e7f | /Project19/Extension/ActionViewController.swift | ed5aed19a32ef98c852593b7726b298c8a2845a0 | [] | no_license | dobleuber/100daysofswift | 8fd6817a1b69c94818fa9678a1864ecbf31cbb22 | 2016291e0b0a6fd5e0aefa68c60b1e07c31d3b79 | refs/heads/master | 2020-11-27T19:56:50.939748 | 2020-03-22T14:47:28 | 2020-03-22T14:47:28 | 229,583,519 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,670 | swift | //
// ActionViewController.swift
// Extension
//
// Created by Wbert Castro on 1/30/20.
// Copyright © 2020 Wbert Castro. All rights reserved.
//
import UIKit
import MobileCoreServices
class ActionViewController: UIViewController {
@IBOutlet var script: UITextView!
var pageTitle = ""
var pageURL = ""
override func viewDidLoad() {
super.viewDidLoad()
navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(done))
navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .bookmarks, target: self, action: #selector(chooseDefinedAction))
let notificationCenter = NotificationCenter.default
notificationCenter.addObserver(self, selector: #selector(adjustForKeyboard), name: UIResponder.keyboardWillHideNotification, object: nil)
notificationCenter.addObserver(self, selector: #selector(adjustForKeyboard), name: UIResponder.keyboardWillChangeFrameNotification, object: nil)
if let inputItem = extensionContext?.inputItems.first as? NSExtensionItem {
if let itemProvider = inputItem.attachments?.first {
itemProvider.loadItem(forTypeIdentifier: kUTTypePropertyList as String) {
[weak self] (dict, error) in
guard let itemDictionary = dict
as? NSDictionary else {
return
}
guard let javascriptValues = itemDictionary[NSExtensionJavaScriptPreprocessingResultsKey]
as? NSDictionary else {
return
}
self?.pageTitle = javascriptValues["title"] as? String ?? ""
self?.pageURL = javascriptValues["URL"] as? String ?? ""
let userDefaults = UserDefaults.standard
var prevScript: String?
if let url = self?.pageURL {
prevScript = userDefaults.string(forKey: url)
}
DispatchQueue.main.async {
self?.title = self?.pageTitle
if prevScript != nil {
self?.script.text = prevScript
}
}
}
}
}
}
@IBAction func done() {
let item = NSExtensionItem()
let argument: NSDictionary = ["customJavaScript": script.text!]
let webDictionary: NSDictionary = [NSExtensionJavaScriptFinalizeArgumentKey: argument]
let customJavaScript = NSItemProvider(item: webDictionary, typeIdentifier: kUTTypePropertyList as String)
item.attachments = [customJavaScript]
extensionContext?.completeRequest(returningItems: [item])
let userDefaults = UserDefaults.standard
userDefaults.set(script.text!, forKey: pageURL)
}
@objc func adjustForKeyboard(notification: Notification) {
guard let keyboardValue = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue else {return}
let keyboardScreenEndFrame = keyboardValue.cgRectValue
let keyboardViewEndFrame = view.convert(keyboardScreenEndFrame, from: view.window)
if notification.name == UIResponder.keyboardWillHideNotification {
script.contentInset = .zero
} else {
script.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: keyboardViewEndFrame.height - view.safeAreaInsets.bottom, right: 0)
}
script.scrollIndicatorInsets = script.contentInset
let selectedRange = script.selectedRange
script.scrollRangeToVisible(selectedRange)
}
@objc func chooseDefinedAction() {
let ac = UIAlertController(title: "Predefined Actions", message: nil, preferredStyle: .actionSheet)
ac.addAction(UIAlertAction(title: "Say hi", style: .default) {
[weak self] _ in
self?.script.text =
"""
alert('Hi')
"""
})
ac.addAction(UIAlertAction(title: "Say bye", style: .default) {
[weak self] _ in
self?.script.text =
"""
alert('Bye')
"""
})
ac.addAction(UIAlertAction(title: "OK", style: .cancel))
present(ac, animated: true)
}
}
| [
-1
] |
9021270e8a17060ef12b06cf48d8c006d277b6f0 | d88ddf3ba5c312a1f715bb3cf37d3d845c6a4d27 | /PTVN Editor/PTVN/PTVNModel.swift | b30bd0ce2c0296e2efb81aac669d3c2edf6c76d1 | [] | no_license | FoolOfShadows/PTVN-Editor | 3873eca98c7ef7d991fec7eed64086b3fec7f07b | 5f428ff31e4d61e5f9c56b1983f266c9304faa8f | refs/heads/master | 2023-02-20T04:17:27.954484 | 2018-08-28T16:05:34 | 2018-08-28T16:05:34 | 130,104,124 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 10,516 | swift | //
// MessageModel.swift
// PhoneMessages
//
// Created by Fool on 3/6/18.
// Copyright © 2018 Fool. All rights reserved.
//
import Cocoa
enum SectionDelimiters:String {
case patientNameStart = "#PATIENTNAME"
case patientNameEnd = "PATIENTNAME#"
case patientDOBStart = "#PATIENTDOB"
case patientDOBEnd = "PATIENTDOB#"
case patientAgeStart = "#PATIENTAGE"
case patientAgeEnd = "PATIENTAGE#"
case ccStart = "#CC"
case ccEnd = "CC#"
case problemsStart = "#PROBLEMS"
case problemEnd = "PROBLEMS#"
case subjectiveStart = "#SUBJECTIVE"
case subjectiveEnd = "SUBJECTIVE#"
case newPMHStart = "#NEWPMH"
case newPMHEnd = "NEWPMH#"
case assessmentStart = "#ASSESSMENT"
case assessmentEND = "ASSESSMENT#"
case planStart = "#PLAN"
case planEnd = "PLAN#"
case objectiveStart = "#OBJECTIVE"
case objectiveEnd = "OBJECTIVE#"
case medStart = "#MEDICATIONS"
case medEnd = "MEDICATIONS#"
case allergiesStart = "#ALLERGIES"
case allergiesEnd = "ALLERGIES#"
case preventiveStart = "#PREVENTIVE"
case preventiveEnd = "PREVENTIVE#"
case pmhStart = "#PMH"
case pmhEnd = "PMH#"
case pshStart = "#PSH"
case pshEnd = "PSH#"
case nutritionStart = "#NUTRITION"
case nutritionEnd = "NUTRITION#"
case socialStart = "#SOCIAL"
case socialEnd = "SOCIAL#"
case familyStart = "#FAMILY"
case familyEnd = "FAMILY#"
case diagnosisStart = "#DIAGNOSIS"
case diagnosisEnd = "DIAGNOSIS#"
case rosStart = "#ROS"
case rosEnd = "ROS#"
case visitDateStart = "#VISITDATE"
case visitDateEnd = "VISITDATE#"
case otherStart = "#OTHER"
case otherEnd = "OTHER#"
}
struct PTVN {
var theText:String
private let currentDate = Date()
private let formatter = DateFormatter()
private var messageDate:String {
formatter.dateStyle = DateFormatter.Style.short
return formatter.string(from: currentDate)
}
// var labelDate:String {
// formatter.dateFormat = "yyMMdd"
// return formatter.string(from: currentDate)
// }
var visitDate = String()
var ptName = String()
//var ptLabelName:String {return getFileLabellingName(ptInnerName)}
var ptAge = String()
var ptDOB = String()
var allergies = String()
var medicines = String()
var preventive = String()
var pmh = String()
var psh = String()
var nutrition = String()
var social = String()
var family = String()
var diagnoses = String()
var ros = String()
var assessment = String()
var objective = String()
var subjective = String()
var plan = String()
// var lastAppointment:String {return getLastAptInfoFrom(theText)}
// var nextAppointment:String {return getNextAptInfoFrom(theText)}
init(theText: String) {
self.theText = theText
self.visitDate = theText.simpleRegExMatch(Regexes().visitDate).cleanTheTextOf([SectionDelimiters.visitDateStart.rawValue, SectionDelimiters.visitDateEnd.rawValue])
self.ptName = theText.simpleRegExMatch(Regexes().name).cleanTheTextOf([SectionDelimiters.patientNameStart.rawValue, SectionDelimiters.patientNameEnd.rawValue])
//var ptLabelName:String {return getFileLabellingName(ptInnerName)}
self.ptAge = theText.simpleRegExMatch(Regexes().age).cleanTheTextOf([SectionDelimiters.patientAgeStart.rawValue, SectionDelimiters.patientAgeEnd.rawValue])
self.ptDOB = theText.simpleRegExMatch(Regexes().dob).cleanTheTextOf([SectionDelimiters.patientDOBStart.rawValue, SectionDelimiters.patientDOBEnd.rawValue])
self.allergies = theText.simpleRegExMatch(Regexes().allergies).cleanTheTextOf([SectionDelimiters.allergiesStart.rawValue, SectionDelimiters.allergiesEnd.rawValue])
self.medicines = theText.simpleRegExMatch(Regexes().medications).cleanTheTextOf([SectionDelimiters.medStart.rawValue, SectionDelimiters.medEnd.rawValue])
self.preventive = theText.simpleRegExMatch(Regexes().preventive).cleanTheTextOf([SectionDelimiters.preventiveStart.rawValue, SectionDelimiters.preventiveEnd.rawValue])
self.pmh = theText.simpleRegExMatch(Regexes().pmh).cleanTheTextOf([SectionDelimiters.pmhStart.rawValue, SectionDelimiters.pmhEnd.rawValue])
self.psh = theText.simpleRegExMatch(Regexes().psh).cleanTheTextOf([SectionDelimiters.pshStart.rawValue, SectionDelimiters.pshEnd.rawValue])
self.nutrition = theText.simpleRegExMatch(Regexes().nutrition).cleanTheTextOf([SectionDelimiters.nutritionStart.rawValue, SectionDelimiters.nutritionEnd.rawValue])
self.social = theText.simpleRegExMatch(Regexes().social).cleanTheTextOf([SectionDelimiters.socialStart.rawValue, SectionDelimiters.socialEnd.rawValue])
self.family = theText.simpleRegExMatch(Regexes().family).cleanTheTextOf([SectionDelimiters.familyStart.rawValue, SectionDelimiters.familyEnd.rawValue])
self.diagnoses = theText.simpleRegExMatch(Regexes().diagnoses).cleanTheTextOf([SectionDelimiters.diagnosisStart.rawValue, SectionDelimiters.diagnosisEnd.rawValue])
self.ros = theText.simpleRegExMatch(Regexes().ros).cleanTheTextOf([SectionDelimiters.rosStart.rawValue, SectionDelimiters.rosEnd.rawValue])
self.assessment = theText.simpleRegExMatch(Regexes().assessment).cleanTheTextOf([SectionDelimiters.assessmentStart.rawValue, SectionDelimiters.assessmentEND.rawValue])
self.objective = theText.simpleRegExMatch(Regexes().objective).cleanTheTextOf([SectionDelimiters.objectiveStart.rawValue, SectionDelimiters.objectiveEnd.rawValue])
self.subjective = theText.simpleRegExMatch(Regexes().subjective).cleanTheTextOf([SectionDelimiters.subjectiveStart.rawValue, SectionDelimiters.subjectiveEnd.rawValue])
self.plan = theText.simpleRegExMatch(Regexes().plan).cleanTheTextOf([SectionDelimiters.planStart.rawValue, SectionDelimiters.planEnd.rawValue])
}
var saveValue:String {return """
\(SectionDelimiters.patientNameStart.rawValue)
\(ptName)
\(SectionDelimiters.patientNameEnd.rawValue)
\(SectionDelimiters.patientDOBStart.rawValue)
\(ptDOB)
\(SectionDelimiters.patientDOBEnd.rawValue)
\(SectionDelimiters.patientAgeStart.rawValue)
\(ptAge)
\(SectionDelimiters.patientAgeEnd.rawValue)
\(SectionDelimiters.visitDateStart.rawValue)
\(visitDate)
\(SectionDelimiters.visitDateEnd.rawValue)
\(SectionDelimiters.medStart.rawValue)
\(medicines)
\(SectionDelimiters.medEnd.rawValue)
\(SectionDelimiters.allergiesStart.rawValue)
\(allergies)
\(SectionDelimiters.allergiesEnd.rawValue)
\(SectionDelimiters.preventiveStart.rawValue)
\(preventive)
\(SectionDelimiters.preventiveEnd.rawValue)
\(SectionDelimiters.pmhStart.rawValue)
\(pmh)
\(SectionDelimiters.pmhEnd.rawValue)
\(SectionDelimiters.pshStart.rawValue)
\(psh)
\(SectionDelimiters.pshEnd.rawValue)
\(SectionDelimiters.nutritionStart.rawValue)
\(nutrition)
\(SectionDelimiters.nutritionEnd.rawValue)
\(SectionDelimiters.socialStart.rawValue)
\(social)
\(SectionDelimiters.socialEnd.rawValue)
\(SectionDelimiters.familyStart.rawValue)
\(family)
\(SectionDelimiters.familyEnd.rawValue)
\(SectionDelimiters.diagnosisStart.rawValue)
\(diagnoses)
\(SectionDelimiters.diagnosisEnd.rawValue)
\(SectionDelimiters.rosStart.rawValue)
\(ros)
\(SectionDelimiters.rosEnd.rawValue)
\(SectionDelimiters.assessmentStart.rawValue)
\(assessment)
\(SectionDelimiters.assessmentEND.rawValue)
\(SectionDelimiters.objectiveStart.rawValue)
\(objective)
\(SectionDelimiters.objectiveEnd.rawValue)
\(SectionDelimiters.subjectiveStart.rawValue)
\(subjective)
\(SectionDelimiters.subjectiveEnd.rawValue)
\(SectionDelimiters.planStart.rawValue)
\(plan)
\(SectionDelimiters.planEnd.rawValue)
"""
// \(SectionDelimiters.otherStart.rawValue)
// \(messageDate)
// \(SectionDelimiters.otherEnd.rawValue)
}
struct Regexes {
let name = "(?s)\(SectionDelimiters.patientNameStart.rawValue).*\(SectionDelimiters.patientNameEnd.rawValue)"
let dob = "(?s)\(SectionDelimiters.patientDOBStart.rawValue).*\(SectionDelimiters.patientDOBEnd.rawValue)"
let age = "(?s)\(SectionDelimiters.patientAgeStart.rawValue).*\(SectionDelimiters.patientAgeEnd.rawValue)"
let visitDate = "(?s)\(SectionDelimiters.visitDateStart.rawValue).*\(SectionDelimiters.visitDateEnd.rawValue)"
let social = "(?s)\(SectionDelimiters.socialStart.rawValue).*\(SectionDelimiters.socialEnd.rawValue)"
let family = "(?s)\(SectionDelimiters.familyStart.rawValue).*\(SectionDelimiters.familyEnd.rawValue)"
let nutrition = "(?s)\(SectionDelimiters.nutritionStart.rawValue).*\(SectionDelimiters.nutritionEnd.rawValue)"
let diagnoses = "(?s)\(SectionDelimiters.diagnosisStart.rawValue).*\(SectionDelimiters.diagnosisEnd.rawValue)"
let medications = "(?s)\(SectionDelimiters.medStart.rawValue).*\(SectionDelimiters.medEnd.rawValue)"
let allergies = "(?s)\(SectionDelimiters.allergiesStart.rawValue).*\(SectionDelimiters.allergiesEnd.rawValue)"
let pmh = "(?s)\(SectionDelimiters.pmhStart.rawValue).*\(SectionDelimiters.pmhEnd.rawValue)"
let psh = "(?s)\(SectionDelimiters.pshStart.rawValue).*\(SectionDelimiters.pshEnd.rawValue)"
let preventive = "(?s)\(SectionDelimiters.preventiveStart.rawValue).*\(SectionDelimiters.preventiveEnd.rawValue)"
let ros = "(?s)\(SectionDelimiters.rosStart.rawValue).*\(SectionDelimiters.rosEnd.rawValue)"
let assessment = "(?s)\(SectionDelimiters.assessmentStart.rawValue).*\(SectionDelimiters.assessmentEND.rawValue)"
let objective = "(?s)\(SectionDelimiters.objectiveStart.rawValue).*\(SectionDelimiters.objectiveEnd.rawValue)"
let subjective = "(?s)\(SectionDelimiters.subjectiveStart.rawValue).*\(SectionDelimiters.subjectiveEnd.rawValue)"
let plan = "(?s)\(SectionDelimiters.planStart.rawValue).*\(SectionDelimiters.planEnd.rawValue)"
}
}
| [
-1
] |
3f59b2cab8d848146b248b60fc23e5669c58fc49 | 4047a39a2bd4c6dd31b22e9e255806c7bfaf541a | /splittable_tt/splittable_ttUITests/splittable_ttUITests.swift | e190ad187a23686b01e4ba7284c6334eb9c6c9bf | [] | no_license | Lawrence-Dawson/splittable_tt | e21dacd8e68a5382f6c080a06dd549bcd27062d9 | 8734436d420c72db84e173b505efcfdce900598b | refs/heads/master | 2021-06-08T15:14:44.401543 | 2016-11-11T13:58:16 | 2016-11-11T13:58:16 | 73,310,509 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,273 | swift | //
// splittable_ttUITests.swift
// splittable_ttUITests
//
// Created by Lawrence Dawson on 09/11/2016.
// Copyright © 2016 Lawrence Dawson. All rights reserved.
//
import XCTest
class splittable_ttUITests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
// In UI tests it is usually best to stop immediately when a failure occurs.
continueAfterFailure = false
// UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
XCUIApplication().launch()
// In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
}
| [
333827,
243720,
282634,
313356,
155665,
305173,
241695,
237599,
223269,
229414,
315431,
292901,
315433,
354342,
325675,
278571,
313388,
124974,
282671,
354346,
229425,
102441,
243763,
102446,
321589,
241717,
229431,
180279,
215095,
319543,
213051,
288829,
325695,
286787,
288835,
307269,
237638,
313415,
239689,
233548,
315468,
311373,
196687,
278607,
311377,
354386,
315477,
223317,
354394,
323678,
315488,
321632,
45154,
315489,
280676,
313446,
215144,
227432,
217194,
194667,
233578,
278637,
307306,
319599,
288878,
278642,
284789,
131190,
249976,
288890,
292987,
215165,
131199,
227459,
194692,
278669,
235661,
241809,
323730,
278676,
311447,
153752,
327834,
284827,
329884,
278684,
299166,
278690,
233635,
311459,
215204,
284840,
299176,
278698,
284843,
184489,
278703,
323761,
184498,
278707,
125108,
180409,
280761,
278713,
223418,
227517,
295099,
299197,
280767,
258233,
299202,
139459,
309443,
176325,
131270,
301255,
227525,
280779,
233678,
282832,
321744,
227536,
301271,
229591,
280792,
356575,
311520,
325857,
280803,
182503,
338151,
307431,
319719,
295147,
317676,
286957,
125166,
125170,
313595,
125180,
184574,
125184,
309504,
125192,
217352,
125197,
125200,
194832,
227601,
325904,
125204,
319764,
278805,
334104,
315674,
282908,
311582,
125215,
282912,
299294,
233761,
278817,
211239,
282920,
125225,
317738,
325930,
311596,
321839,
315698,
98611,
125236,
282938,
307514,
278843,
168251,
287040,
319812,
311622,
227655,
280903,
319816,
323914,
201037,
282959,
229716,
289109,
168280,
379224,
323934,
391521,
239973,
381286,
285031,
313703,
416103,
280938,
242027,
242028,
321901,
278895,
354672,
287089,
354671,
227702,
199030,
315768,
315769,
291193,
223611,
291194,
248188,
313726,
211327,
291200,
311679,
139641,
240003,
158087,
313736,
227721,
242059,
311692,
285074,
227730,
240020,
190870,
315798,
190872,
291225,
285083,
293275,
317851,
242079,
227743,
285089,
293281,
289185,
305572,
156069,
300490,
283039,
301482,
289195,
311723,
377265,
338359,
299449,
311739,
319931,
293309,
278974,
311744,
317889,
291266,
278979,
278988,
289229,
281038,
326093,
278992,
283089,
373196,
281039,
283088,
279000,
242138,
176602,
285152,
369121,
160224,
279009,
195044,
291297,
279014,
242150,
319976,
279017,
188899,
311787,
281071,
319986,
236020,
279030,
311800,
279033,
317949,
279042,
283138,
233987,
287237,
377352,
322057,
309770,
342537,
279053,
283154,
303635,
303634,
279061,
279060,
182802,
279066,
188954,
322077,
291359,
227881,
293420,
289328,
236080,
283185,
279092,
23093,
234037,
244279,
244280,
338491,
234044,
301635,
309831,
55880,
377419,
303693,
281165,
301647,
281170,
326229,
309847,
189016,
115287,
111197,
295518,
287327,
242274,
244326,
279143,
279150,
281200,
287345,
313970,
287348,
301688,
189054,
287359,
291455,
297600,
303743,
301702,
164487,
279176,
311944,
316044,
311948,
184974,
311950,
316048,
311953,
336531,
287379,
295575,
227991,
289435,
303772,
221853,
205469,
285348,
314020,
279207,
295591,
248494,
318127,
293552,
285360,
285362,
299698,
287412,
166581,
295598,
154295,
279215,
342705,
287418,
314043,
303802,
66243,
291529,
287434,
225996,
363212,
287438,
242385,
279249,
303826,
279253,
158424,
230105,
299737,
322269,
342757,
295653,
289511,
230120,
330473,
234216,
285419,
330476,
289517,
279278,
170735,
312046,
215790,
125683,
230133,
199415,
234233,
242428,
279293,
205566,
322302,
291584,
299777,
289534,
228099,
285443,
291591,
295688,
346889,
285450,
322312,
312076,
285457,
295698,
291605,
166677,
283418,
285467,
221980,
281378,
234276,
283431,
262952,
262953,
279337,
318247,
318251,
262957,
203560,
164655,
328495,
293673,
289580,
301872,
242481,
234290,
230198,
303921,
285496,
285493,
301883,
201534,
281407,
289599,
222017,
295745,
293702,
318279,
283466,
281426,
279379,
295769,
234330,
201562,
281434,
322396,
230238,
275294,
301919,
279393,
230239,
293729,
281444,
349025,
279398,
303973,
243592,
177002,
308075,
242540,
242542,
310132,
295797,
201590,
207735,
228214,
295799,
177018,
269179,
279418,
308093,
314240,
291713,
158594,
330627,
240517,
287623,
228232,
416649,
279434,
236427,
320394,
316299,
234382,
189327,
299912,
308113,
308111,
293780,
310166,
289691,
209820,
277404,
240543,
283551,
310177,
289699,
189349,
289704,
279465,
293801,
304050,
177074,
289720,
289723,
189373,
213956,
281541,
345030,
19398,
213961,
326602,
279499,
56270,
191445,
183254,
304086,
183258,
234469,
340967,
314343,
304104,
324587,
183276,
289773,
203758,
234476,
320492,
320495,
287730,
277493,
240631,
320504,
214009,
312313,
312315,
312317,
234499,
293894,
320520,
322571,
230411,
320526,
330766,
234513,
238611,
140311,
293911,
238617,
197658,
316441,
330789,
248871,
132140,
113710,
189487,
281647,
322609,
312372,
203829,
238646,
300087,
238650,
320571,
21567,
308288,
336962,
160834,
314437,
349254,
238663,
300109,
207954,
234578,
205911,
296023,
314458,
277600,
281698,
281699,
230500,
285795,
322664,
228457,
279659,
318571,
234606,
300145,
230514,
238706,
187508,
312435,
279666,
300147,
302202,
285819,
314493,
285823,
150656,
234626,
279686,
222344,
285833,
318602,
234635,
285834,
337037,
228492,
177297,
162962,
187539,
308375,
324761,
285850,
296091,
119965,
234655,
330912,
300192,
302239,
306339,
339106,
234662,
300200,
249003,
208044,
238764,
302251,
322733,
3243,
279729,
294069,
300215,
294075,
339131,
228541,
64699,
283841,
148674,
283846,
312519,
279752,
283849,
148687,
290001,
189651,
316628,
279766,
189656,
279775,
304352,
298209,
304353,
310496,
279780,
228587,
279789,
290030,
302319,
251124,
316661,
283894,
279803,
208123,
292092,
228608,
320769,
234756,
322826,
242955,
312588,
177420,
318732,
126229,
245018,
320795,
318746,
320802,
304422,
130342,
130344,
292145,
298290,
312628,
345398,
300342,
159033,
222523,
286012,
181568,
279872,
279874,
300355,
294210,
216387,
286019,
193858,
300354,
304457,
345418,
230730,
294220,
296269,
234830,
224591,
222542,
238928,
296274,
314708,
318804,
283990,
314711,
357720,
300378,
300379,
316764,
294236,
314721,
292194,
230757,
281958,
314727,
134504,
306541,
314734,
284015,
234864,
296304,
316786,
327023,
314740,
230772,
314742,
327030,
314745,
290170,
310650,
224637,
306558,
290176,
306561,
179586,
243073,
314752,
294278,
296328,
296330,
298378,
368012,
318860,
304523,
292242,
279955,
306580,
314771,
224662,
234902,
282008,
318876,
282013,
290206,
148899,
314788,
314790,
282023,
333224,
298406,
241067,
279980,
314797,
279979,
286128,
173492,
279988,
286133,
284086,
284090,
302523,
228796,
310714,
54719,
415170,
292291,
302530,
280003,
228804,
306630,
300488,
310725,
306634,
339403,
370122,
310731,
280011,
310735,
302539,
312785,
327122,
222674,
280020,
234957,
280025,
310747,
239069,
144862,
286176,
320997,
310758,
187877,
280042,
280043,
191980,
300526,
337391,
282097,
308722,
296434,
306678,
40439,
191991,
288248,
286201,
300539,
288252,
312830,
290304,
286208,
228868,
292359,
218632,
230922,
302602,
323083,
294413,
329231,
304655,
323088,
282132,
230933,
302613,
282135,
316951,
374297,
302620,
313338,
282147,
222754,
306730,
312879,
230960,
288305,
239159,
290359,
323132,
157246,
288319,
288322,
280131,
349764,
310853,
124486,
282182,
288328,
286281,
292426,
194118,
224848,
224852,
290391,
196184,
239192,
306777,
128600,
235096,
212574,
99937,
204386,
323171,
345697,
300643,
282214,
300645,
312937,
204394,
224874,
243306,
312941,
206447,
310896,
294517,
314997,
290425,
288377,
325246,
333438,
235136,
280193,
282244,
239238,
288391,
323208,
282248,
286344,
179853,
286351,
188049,
239251,
229011,
280217,
323226,
179868,
229021,
302751,
282272,
198304,
245413,
282279,
298664,
212649,
298666,
317102,
286387,
300725,
337590,
286392,
300729,
302778,
306875,
280252,
280253,
282302,
296636,
286400,
323265,
323262,
280259,
333508,
282309,
321217,
296649,
239305,
306891,
280266,
212684,
302798,
9935,
241360,
282321,
333522,
286419,
313042,
241366,
280279,
282330,
18139,
280285,
294621,
282336,
325345,
321250,
294629,
153318,
333543,
12009,
282347,
288492,
282349,
34547,
67316,
323315,
286457,
284410,
200444,
288508,
282366,
286463,
319232,
278273,
288515,
280326,
282375,
323335,
284425,
300810,
282379,
216844,
280333,
284430,
116491,
300812,
161553,
124691,
284436,
278292,
278294,
282390,
116502,
118549,
325403,
321308,
321309,
282399,
241440,
282401,
186148,
186149,
315172,
241447,
333609,
294699,
286507,
284460,
280367,
300849,
282418,
280373,
282424,
280377,
321338,
319289,
282428,
280381,
345918,
241471,
413500,
280386,
325444,
280391,
153416,
325449,
315209,
159563,
280396,
307024,
337746,
317268,
325460,
307030,
18263,
237397,
241494,
188250,
284508,
300893,
307038,
237411,
284515,
276326,
282471,
296807,
292713,
282476,
292719,
296815,
313200,
313204,
317305,
124795,
317308,
339840,
182145,
315265,
280451,
325508,
333700,
243590,
282503,
67464,
327556,
188293,
325514,
305032,
315272,
315275,
184207,
311183,
124816,
279218,
282517,
294806,
214936,
337816,
294808,
329627,
239515,
124826,
214943,
298912,
319393,
294820,
219046,
333734,
294824,
298921,
284584,
313257,
292783,
126896,
200628,
300983,
343993,
288698,
98240,
294849,
214978,
280517,
280518,
214983,
282572,
282573,
372039,
153553,
24531,
231382,
329696,
323554,
292835,
190437,
292838,
294887,
317416,
313322,
278507,
329707,
311277,
296942,
298987,
124912,
327666,
278515,
325620,
239610
] |
251f1e26f01ea21725f6acf216c63315cdd7dedf | 7489e49d31d3a2859952ab01e9810bfa3c1fcad1 | /爱游UITests/__UITests.swift | 707f28bde05ae739af6b9245263ccef215158d74 | [] | no_license | zhangfang615/- | f4c77c0fdc040d24d7514a6cda253f3d20f58918 | 16382c6915ac2816ae571291a0ae35747001fb75 | refs/heads/master | 2021-09-02T06:10:12.915704 | 2017-12-30T23:18:34 | 2017-12-30T23:18:34 | 115,830,488 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,237 | swift | //
// __UITests.swift
// 爱游UITests
//
// Created by Fang Zhang on 2017/12/27.
// Copyright © 2017年 Fang Zhang. All rights reserved.
//
import XCTest
class __UITests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
// In UI tests it is usually best to stop immediately when a failure occurs.
continueAfterFailure = false
// UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
XCUIApplication().launch()
// In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
}
| [
155665,
237599,
229414,
278571,
229425,
229431,
180279,
319543,
213051,
286787,
237638,
311373,
196687,
278607,
311377,
368732,
180317,
278637,
319599,
278642,
131190,
131199,
278669,
278676,
311447,
327834,
278684,
278690,
311459,
278698,
278703,
278707,
180409,
278713,
295099,
139459,
131270,
229591,
147679,
311520,
147680,
319719,
295147,
286957,
319764,
278805,
311582,
278817,
311596,
336177,
98611,
278843,
287040,
319812,
311622,
319816,
229716,
278895,
287089,
139641,
311679,
311692,
106893,
156069,
311723,
377265,
311739,
319931,
278974,
336319,
311744,
278979,
336323,
278988,
278992,
279000,
369121,
279009,
188899,
279014,
319976,
279017,
311787,
319986,
279030,
311800,
279033,
279042,
287237,
377352,
279053,
303634,
303635,
279060,
279061,
279066,
188954,
279092,
377419,
303693,
115287,
189016,
295518,
287327,
279143,
279150,
287345,
287348,
189054,
287359,
303743,
164487,
279176,
311944,
344714,
311948,
311950,
311953,
336531,
287379,
295575,
303772,
221853,
205469,
279207,
295591,
295598,
279215,
279218,
287412,
164532,
287418,
303802,
66243,
287434,
287438,
164561,
303826,
279249,
369365,
369366,
279253,
230105,
295653,
230120,
279278,
312046,
230133,
279293,
205566,
295688,
312076,
295698,
221980,
336678,
262952,
262953,
279337,
262957,
164655,
328495,
303921,
230198,
222017,
295745,
279379,
295769,
230238,
230239,
279393,
303973,
279398,
295797,
295799,
279418,
336765,
287623,
279434,
320394,
189327,
189349,
279465,
304050,
189373,
213956,
345030,
213961,
279499,
304086,
304104,
123880,
320492,
320495,
287730,
320504,
312313,
214009,
312315,
312317,
418819,
320520,
230411,
320526,
238611,
140311,
238617,
197658,
336930,
132140,
189487,
312372,
238646,
238650,
320571,
336962,
238663,
205911,
296023,
156763,
230500,
279659,
238706,
312435,
279666,
230514,
279686,
222344,
337037,
296091,
238764,
279729,
148674,
312519,
279752,
148687,
189651,
279766,
189656,
279775,
304352,
304353,
279780,
279789,
279803,
320769,
312588,
320795,
320802,
304422,
312628,
345398,
222523,
181568,
279872,
279874,
304457,
345418,
230730,
337228,
296269,
222542,
238928,
296274,
230757,
296304,
312688,
230772,
337280,
296328,
296330,
304523,
9618,
279955,
148899,
279979,
279980,
173492,
279988,
280003,
370122,
280011,
337359,
329168,
312785,
222674,
329170,
280020,
280025,
239069,
320997,
280042,
280043,
329198,
337391,
296434,
288252,
312830,
230922,
329231,
304655,
230933,
222754,
312879,
230960,
288305,
239159,
157246,
288319,
288322,
280131,
124486,
288328,
239192,
99937,
345697,
312937,
312941,
206447,
288377,
337533,
280193,
239238,
288391,
239251,
280217,
198304,
337590,
280252,
296636,
280253,
321217,
280259,
321220,
296649,
239305,
280266,
9935,
313042,
280279,
18139,
280285,
321250,
337638,
181992,
288492,
34547,
67316,
313082,
288508,
288515,
280326,
116491,
280333,
124691,
116502,
321308,
321309,
280367,
280373,
280377,
321338,
280381,
345918,
280386,
280391,
280396,
337746,
18263,
370526,
296807,
296815,
313200,
313204,
124795,
182145,
280451,
67464,
305032,
124816,
214936,
337816,
124826,
329627,
239515,
214943,
313257,
288698,
214978,
280517,
280518,
214983,
231382,
329696,
190437,
313322,
329707,
174058,
296942,
124912,
313338,
239610,
182277,
313356,
305173,
223269,
354342,
354346,
313388,
124974,
321589,
215095,
288829,
288835,
313415,
239689,
354386,
223317,
354394,
321632,
280676,
313446,
215144,
288878,
288890,
215165,
329884,
215204,
125108,
280761,
223418,
280767,
338118,
280779,
321744,
280792,
280803,
182503,
338151,
125166,
125170,
395511,
313595,
125180,
125184,
125192,
125197,
125200,
125204,
338196,
125215,
125225,
338217,
321839,
125236,
280903,
289109,
379224,
239973,
313703,
280938,
321901,
354671,
354672,
199030,
223611,
248188,
313726,
240003,
158087,
313736,
240020,
190870,
190872,
289185,
305572,
289195,
338359,
289229,
281038,
281039,
281071,
322057,
182802,
322077,
289328,
338491,
322119,
281165,
281170,
281200,
313970,
297600,
289435,
314020,
248494,
166581,
314043,
363212,
158424,
322269,
338658,
289511,
330473,
330476,
289517,
215790,
125683,
199415,
289534,
322302,
35584,
322312,
346889,
166677,
207639,
281378,
289580,
281407,
289599,
281426,
281434,
322396,
281444,
207735,
314240,
158594,
330627,
240517,
289691,
240543,
289699,
289704,
289720,
289723,
281541,
19398,
191445,
183254,
183258,
207839,
314343,
183276,
289773,
248815,
240631,
330759,
322571,
330766,
330789,
248871,
281647,
322609,
314437,
207954,
339031,
314458,
281698,
281699,
322664,
314493,
150656,
347286,
330912,
339106,
306339,
249003,
208044,
322733,
3243,
339131,
290001,
339167,
298209,
290030,
208123,
322826,
126229,
298290,
208179,
159033,
216387,
372039,
224591,
331091,
314708,
150868,
314711,
314721,
281958,
314727,
134504,
306541,
314734,
314740,
314742,
314745,
290170,
224637,
306558,
290176,
306561,
314752,
314759,
298378,
314765,
314771,
306580,
224662,
282008,
314776,
282013,
290206,
314788,
314790,
282023,
298406,
241067,
314797,
306630,
306634,
339403,
191980,
282097,
306678,
191991,
290304,
323079,
323083,
323088,
282132,
282135,
175640,
282147,
306730,
290359,
323132,
282182,
224848,
224852,
290391,
306777,
323171,
282214,
224874,
314997,
290425,
339579,
282244,
323208,
282248,
323226,
282272,
282279,
298664,
298666,
306875,
282302,
323262,
323265,
282309,
306891,
241360,
282321,
241366,
282330,
282336,
12009,
282347,
282349,
323315,
200444,
282366,
249606,
282375,
323335,
282379,
216844,
118549,
282390,
282399,
241440,
282401,
339746,
315172,
216868,
241447,
282418,
282424,
282428,
413500,
241471,
315209,
159563,
307024,
307030,
241494,
307038,
282471,
282476,
339840,
315265,
282503,
315272,
315275,
184207,
282517,
298912,
118693,
298921,
126896,
200628,
282572,
282573,
323554,
298987,
282634,
241695,
315431,
102441,
315433,
102446,
282671,
241717,
307269,
233548,
315468,
315477,
323678,
315488,
315489,
45154,
217194,
233578,
307306,
249976,
241809,
323730,
299166,
233635,
299176,
184489,
323761,
184498,
258233,
299197,
299202,
176325,
299208,
233678,
282832,
356575,
307431,
184574,
217352,
315674,
282908,
299294,
282912,
233761,
282920,
315698,
307514,
282938,
127292,
168251,
323914,
201037,
282959,
250196,
168280,
323934,
381286,
242027,
242028,
250227,
315768,
315769,
291194,
291193,
291200,
242059,
315798,
291225,
242079,
283039,
299449,
291266,
373196,
283088,
283089,
242138,
176602,
160224,
291297,
242150,
283138,
233987,
324098,
340489,
283154,
291359,
283185,
234037,
340539,
234044,
332379,
111197,
242274,
291455,
316044,
184974,
316048,
316050,
340645,
176810,
299698,
291529,
225996,
135888,
242385,
299737,
234216,
234233,
242428,
291584,
299777,
291591,
291605,
283418,
234276,
283431,
242481,
234290,
201534,
283466,
201562,
234330,
275294,
349025,
357219,
177002,
308075,
242540,
242542,
201590,
177018,
308093,
291713,
340865,
299912,
316299,
234382,
308111,
308113,
209820,
283551,
177074,
127945,
340960,
234469,
340967,
324587,
234476,
201721,
234499,
234513,
316441,
300087,
21567,
308288,
160834,
349254,
300109,
234578,
250965,
250982,
234606,
300145,
300147,
234626,
234635,
177297,
308375,
324761,
119965,
234655,
300192,
234662,
300200,
324790,
300215,
283841,
283846,
283849,
316628,
251124,
234741,
283894,
316661,
292092,
234756,
242955,
177420,
292145,
300342,
193858,
300354,
300355,
234830,
283990,
357720,
300378,
300379,
316764,
292194,
284015,
234864,
316786,
243073,
292242,
112019,
234902,
333224,
284086,
259513,
284090,
54719,
415170,
292291,
300488,
300490,
234957,
144862,
300526,
308722,
300539,
210429,
292359,
218632,
316951,
374297,
235069,
349764,
194118,
292424,
292426,
333389,
349780,
128600,
235096,
300643,
300645,
243306,
325246,
333438,
235136,
317102,
300725,
333508,
333522,
325345,
153318,
333543,
284410,
284425,
300810,
300812,
284430,
161553,
284436,
325403,
341791,
325411,
186148,
186149,
333609,
284460,
300849,
325444,
153416,
325449,
317268,
325460,
341846,
284508,
300893,
284515,
276326,
292713,
292719,
325491,
317305,
317308,
325508,
333700,
243590,
243592,
325514,
350091,
350092,
350102,
333727,
219046,
333734,
284584,
292783,
300983,
153553,
292835,
292838,
317416,
325620,
333827,
243720,
292901,
325675,
243763,
325695,
227432,
194667,
284789,
292987,
227459,
194692,
235661,
333968,
153752,
284827,
333990,
284840,
284843,
227517,
309443,
227525,
301255,
227536,
301270,
301271,
325857,
317676,
309504,
194832,
227601,
325904,
334104,
211239,
334121,
317738,
325930,
227655,
383309,
391521,
285031,
416103,
227702,
211327,
227721,
285074,
227730,
285083,
293275,
317851,
227743,
285089,
293281,
301482,
375211,
334259,
293309,
317889,
129484,
326093,
285152,
195044,
334315,
236020,
293368,
317949,
334345,
309770,
342537,
342560,
227881,
293420,
236080,
23093,
244279,
244280,
301635,
309831,
55880,
301647,
326229,
309847,
244311,
244326,
301688,
301702,
334473,
326288,
227991,
285348,
318127,
285360,
293552,
285362,
342705,
154295,
342757,
285419,
170735,
342775,
375552,
228099,
285443,
285450,
326413,
285457,
285467,
318247,
293673,
318251,
301872,
285493,
285496,
301883,
342846,
293702,
318279,
244569,
301919,
293729,
351078,
310132,
228214,
269179,
228232,
416649,
236427,
252812,
293780,
310166,
277404,
310177,
293801,
326571,
326580,
326586,
359365,
211913,
326602,
56270,
203758,
277493,
293894,
293911,
326684,
113710,
318515,
203829,
277600,
285795,
228457,
318571,
187508,
302202,
285819,
285823,
285833,
318602,
285834,
228492,
162962,
187539,
285850,
302239,
302251,
294069,
294075,
64699,
228541,
343230,
310496,
228587,
302319,
228608,
318732,
245018,
318746,
130342,
130344,
130347,
286012,
294210,
286019,
294220,
318804,
294236,
327023,
327030,
310650,
179586,
294278,
318860,
368012,
318876,
343457,
245160,
286128,
286133,
310714,
302523,
228796,
302530,
228804,
310725,
302539,
310731,
310735,
327122,
310747,
286176,
187877,
310758,
40439,
286201,
359931,
286208,
245249,
228868,
302602,
294413,
359949,
302613,
302620,
310853,
286281,
196184,
212574,
204386,
204394,
138862,
310896,
294517,
286344,
179853,
286351,
188049,
229011,
179868,
229021,
302751,
245413,
212649,
286387,
286392,
302778,
286400,
212684,
302798,
286419,
294621,
294629,
286457,
286463,
319232,
278273,
278292,
278294,
294699,
286507,
319289,
237397,
188250,
237411,
327556,
188293,
311183,
294806,
294808,
319393,
294820,
294824,
343993,
98240,
294849,
24531,
294887,
278507,
311277,
327666,
278515
] |
97e6c752fa7c1c47869b88663fa5d76f0eb62439 | 90004bbf06f099243ca2e806fa5cf77fb66b92e1 | /PrimeModal/PrimeModal.swift | 3ddc51d1d484462ab1f31e301710bade2da99863 | [] | no_license | dev-yong/Composable-Architecture | 0df2e35d4255cc341b2cc17521bd40aa76454574 | 87c2a3cffabe282e6abb817e6bdce3cc27a7eabf | refs/heads/main | 2023-03-26T10:32:44.413780 | 2021-03-21T10:02:46 | 2021-03-21T10:02:46 | 304,803,424 | 3 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 709 | swift | //
// PrimeModal.swift
// PrimeModal
//
// Created by 이광용 on 2020/11/08.
//
import Foundation
import Core
public enum PrimeModalAction: Equatable {
case saveFavoritePrimeTapped
case removeFavoritePrimeTapped
}
public typealias PrimeModalState = (count: Int, favoritePrimes: [Int])
public func primeModalReducer(
state: inout PrimeModalState,
action: PrimeModalAction,
environment: Void
) -> [Effect<PrimeModalAction>] {
switch action {
case .removeFavoritePrimeTapped:
state.favoritePrimes.removeAll(where: { $0 == state.count })
return []
case .saveFavoritePrimeTapped:
state.favoritePrimes.append(state.count)
return []
}
}
| [
-1
] |
e1e85420020b6eee6f2ab4e18240ed0bb699d728 | 5d1e90f6567f5d56d5d438d1b44fd2f4ba9fe31a | /AColorStoryTest/AColorStoryTestTests/Builder/JSONBuilder.swift | 3fcc7b6f3b2ebf31a0383b6437abf984d311e99c | [] | no_license | ludoded/AColorStoryTest | 7e5cfd56336bf6411a4d6af292b9c3dc89b83ef4 | 192caba3f6392777e298e2572904815e1b33745b | refs/heads/master | 2021-01-19T09:14:28.665218 | 2017-02-15T15:57:05 | 2017-02-15T15:57:05 | 82,077,802 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 747 | swift | //
// JSONBuilder.swift
// AColorStoryTest
//
// Created by Haik Ampardjian on 15.02.17.
// Copyright © 2017 Haik Ampardjian. All rights reserved.
//
import XCTest
@testable import AColorStoryTest
class JSONBuilderTest: XCTestCase {
func testmakeSells() {
do {
let sells = try JSONBuilder().sells(from: "sells")
let first = sells.first
XCTAssertNotNil(first)
let testSell = first!
XCTAssertEqual(testSell.name, "apples")
XCTAssertEqual(testSell.baskets, [10,20,30])
XCTAssertEqual(testSell.unitCosts, 0.26)
}
catch let error {
XCTFail(error.localizedDescription)
}
}
}
| [
-1
] |
6c9251f5ed9de19e377c49c18af71197e42ba94a | 20cf692a676d6d594fadba890a7a960979d2487b | /Common/Models/Sync/AddToCollectionResult.swift | 6e5272a83ccdc78dfec72223264c0a1c9367faec | [
"MIT"
] | permissive | javikr/TraktKit | 5b7eed502edcdb9a4f1c6edeff6086f38c5b5964 | 1d4b2757107d1b17f9c59ab4b3080d28afcade95 | refs/heads/master | 2020-09-11T13:12:07.976576 | 2020-04-25T08:34:23 | 2020-04-25T08:34:23 | 222,075,099 | 0 | 0 | MIT | 2019-11-16T09:20:23 | 2019-11-16T09:20:23 | null | UTF-8 | Swift | false | false | 726 | swift | //
// AddToCollectionResult.swift
// TraktKit
//
// Created by Maximilian Litteral on 8/12/17.
// Copyright © 2017 Maximilian Litteral. All rights reserved.
//
import Foundation
public struct AddToCollectionResult: Codable {
let added: Added
let updated: Added
let existing: Added
// let notFound: NotFound
public struct Added: Codable {
let movies: Int
let episodes: Int
}
public struct NotFound: Codable {
let movies: [ID]
let shows: [ID]
let seasons: [ID]
let episodes: [ID]
}
enum CodingKeys: String, CodingKey {
case added
case updated
case existing
// case notFound = "not_found"
}
}
| [
-1
] |
36928c7a3a9a4f9e2d3f9278d79585cf00c72c7f | e2d48a6a5ced1b5e38ec649ad36bacf8d382d450 | /BLShopping/BLShopping/CustomViews/ProductSpectItemCell.swift | f03df83a840f8e0737fa3af90522dcc6d6bd79b6 | [] | no_license | baolanlequang/blshopping-ios | b2ca4696c010cc327923500c0dadc5970b23069b | eae5832b54cba6caa941dd769d572c39f214a351 | refs/heads/master | 2022-02-21T11:47:39.088432 | 2019-09-26T10:54:33 | 2019-09-26T10:54:33 | 204,253,987 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 762 | swift | //
// ProductSpectItemCell.swift
// BLShopping
//
// Created by Bao Lan Le Quang on 8/30/19.
// Copyright © 2019 BLShopping. All rights reserved.
//
import UIKit
class ProductSpectItemCell: UITableViewCell {
@IBOutlet weak var lblName: UILabel!
@IBOutlet weak var lblValue: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
//TODO: set color
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
func setData(specDTO: ProductSpecsDTO) {
self.lblName.text = specDTO.name;
self.lblValue.text = specDTO.value;
}
}
| [
-1
] |
66d74432e6dfc751c9b925c88d113f936de61605 | ae9f43bdde0f52e22502adea6e5c51f6fc6c50d3 | /Sources/config.swift | ff7bc399720133eec056a6ae80bf4fde8de439a6 | [
"Apache-2.0"
] | permissive | goodnighthsu/PerfectServer | 0d525be2d90f2da5e16209f50353e857c51824a9 | b4bcb22fcbab4bc277b6226e0567539444d9e63a | refs/heads/master | 2021-01-25T05:50:22.651037 | 2017-06-29T07:27:44 | 2017-06-29T07:27:44 | 80,688,227 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 792 | swift | //
// config.swift
// PerfectServer
//
// Created by 徐非 on 17/2/7.
//
//
import Foundation
//MARK: JWT
let JWTSecret = "Leon Perfect"
//MARK: Web
#if os(Linux)
let rootDirectory = "/home/PerfectServer/"
let documentRoot = "/home/PerfectServer/webroot"
#else
let rootDirectory = NSHomeDirectory() + "/PerfectServer"
let documentRoot = "./webroot"
#endif
let logDirectory = rootDirectory + "/log"
let logFile = logDirectory + "/perfectLog.log"
//MAKR: MySql
#if os(Linux)
let mySqlHost = "192.168.42.1"
let mySqlUserName = "root"
let mySqlPassword = "Wxgoogle123"
let mySqlDatabase = "crm_0223"
let mySqlPort = 3306
#else
let mySqlHost = "127.0.0.1"
let mySqlUserName = "root"
let mySqlPassword = "a123456"
let mySqlDatabase = "crm_0223"
let mySqlPort = 3306
#endif
| [
-1
] |
afe8b69336e526eb8d55926fba18f49e0a8410ef | edaa4d8ba1f0514f8c4eec3f3dea979fe406fdef | /Tests/NIOTests/EventLoopTest.swift | 48f1db74f2805663915eefaa8024912546774baf | [
"BSD-3-Clause",
"MIT",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | vguerra/swift-nio | 55fb4c454f6a90cbdd3bcb846736c6fbee93697e | de8d3e260e54ee27d55d82d48a552236d57a704e | refs/heads/master | 2020-04-18T07:54:25.386166 | 2019-01-25T16:11:23 | 2019-01-25T16:11:23 | 167,376,742 | 0 | 0 | null | 2019-01-24T14:01:23 | 2019-01-24T14:01:23 | null | UTF-8 | Swift | false | false | 23,141 | swift | //===----------------------------------------------------------------------===//
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of SwiftNIO project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import XCTest
@testable import NIO
import Dispatch
import NIOConcurrencyHelpers
public class EventLoopTest : XCTestCase {
public func testSchedule() throws {
let nanos = DispatchTime.now().uptimeNanoseconds
let amount: TimeAmount = .seconds(1)
let eventLoopGroup = MultiThreadedEventLoopGroup(numberOfThreads: 1)
defer {
XCTAssertNoThrow(try eventLoopGroup.syncShutdownGracefully())
}
let value = try eventLoopGroup.next().scheduleTask(in: amount) {
true
}.futureResult.wait()
XCTAssertTrue(DispatchTime.now().uptimeNanoseconds - nanos >= amount.nanoseconds)
XCTAssertTrue(value)
}
public func testScheduleWithDelay() throws {
let smallAmount: TimeAmount = .milliseconds(100)
let longAmount: TimeAmount = .seconds(1)
let eventLoopGroup = MultiThreadedEventLoopGroup(numberOfThreads: 1)
defer {
XCTAssertNoThrow(try eventLoopGroup.syncShutdownGracefully())
}
// First, we create a server and client channel, but don't connect them.
let serverChannel = try assertNoThrowWithValue(ServerBootstrap(group: eventLoopGroup)
.serverChannelOption(ChannelOptions.socket(SocketOptionLevel(SOL_SOCKET), SO_REUSEADDR), value: 1)
.bind(host: "127.0.0.1", port: 0).wait())
let clientBootstrap = ClientBootstrap(group: eventLoopGroup)
// Now, schedule two tasks: one that takes a while, one that doesn't.
let nanos = DispatchTime.now().uptimeNanoseconds
let longFuture = eventLoopGroup.next().scheduleTask(in: longAmount) {
true
}.futureResult
XCTAssertTrue(try assertNoThrowWithValue(try eventLoopGroup.next().scheduleTask(in: smallAmount) {
true
}.futureResult.wait()))
// Ok, the short one has happened. Now we should try connecting them. This connect should happen
// faster than the final task firing.
_ = try assertNoThrowWithValue(clientBootstrap.connect(to: serverChannel.localAddress!).wait()) as Channel
XCTAssertTrue(DispatchTime.now().uptimeNanoseconds - nanos < longAmount.nanoseconds)
// Now wait for the long-delayed task.
XCTAssertTrue(try assertNoThrowWithValue(try longFuture.wait()))
// Now we're ok.
XCTAssertTrue(DispatchTime.now().uptimeNanoseconds - nanos >= longAmount.nanoseconds)
}
public func testScheduleCancelled() throws {
let eventLoopGroup = MultiThreadedEventLoopGroup(numberOfThreads: 1)
defer {
XCTAssertNoThrow(try eventLoopGroup.syncShutdownGracefully())
}
let ran = Atomic<Bool>(value: false)
let scheduled = eventLoopGroup.next().scheduleTask(in: .seconds(2)) {
ran.store(true)
}
scheduled.cancel()
let nanos = DispatchTime.now().uptimeNanoseconds
let amount: TimeAmount = .seconds(2)
let value = try eventLoopGroup.next().scheduleTask(in: amount) {
true
}.futureResult.wait()
XCTAssertTrue(DispatchTime.now().uptimeNanoseconds - nanos >= amount.nanoseconds)
XCTAssertTrue(value)
XCTAssertFalse(ran.load())
}
public func testScheduleRepeatedTask() throws {
let nanos = DispatchTime.now().uptimeNanoseconds
let initialDelay: TimeAmount = .milliseconds(5)
let delay: TimeAmount = .milliseconds(10)
let count = 5
let eventLoopGroup = MultiThreadedEventLoopGroup(numberOfThreads: 1)
defer {
XCTAssertNoThrow(try eventLoopGroup.syncShutdownGracefully())
}
let expect = expectation(description: "Is cancelling RepatedTask")
let counter = Atomic<Int>(value: 0)
let loop = eventLoopGroup.next()
loop.scheduleRepeatedTask(initialDelay: initialDelay, delay: delay) { repeatedTask -> Void in
XCTAssertTrue(loop.inEventLoop)
let initialValue = counter.load()
_ = counter.add(1)
if initialValue == 0 {
XCTAssertTrue(DispatchTime.now().uptimeNanoseconds - nanos >= initialDelay.nanoseconds)
} else if initialValue == count {
expect.fulfill()
repeatedTask.cancel()
}
}
waitForExpectations(timeout: 1) { error in
XCTAssertNil(error)
XCTAssertEqual(counter.load(), count + 1)
XCTAssertTrue(DispatchTime.now().uptimeNanoseconds - nanos >= initialDelay.nanoseconds + numericCast(count) * delay.nanoseconds)
}
}
public func testScheduledTaskThatIsImmediatelyCancelledNeverFires() throws {
let eventLoopGroup = MultiThreadedEventLoopGroup(numberOfThreads: 1)
defer {
XCTAssertNoThrow(try eventLoopGroup.syncShutdownGracefully())
}
let loop = eventLoopGroup.next()
loop.execute {
let task = loop.scheduleTask(in: .milliseconds(0)) {
XCTFail()
}
task.cancel()
}
Thread.sleep(until: .init(timeIntervalSinceNow: 0.1))
}
public func testRepeatedTaskThatIsImmediatelyCancelledNeverFires() throws {
let eventLoopGroup = MultiThreadedEventLoopGroup(numberOfThreads: 1)
defer {
XCTAssertNoThrow(try eventLoopGroup.syncShutdownGracefully())
}
let loop = eventLoopGroup.next()
loop.execute {
let task = loop.scheduleRepeatedTask(initialDelay: .milliseconds(0), delay: .milliseconds(0)) { task in
XCTFail()
}
task.cancel()
}
Thread.sleep(until: .init(timeIntervalSinceNow: 0.1))
}
public func testScheduleRepeatedTaskCancelFromDifferentThread() throws {
let nanos = DispatchTime.now().uptimeNanoseconds
let initialDelay: TimeAmount = .milliseconds(5)
let delay: TimeAmount = .milliseconds(0) // this will actually force the race from issue #554 to happen frequently
let eventLoopGroup = MultiThreadedEventLoopGroup(numberOfThreads: 1)
defer {
XCTAssertNoThrow(try eventLoopGroup.syncShutdownGracefully())
}
let expect = expectation(description: "Is cancelling RepatedTask")
let group = DispatchGroup()
let loop = eventLoopGroup.next()
group.enter()
var isAllowedToFire = true // read/write only on `loop`
var hasFired = false // read/write only on `loop`
let repeatedTask = loop.scheduleRepeatedTask(initialDelay: initialDelay, delay: delay) { (_: RepeatedTask) -> Void in
XCTAssertTrue(loop.inEventLoop)
if !hasFired {
// we can only do this once as we can only leave the DispatchGroup once but we might lose a race and
// the timer might fire more than once (until `shouldNoLongerFire` becomes true).
hasFired = true
group.leave()
expect.fulfill()
}
XCTAssertTrue(isAllowedToFire)
}
group.notify(queue: DispatchQueue.global()) {
repeatedTask.cancel()
loop.execute {
// only now do we know that the `cancel` must have gone through
isAllowedToFire = false
}
}
waitForExpectations(timeout: 1) { error in
XCTAssertNil(error)
XCTAssertTrue(DispatchTime.now().uptimeNanoseconds - nanos >= initialDelay.nanoseconds)
}
}
public func testScheduleRepeatedTaskToNotRetainRepeatedTask() throws {
let initialDelay: TimeAmount = .milliseconds(5)
let delay: TimeAmount = .milliseconds(10)
let eventLoopGroup = MultiThreadedEventLoopGroup(numberOfThreads: 1)
weak var weakRepeated: RepeatedTask?
try { () -> Void in
let repeated = eventLoopGroup.next().scheduleRepeatedTask(initialDelay: initialDelay, delay: delay) { (_: RepeatedTask) -> Void in }
weakRepeated = repeated
XCTAssertNotNil(weakRepeated)
repeated.cancel()
XCTAssertNoThrow(try eventLoopGroup.syncShutdownGracefully())
}()
assert(weakRepeated == nil, within: .seconds(1))
}
public func testScheduleRepeatedTaskToNotRetainEventLoop() throws {
weak var weakEventLoop: EventLoop? = nil
try {
let initialDelay: TimeAmount = .milliseconds(5)
let delay: TimeAmount = .milliseconds(10)
let eventLoopGroup = MultiThreadedEventLoopGroup(numberOfThreads: 1)
weakEventLoop = eventLoopGroup.next()
XCTAssertNotNil(weakEventLoop)
eventLoopGroup.next().scheduleRepeatedTask(initialDelay: initialDelay, delay: delay) { (_: RepeatedTask) -> Void in }
XCTAssertNoThrow(try eventLoopGroup.syncShutdownGracefully())
}()
assert(weakEventLoop == nil, within: .seconds(1))
}
public func testEventLoopGroupMakeIterator() throws {
let eventLoopGroup = MultiThreadedEventLoopGroup(numberOfThreads: System.coreCount)
defer {
XCTAssertNoThrow(try eventLoopGroup.syncShutdownGracefully())
}
var counter = 0
var innerCounter = 0
eventLoopGroup.makeIterator().forEach { loop in
counter += 1
loop.makeIterator().forEach { _ in
innerCounter += 1
}
}
XCTAssertEqual(counter, System.coreCount)
XCTAssertEqual(innerCounter, System.coreCount)
}
public func testEventLoopMakeIterator() throws {
let eventLoop = EmbeddedEventLoop()
var iterator = eventLoop.makeIterator()
defer {
XCTAssertNoThrow(try eventLoop.syncShutdownGracefully())
}
var counter = 0
iterator.forEach { loop in
XCTAssertTrue(loop === eventLoop)
counter += 1
}
XCTAssertEqual(counter, 1)
}
public func testMultipleShutdown() throws {
// This test catches a regression that causes it to intermittently fail: it reveals bugs in synchronous shutdown.
// Do not ignore intermittent failures in this test!
let threads = 8
let numBytes = 256
let group = MultiThreadedEventLoopGroup(numberOfThreads: threads)
// Create a server channel.
let serverChannel = try assertNoThrowWithValue(ServerBootstrap(group: group)
.serverChannelOption(ChannelOptions.socket(SocketOptionLevel(SOL_SOCKET), SO_REUSEADDR), value: 1)
.bind(host: "127.0.0.1", port: 0).wait())
// We now want to connect to it. To try to slow this stuff down, we're going to use a multiple of the number
// of event loops.
for _ in 0..<(threads * 5) {
let clientChannel = try assertNoThrowWithValue(ClientBootstrap(group: group)
.connect(to: serverChannel.localAddress!)
.wait())
var buffer = clientChannel.allocator.buffer(capacity: numBytes)
for i in 0..<numBytes {
buffer.write(integer: UInt8(i % 256))
}
try clientChannel.writeAndFlush(NIOAny(buffer)).wait()
}
// We should now shut down gracefully.
try group.syncShutdownGracefully()
}
public func testShuttingDownFailsRegistration() throws {
// This test catches a regression where the selectable event loop would allow a socket registration while
// it was nominally "shutting down". To do this, we take advantage of the fact that the event loop attempts
// to cleanly shut down all the channels before it actually closes. We add a custom channel that we can use
// to wedge the event loop in the "shutting down" state, ensuring that we have plenty of time to attempt the
// registration.
class WedgeOpenHandler: ChannelDuplexHandler {
typealias InboundIn = Any
typealias OutboundIn = Any
typealias OutboundOut = Any
private let promiseRegisterCallback: (EventLoopPromise<Void>) -> Void
var closePromise: EventLoopPromise<Void>? = nil
private let channelActivePromise: EventLoopPromise<Void>?
init(channelActivePromise: EventLoopPromise<Void>? = nil, _ promiseRegisterCallback: @escaping (EventLoopPromise<Void>) -> Void) {
self.promiseRegisterCallback = promiseRegisterCallback
self.channelActivePromise = channelActivePromise
}
func channelActive(ctx: ChannelHandlerContext) {
self.channelActivePromise?.succeed(())
}
func close(ctx: ChannelHandlerContext, mode: CloseMode, promise: EventLoopPromise<Void>?) {
guard self.closePromise == nil else {
XCTFail("Attempted to create duplicate close promise")
return
}
XCTAssertTrue(ctx.channel.isActive)
self.closePromise = ctx.eventLoop.makePromise()
self.closePromise!.futureResult.whenSuccess {
ctx.close(mode: mode, promise: promise)
}
promiseRegisterCallback(self.closePromise!)
}
}
let promiseQueue = DispatchQueue(label: "promiseQueue")
var promises: [EventLoopPromise<Void>] = []
let group = MultiThreadedEventLoopGroup(numberOfThreads: 1)
defer {
do {
try group.syncShutdownGracefully()
} catch EventLoopError.shutdown {
// Fine, that's expected if the test completed.
} catch {
XCTFail("Unexpected error on close: \(error)")
}
}
let loop = group.next() as! SelectableEventLoop
let serverChannelUp = group.next().makePromise(of: Void.self)
let serverChannel = try assertNoThrowWithValue(ServerBootstrap(group: group)
.childChannelInitializer { channel in
channel.pipeline.add(handler: WedgeOpenHandler(channelActivePromise: serverChannelUp) { promise in
promiseQueue.sync { promises.append(promise) }
})
}
.bind(host: "127.0.0.1", port: 0).wait())
defer {
XCTAssertNoThrow(try serverChannel.syncCloseAcceptingAlreadyClosed())
}
let connectPromise = loop.makePromise(of: Void.self)
// We're going to create and register a channel, but not actually attempt to do anything with it.
let wedgeHandler = WedgeOpenHandler { promise in
promiseQueue.sync { promises.append(promise) }
}
let channel = try SocketChannel(eventLoop: loop, protocolFamily: AF_INET)
try channel.eventLoop.submit {
channel.pipeline.add(handler: wedgeHandler).flatMap {
channel.register()
}.flatMap {
// connecting here to stop epoll from throwing EPOLLHUP at us
channel.connect(to: serverChannel.localAddress!)
}.cascade(promise: connectPromise)
}.wait()
// Wait for the connect to complete.
XCTAssertNoThrow(try connectPromise.futureResult.wait())
XCTAssertNoThrow(try serverChannelUp.futureResult.wait())
// Now we're going to start closing the event loop. This should not immediately succeed.
let loopCloseFut = loop.closeGently()
// Now we're going to attempt to register a new channel. This should immediately fail.
let newChannel = try SocketChannel(eventLoop: loop, protocolFamily: AF_INET)
do {
try newChannel.register().wait()
XCTFail("Register did not throw")
} catch EventLoopError.shutdown {
// All good
} catch {
XCTFail("Unexpected error: \(error)")
}
// Confirm that the loop still hasn't closed.
XCTAssertFalse(loopCloseFut.isFulfilled)
// Now let it close.
promiseQueue.sync {
promises.forEach { $0.succeed(()) }
}
XCTAssertNoThrow(try loopCloseFut.wait())
}
public func testEventLoopThreads() throws {
var counter = 0
let body: ThreadInitializer = { t in
counter += 1
}
let threads: [ThreadInitializer] = [body, body]
let group = MultiThreadedEventLoopGroup(threadInitializers: threads)
XCTAssertEqual(2, counter)
XCTAssertNoThrow(try group.syncShutdownGracefully())
}
public func testEventLoopPinned() throws {
#if os(Linux)
let body: ThreadInitializer = { t in
let set = LinuxCPUSet(0)
t.affinity = set
XCTAssertEqual(set, t.affinity)
}
let threads: [ThreadInitializer] = [body, body]
let group = MultiThreadedEventLoopGroup(threadInitializers: threads)
XCTAssertNoThrow(try group.syncShutdownGracefully())
#endif
}
public func testEventLoopPinnedCPUIdsConstructor() throws {
#if os(Linux)
let group = MultiThreadedEventLoopGroup(pinnedCPUIds: [0])
let eventLoop = group.next()
let set = try eventLoop.submit {
NIO.Thread.current.affinity
}.wait()
XCTAssertEqual(LinuxCPUSet(0), set)
XCTAssertNoThrow(try group.syncShutdownGracefully())
#endif
}
public func testCurrentEventLoop() throws {
class EventLoopHolder {
weak var loop: EventLoop?
init(_ loop: EventLoop) {
self.loop = loop
}
}
func assertCurrentEventLoop0() throws -> EventLoopHolder {
let group = MultiThreadedEventLoopGroup(numberOfThreads: 2)
let loop1 = group.next()
let currentLoop1 = try loop1.submit {
MultiThreadedEventLoopGroup.currentEventLoop
}.wait()
XCTAssertTrue(loop1 === currentLoop1)
let loop2 = group.next()
let currentLoop2 = try loop2.submit {
MultiThreadedEventLoopGroup.currentEventLoop
}.wait()
XCTAssertTrue(loop2 === currentLoop2)
XCTAssertFalse(loop1 === loop2)
let holder = EventLoopHolder(loop2)
XCTAssertNotNil(holder.loop)
XCTAssertNil(MultiThreadedEventLoopGroup.currentEventLoop)
XCTAssertNoThrow(try group.syncShutdownGracefully())
return holder
}
let holder = try assertCurrentEventLoop0()
// We loop as the Thread used by SelectableEventLoop may not be gone yet.
// In the next major version we should ensure to join all threads and so be sure all are gone when
// syncShutdownGracefully returned.
var tries = 0
while holder.loop != nil {
XCTAssertTrue(tries < 5, "Reference to EventLoop still alive after 5 seconds")
sleep(1)
tries += 1
}
}
public func testShutdownWhileScheduledTasksNotReady() throws {
let group = MultiThreadedEventLoopGroup(numberOfThreads: 1)
let eventLoop = group.next()
_ = eventLoop.scheduleTask(in: .hours(1)) { }
try group.syncShutdownGracefully()
}
public func testCloseFutureNotifiedBeforeUnblock() throws {
class AssertHandler: ChannelInboundHandler {
typealias InboundIn = Any
let groupIsShutdown = Atomic(value: false)
let removed = Atomic(value: false)
public func handlerRemoved(ctx: ChannelHandlerContext) {
XCTAssertFalse(groupIsShutdown.load())
XCTAssertTrue(removed.compareAndExchange(expected: false, desired: true))
}
}
let group = MultiThreadedEventLoopGroup(numberOfThreads: 1)
let eventLoop = group.next()
let assertHandler = AssertHandler()
let serverSocket = try assertNoThrowWithValue(ServerBootstrap(group: group)
.bind(host: "localhost", port: 0).wait())
let channel = try assertNoThrowWithValue(SocketChannel(eventLoop: eventLoop as! SelectableEventLoop,
protocolFamily: serverSocket.localAddress!.protocolFamily))
XCTAssertNoThrow(try channel.pipeline.add(handler: assertHandler).wait() as Void)
XCTAssertNoThrow(try channel.eventLoop.submit {
channel.register().flatMap {
channel.connect(to: serverSocket.localAddress!)
}
}.wait().wait() as Void)
XCTAssertFalse(channel.closeFuture.isFulfilled)
XCTAssertNoThrow(try group.syncShutdownGracefully())
XCTAssertTrue(assertHandler.groupIsShutdown.compareAndExchange(expected: false, desired: true))
XCTAssertTrue(assertHandler.removed.load())
XCTAssertTrue(channel.closeFuture.isFulfilled)
XCTAssertFalse(channel.isActive)
}
public func testScheduleMultipleTasks() throws {
let nanos = DispatchTime.now().uptimeNanoseconds
let amount: TimeAmount = .seconds(1)
let eventLoopGroup = MultiThreadedEventLoopGroup(numberOfThreads: 1)
defer {
XCTAssertNoThrow(try eventLoopGroup.syncShutdownGracefully())
}
var array = Array<(Int, DispatchTime)>()
let scheduled1 = eventLoopGroup.next().scheduleTask(in: .milliseconds(500)) {
array.append((1, DispatchTime.now()))
}
let scheduled2 = eventLoopGroup.next().scheduleTask(in: .milliseconds(100)) {
array.append((2, DispatchTime.now()))
}
let scheduled3 = eventLoopGroup.next().scheduleTask(in: .milliseconds(1000)) {
array.append((3, DispatchTime.now()))
}
var result = try eventLoopGroup.next().scheduleTask(in: .milliseconds(1000)) {
array
}.futureResult.wait()
XCTAssertTrue(scheduled1.futureResult.isFulfilled)
XCTAssertTrue(scheduled2.futureResult.isFulfilled)
XCTAssertTrue(scheduled3.futureResult.isFulfilled)
let first = result.removeFirst()
XCTAssertEqual(2, first.0)
let second = result.removeFirst()
XCTAssertEqual(1, second.0)
let third = result.removeFirst()
XCTAssertEqual(3, third.0)
XCTAssertTrue(first.1 < second.1)
XCTAssertTrue(second.1 < third.1)
XCTAssertTrue(result.isEmpty)
}
}
| [
-1
] |
17abb73b0a8a179f0dedbd4896f368d090118f1b | 75df0d9345d1986fb5fde74a499d93b7d11b8ca8 | /Nomadic/Helper/PlaySound.swift | 188c8235f3ddfb8c8f7ec0a8e27277f523600b0b | [
"Apache-2.0"
] | permissive | shameemreza/nomadic | 9305a0dc296c8f7a7359af22019cf9317b5a3634 | 02e5fede761ae0ff65afda972f5959bb9c70637d | refs/heads/master | 2023-05-31T00:16:17.977139 | 2021-06-04T23:14:28 | 2021-06-04T23:14:28 | 373,974,313 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 451 | swift | //
// PlaySound.swift
// Nomadic
//
// Created by Shameem Reza on 5/6/21.
//
import AVFoundation
var audioPlayer: AVAudioPlayer?
func playSound(sound: String, type: String) {
if let path = Bundle.main.path(forResource: sound, ofType: type) {
do {
audioPlayer = try AVAudioPlayer(contentsOf: URL(fileURLWithPath: path))
audioPlayer?.play()
} catch {
print("ERROR: Could not find and play the sound file!")
}
}
}
| [
418503,
184247
] |
452da4c76bee40ad04ed0c52269d280f5f0a05a5 | 33f91fd82d62ba6313af03cf0b8e9aed888b4c91 | /Crusade/Crusade/AddressListController.swift | 3cb86efc7f3fadcc7eb4ea05942a1d06cee7d359 | [] | no_license | ericziegler/Crusade | 9383071ae945eb49797ca563eb68b478c9688d73 | dcee86905e365b4df346d6efaff1273c693d2f2e | refs/heads/master | 2020-11-27T12:48:12.386359 | 2020-03-16T12:50:23 | 2020-03-16T12:50:23 | 229,446,784 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,122 | swift | //
// AddressListController.swift
// Crusade
//
// Created by Eric Ziegler on 12/25/19.
// Copyright © 2019 Zigabytes. All rights reserved.
//
import UIKit
// MARK: - Constants
let AddressListControllerId = "AddressListControllerId"
class AddressListController: BaseViewController {
// MARK: - Properties
@IBOutlet var addressTable: UITableView!
@IBOutlet var noDataView: UIView!
var routeManager = RouteManager.shared
// MARK: - Init
class func createController() -> AddressListController {
let storyboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let viewController: AddressListController = storyboard.instantiateViewController(withIdentifier: AddressListControllerId) as! AddressListController
return viewController
}
override func viewDidLoad() {
super.viewDidLoad()
setupNavBar()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
addressTable.reloadData()
noDataView.isHidden = (routeManager.locationCount == 0) ? false : true
}
private func setupNavBar() {
self.title = "Addresses"
self.navigationController?.navigationBar.titleTextAttributes = navTitleTextAttributes()
var closeItem = UIBarButtonItem(title: "Done", style: .plain, target: self, action: #selector(closeTapped(_:)))
if #available(iOS 13.0, *) {
closeItem = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(closeTapped(_:)))
}
self.navigationItem.leftBarButtonItem = closeItem
var addItem = UIBarButtonItem(title: "Add", style: .plain, target: self, action: #selector(addTapped(_:)))
if #available(iOS 13.0, *) {
addItem = UIBarButtonItem(barButtonSystemItem: .add, target: self, action: #selector(addTapped(_:)))
}
var removeAllItem = UIBarButtonItem(title: "Clear All", style: .plain, target: self, action: #selector(removeAllTapped(_:)))
if #available(iOS 13.0, *) {
removeAllItem = UIBarButtonItem(barButtonSystemItem: .trash, target: self, action: #selector(removeAllTapped(_:)))
}
self.navigationItem.rightBarButtonItems = [addItem, removeAllItem]
}
// MARK: - Actions
@IBAction func closeTapped(_ sender: AnyObject) {
self.dismiss(animated: true, completion: nil)
}
@IBAction func addTapped(_ sender: AnyObject) {
let controller = AddAddressListController.createController()
let navController = BaseNavigationController(rootViewController: controller)
navController.modalPresentationStyle = .fullScreen
self.present(navController, animated: true, completion: nil)
}
@IBAction func removeAllTapped(_ sender: AnyObject) {
let alert = UIAlertController(title: "", message: "", preferredStyle: .alert)
// custom title
let titleString = "Are you sure you would like to remove all addresses?"
alert.setValue(NSAttributedString(string: titleString, attributes: [NSAttributedString.Key.font : UIFont.applicationBoldFontOfSize(20), .foregroundColor : UIColor.appBlack]), forKey: "attributedTitle")
// cancel action
let cancelAction = UIAlertAction(title: "Cancel", style: .cancel, handler: nil)
alert.addAction(cancelAction)
// destrictove action
let removeAllAction = UIAlertAction(title: "Remove All", style: .destructive) { (action) in
self.routeManager.removeAll()
self.routeManager.saveRoute()
self.addressTable.reloadData()
self.noDataView.isHidden = (self.routeManager.locationCount == 0) ? false : true
}
alert.addAction(removeAllAction)
self.present(alert, animated: true, completion: nil)
}
}
// MARK: - UITableViewDataSource, UITableViewDelegate
extension AddressListController: UITableViewDataSource, UITableViewDelegate {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return routeManager.locationsSortedByAddress.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: AddressCellId, for: indexPath) as! AddressCell
let location = routeManager.locationsSortedByAddress[indexPath.row]
cell.layoutFor(location: location)
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return AddressCellHeight
}
func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
if editingStyle == .delete {
let location = routeManager.locationsSortedByAddress[indexPath.row]
routeManager.remove(location: location)
routeManager.saveRoute()
tableView.deleteRows(at: [indexPath], with: .fade)
noDataView.isHidden = (routeManager.locationCount == 0) ? false : true
}
}
}
| [
-1
] |
52d3c5a84842b906590ea3df566a986b1711cbd3 | d3ede7824b05755055332a1e44edad1f0e2b1141 | /Fosi/OpenTabsViewController.swift | 9e7f927d51b4c5c5a554a6dd3df93ad524580072 | [
"MIT"
] | permissive | chinmaymk/fosi | 3abc999c0c786d86b5c0ebf144f1bc5cf2d65efb | 98e7589ec398ca118f9daea6d7dc920badbaaa5a | refs/heads/master | 2023-07-24T03:24:45.711093 | 2021-09-06T18:17:10 | 2021-09-06T18:17:10 | 326,532,513 | 2 | 0 | MIT | 2021-02-20T20:18:35 | 2021-01-04T00:55:24 | JavaScript | UTF-8 | Swift | false | false | 4,966 | swift | //
// OpenTabsViewController.swift
// Fosi
//
// Created by Chinmay Kulkarni on 1/1/21.
//
import Foundation
import UIKit
import iCarousel
import WebKit
class OpenTabsViewController: UIViewController, iCarouselDataSource {
let collectionView = iCarousel(frame: .zero)
var pool: WebviewPool?
var projected: Array<(WebviewPool.Index, WebviewPool.Item)> {
get {
return pool?.sorted(by: .createdAt) ?? []
}
}
var openSelectedTab: ((WKWebView) -> Void)?
var tabDidClose: ((WKWebView) -> Void)?
var allTabsClosed: (() -> Void)?
var heightMultiplier: CGFloat {
get {
switch UIDevice.current.orientation {
case .landscapeLeft, .landscapeRight:
return CGFloat(0.6)
default:
return CGFloat(0.6)
}
}
}
var widthMultiplier: CGFloat {
get {
switch UIDevice.current.orientation {
case .landscapeLeft, .landscapeRight:
return CGFloat(0.3)
default:
return CGFloat(0.6)
}
}
}
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
}
override func viewDidLoad() {
view.backgroundColor = .systemFill
collectionView.dataSource = self
collectionView.type = .coverFlow
collectionView.currentItemIndex = 0
collectionView.layer.cornerRadius = 10
collectionView.clipsToBounds = true
collectionView.backgroundColor = .systemBackground
collectionView.translatesAutoresizingMaskIntoConstraints = false
let closeGesture = UISwipeGestureRecognizer(
target: self, action: #selector(dismissTabsViewer)
)
closeGesture.direction = .down
collectionView.addGestureRecognizer(closeGesture)
let closeAll = UIButton(type: .system)
closeAll.setTitle("Close All", for: .normal)
closeAll.tintColor = .systemRed
closeAll.addTarget(self, action: #selector(closeAllTabs), for: .touchUpInside)
closeAll.backgroundColor = .systemBackground
closeAll.translatesAutoresizingMaskIntoConstraints = false
let bottomMask = UIView()
bottomMask.backgroundColor = .systemBackground
bottomMask.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(collectionView)
view.addSubview(closeAll)
view.addSubview(bottomMask)
NSLayoutConstraint.activate([
collectionView.centerXAnchor.constraint(equalTo: view.centerXAnchor),
collectionView.widthAnchor.constraint(equalTo: view.widthAnchor),
collectionView.bottomAnchor.constraint(equalTo: closeAll.topAnchor, constant: 10),
collectionView.heightAnchor.constraint(
equalTo: view.heightAnchor, multiplier: CGFloat(heightMultiplier) + 0.12
),
closeAll.centerXAnchor.constraint(equalTo: view.centerXAnchor),
closeAll.bottomAnchor.constraint(
equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -30
),
closeAll.heightAnchor.constraint(equalToConstant: 50),
closeAll.widthAnchor.constraint(equalTo: view.widthAnchor),
bottomMask.topAnchor.constraint(equalTo: closeAll.bottomAnchor),
bottomMask.bottomAnchor.constraint(equalTo: view.bottomAnchor),
bottomMask.leftAnchor.constraint(equalTo: view.leftAnchor),
bottomMask.widthAnchor.constraint(equalTo: view.widthAnchor),
])
}
func carousel(_ carousel: iCarousel,
viewForItemAt index: Int,
reusing view: UIView?) -> UIView {
let imageView = UIImageView(
frame: CGRect(
x: 0, y: 0,
width: UIScreen.main.bounds.width * widthMultiplier,
height: UIScreen.main.bounds.height * heightMultiplier
)
)
imageView.contentMode = .scaleAspectFill
imageView.clipsToBounds = true
imageView.image = projected[index].1.snapshot
let dismiss = UISwipeGestureRecognizer(target: self, action: #selector(dismissTab))
dismiss.direction = .up
let open = UITapGestureRecognizer(target: self, action: #selector(openTab))
imageView.layer.borderColor = UIColor.separator.cgColor
imageView.layer.borderWidth = 0.5
imageView.isOpaque = true
imageView.layer.backgroundColor = UIColor.white.cgColor
imageView.isUserInteractionEnabled = true
imageView.addGestureRecognizer(dismiss)
imageView.addGestureRecognizer(open)
return imageView
}
func numberOfItems(in carousel: iCarousel) -> Int {
projected.count
}
@objc func closeAllTabs() {
pool?.removeAll()
allTabsClosed?()
collectionView.reloadData()
}
@objc func dismissTabsViewer() {
dismiss(animated: true, completion: nil)
}
@objc func dismissTab(_ sender: UISwipeGestureRecognizer) {
let item = projected[collectionView.currentItemIndex]
tabDidClose?(item.1.view)
pool?.remove(at: item.0)
collectionView.reloadData()
}
@objc func openTab() {
let view = projected[collectionView.currentItemIndex].1.view
pool?.add(view: view) // bump up the last accesed
openSelectedTab?(view)
dismissTabsViewer()
}
}
| [
-1
] |
00eb286085eb5060374e4bd4201f7f32ffa122af | 3ebeeab71183fae3b257cd4766cfeafe60f445e9 | /harpyframework/harpyframework/Model/FavouriteModel.swift | 3a0b67524ee2fc3dd11c8bda2654ff52ccc52014 | [] | no_license | Nixforest/harpyframework | a4f2eb7e347ba8accbf37793966a5439e515af56 | 17a618c6a56ea7a7a898326fd31d91b0a255de7d | refs/heads/master | 2021-01-12T08:56:27.409509 | 2018-07-24T07:08:15 | 2018-07-24T07:08:15 | 76,728,536 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,082 | swift | //
// FavouriteModel.swift
// harpyframework
//
// Created by SPJ on 8/17/17.
// Copyright © 2017 SPJ. All rights reserved.
//
import UIKit
public class FavouriteModel<T>: NSObject {
/** Count of selected times */
private var _selectedCount: Int = 0
/** List of data */
private var _data: T? = nil
/**
* Get selected times
* - returns: Count of selected times
*/
public func getSelectedCnt() -> Int {
return self._selectedCount
}
/**
* Get data object
* - returns: Data object
*/
public func getData() -> T {
return _data!;
}
/**
* Initialize
* - parameter count: Selected times
* - parameter data: Data object
*/
public init(count: Int, data: T) {
self._selectedCount = count
self._data = data
}
/**
* Increase selected times
* - parameter count: Count of selected times need to increase
*/
public func increase(count: Int = 1) {
self._selectedCount += count
}
}
| [
-1
] |
8241b483ac1ff7b8bdc1fe10d7d11aee0bfbfad6 | b490792675c034008bd4f9d6b5953e0bbd536a96 | /Package.swift | e7291374efbcf736ddd4ded89b78c72c90a5e328 | [
"Apache-2.0"
] | permissive | sassanaflaki/ios-sdk | 96ef0ed85c6fd8d65705f44dec8a0d57ca84a044 | 5973a26c190e0e43311ce1f3f575acb73ec56fa3 | refs/heads/master | 2021-01-12T10:00:35.123787 | 2016-12-06T22:26:29 | 2016-12-06T22:26:29 | 76,332,410 | 1 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 2,390 | swift | /**
* Copyright IBM Corporation 2016
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
import PackageDescription
let package = Package(
name: "WatsonDeveloperCloud",
targets: [
Target(name: "RestKit"),
Target(name: "AlchemyDataNewsV1", dependencies: [.Target(name: "RestKit")]),
Target(name: "AlchemyLanguageV1", dependencies: [.Target(name: "RestKit")]),
Target(name: "AlchemyVisionV1", dependencies: [.Target(name: "RestKit")]),
Target(name: "ConversationV1", dependencies: [.Target(name: "RestKit")]),
Target(name: "DialogV1", dependencies: [.Target(name: "RestKit")]),
Target(name: "DocumentConversionV1", dependencies: [.Target(name: "RestKit")]),
Target(name: "LanguageTranslatorV2", dependencies: [.Target(name: "RestKit")]),
Target(name: "NaturalLanguageClassifierV1", dependencies: [.Target(name: "RestKit")]),
Target(name: "PersonalityInsightsV2", dependencies: [.Target(name: "RestKit")]),
Target(name: "PersonalityInsightsV3", dependencies: [.Target(name: "RestKit")]),
Target(name: "RelationshipExtractionV1Beta", dependencies: [.Target(name: "RestKit")]),
Target(name: "RetrieveAndRankV1", dependencies: [.Target(name: "RestKit")]),
Target(name: "TextToSpeechV1", dependencies: [.Target(name: "RestKit")]),
Target(name: "ToneAnalyzerV3", dependencies: [.Target(name: "RestKit")]),
Target(name: "TradeoffAnalyticsV1", dependencies: [.Target(name: "RestKit")]),
Target(name: "VisualRecognitionV3", dependencies: [.Target(name: "RestKit")]),
],
dependencies: [
],
exclude: [
"Source/SpeechToTextV1",
"Tests/SpeechToTextV1Tests"
]
)
| [
229719
] |
5d599403d54034e1ba389313a116de0de8ade2e4 | e3de4588f7bdddffd6060b54bfcc33650095c755 | /LayerApp/AppDelegate.swift | 6375fe9a16c7a004dba0d41bdaedf0fd5a28987f | [] | no_license | tfuru/LayeredArchitectureSwift | 5094f342b34e0c0052ef8e3b11f06223a64bceb9 | 93ac73884dec77418d2ba61ffefc9484a5d92d63 | refs/heads/master | 2021-04-15T10:44:10.525925 | 2018-03-24T10:02:17 | 2018-03-24T10:02:17 | 126,586,194 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,173 | swift | //
// AppDelegate.swift
// LayerApp
//
// Created by 古川信行 on 2018/03/17.
// Copyright © 2018年 tfuru. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
| [
229380,
229383,
229385,
278539,
294924,
229388,
278542,
229391,
327695,
278545,
229394,
278548,
229397,
229399,
229402,
352284,
229405,
278556,
278559,
229408,
278564,
294950,
229415,
229417,
327722,
237613,
229422,
360496,
229426,
237618,
229428,
311349,
286774,
286776,
319544,
286778,
229432,
204856,
286791,
237640,
286797,
278605,
311375,
163920,
237646,
196692,
319573,
311383,
278623,
278626,
319590,
311400,
278635,
303212,
278639,
131192,
278648,
237693,
303230,
327814,
303241,
131209,
417930,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
131264,
286916,
295110,
286922,
286924,
286926,
319694,
286928,
131281,
278743,
278747,
295133,
155872,
319716,
237807,
303345,
286962,
131314,
229622,
327930,
278781,
278783,
278785,
237826,
319751,
278792,
286987,
319757,
311569,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
295220,
287032,
155966,
319809,
319810,
278849,
319814,
311623,
319818,
311628,
229709,
319822,
287054,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
319879,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
278980,
98756,
278983,
319945,
278986,
319947,
278990,
278994,
311767,
279003,
279006,
188895,
172512,
287202,
279010,
279015,
172520,
319978,
279020,
172526,
311791,
279023,
172529,
279027,
319989,
172534,
180727,
164343,
279035,
311804,
287230,
279040,
303617,
287234,
279045,
172550,
303623,
172552,
287238,
320007,
279051,
172558,
279055,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
279082,
311850,
279084,
172591,
172598,
279095,
172607,
172609,
172612,
377413,
172614,
172618,
303690,
33357,
287309,
303696,
279124,
172634,
262752,
172644,
311911,
189034,
295533,
172655,
172656,
352880,
295538,
189039,
172660,
287349,
189040,
189044,
287355,
287360,
295553,
172675,
295557,
287365,
311942,
303751,
352905,
279178,
287371,
311946,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
172702,
164509,
303773,
172705,
287394,
172707,
303780,
287390,
287398,
205479,
279208,
287400,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
328384,
172737,
279231,
287427,
312005,
312006,
107208,
172748,
287436,
107212,
172751,
287440,
295633,
172755,
303827,
279255,
172760,
287450,
303835,
279258,
189149,
303838,
213724,
312035,
279267,
295654,
279272,
230128,
312048,
312050,
230131,
205564,
303871,
230146,
328453,
295685,
230154,
33548,
312077,
295695,
295701,
230169,
369433,
295707,
328476,
295710,
230175,
295720,
303914,
279340,
205613,
279353,
230202,
312124,
328508,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
279390,
230241,
279394,
303976,
336744,
303985,
328563,
303987,
279413,
303991,
303997,
295806,
295808,
295813,
304005,
320391,
213895,
304007,
304009,
304011,
230284,
304013,
295822,
279438,
213902,
189329,
295825,
304019,
189331,
58262,
304023,
304027,
279452,
410526,
279461,
279462,
304042,
213931,
230327,
304055,
287675,
230334,
304063,
238528,
304065,
213954,
189378,
156612,
295873,
213963,
197580,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
312321,
295945,
230413,
295949,
197645,
320528,
140312,
295961,
238620,
197663,
304164,
304170,
304175,
238641,
312374,
238652,
238655,
230465,
238658,
336964,
296004,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
205931,
296044,
279661,
205934,
164973,
312432,
279669,
337018,
189562,
279679,
304258,
279683,
222340,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
238766,
165038,
230576,
238770,
304311,
230592,
312518,
279750,
230600,
230607,
148690,
320727,
279769,
304348,
279777,
304354,
296163,
320740,
279781,
304360,
320748,
279788,
279790,
304370,
296189,
320771,
312585,
296202,
296205,
230674,
320786,
230677,
296213,
296215,
320792,
230681,
230679,
214294,
304416,
230689,
173350,
312622,
296243,
312630,
222522,
296253,
222525,
296255,
312639,
230718,
296259,
378181,
296262,
230727,
238919,
296264,
320840,
296267,
296271,
222545,
230739,
312663,
222556,
337244,
230752,
312676,
230760,
173418,
148843,
410987,
230763,
230768,
296305,
312692,
230773,
304505,
304506,
279929,
181626,
181631,
148865,
312711,
312712,
296331,
288140,
288144,
230800,
304533,
337306,
288154,
288160,
173472,
288162,
288164,
279975,
304555,
370092,
279983,
173488,
288176,
279985,
312755,
296373,
312759,
279991,
288185,
337335,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
288210,
370130,
288212,
222676,
288214,
280021,
239064,
288217,
329177,
280027,
288220,
288218,
239070,
288224,
280034,
288226,
280036,
288229,
280038,
288230,
288232,
370146,
288234,
320998,
288236,
288238,
288240,
288242,
296435,
288244,
288250,
296446,
321022,
402942,
148990,
296450,
206336,
230916,
230919,
214535,
230923,
304651,
304653,
370187,
230940,
222752,
108066,
296486,
296488,
157229,
239152,
230961,
157236,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
288344,
280152,
239194,
280158,
403039,
370272,
181854,
239202,
312938,
280183,
280185,
280188,
280191,
116354,
280194,
280208,
280211,
288408,
280218,
280222,
190118,
198310,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
313027,
280260,
206536,
280264,
206539,
206541,
206543,
313044,
280276,
321239,
280283,
313052,
18140,
288478,
313055,
321252,
313066,
288494,
280302,
280304,
313073,
321266,
288499,
419570,
288502,
280314,
288510,
124671,
67330,
280324,
198405,
288519,
280331,
198416,
280337,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
296767,
288576,
345921,
280388,
337732,
304968,
280393,
280402,
173907,
313171,
313176,
42842,
280419,
321381,
296809,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280464,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
280487,
313258,
321458,
296883,
124853,
214966,
296890,
10170,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
239586,
313320,
231404,
124913,
165876,
321528,
239612,
313340,
288764,
239617,
313347,
288773,
313358,
305176,
321560,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
378941,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
149599,
280671,
149601,
321634,
149603,
223327,
329830,
280681,
313451,
223341,
280687,
149618,
215154,
313458,
280691,
313464,
329850,
321659,
280702,
288895,
321670,
215175,
141446,
141455,
141459,
280725,
313498,
100520,
288936,
280747,
288940,
288947,
280755,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
313548,
321740,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
157930,
280811,
280817,
125171,
157940,
280819,
182517,
280823,
280825,
280827,
280830,
280831,
280833,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
280888,
305464,
280891,
289087,
280897,
280900,
305480,
239944,
280906,
239947,
305485,
305489,
379218,
280919,
354653,
313700,
280937,
313705,
190832,
280946,
223606,
313720,
280956,
239997,
280959,
313731,
199051,
240011,
289166,
240017,
297363,
190868,
240021,
297365,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
289210,
305594,
281024,
289218,
289221,
289227,
281045,
281047,
215526,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
240132,
281095,
223752,
150025,
338440,
330244,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
281135,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
281179,
338528,
338532,
281190,
199273,
281196,
19053,
158317,
313973,
297594,
281210,
158347,
182926,
133776,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
199364,
297671,
158409,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322314,
322318,
281361,
281372,
322341,
215850,
281388,
289593,
281401,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
281442,
174955,
224110,
207733,
207737,
158596,
183172,
240519,
322440,
314249,
338823,
183184,
142226,
289687,
240535,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
281567,
289762,
322534,
297961,
183277,
281581,
322550,
134142,
322563,
314372,
330764,
175134,
322599,
322610,
314421,
281654,
314427,
314433,
207937,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
289912,
248995,
306341,
306344,
306347,
322734,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
126190,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
257334,
216376,
380226,
298306,
224584,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
290171,
314747,
306555,
290174,
298365,
224641,
281987,
298372,
314756,
281990,
224647,
265604,
298377,
314763,
142733,
298381,
314768,
224657,
306581,
314773,
314779,
314785,
314793,
282025,
282027,
241068,
241070,
241072,
282034,
241077,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
290291,
282101,
241142,
191992,
290298,
151036,
290302,
282111,
290305,
175621,
306694,
192008,
323084,
257550,
282127,
290321,
282130,
323090,
290325,
282133,
241175,
290328,
282137,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
282186,
224849,
282195,
282199,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
324757,
282261,
175770,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
306856,
196133,
282295,
282300,
323260,
323266,
282310,
323273,
282319,
306897,
241362,
306904,
282328,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
241450,
282410,
306988,
306991,
315184,
323376,
315190,
241464,
159545,
282425,
298811,
118593,
307009,
413506,
307012,
241475,
148946,
315211,
282446,
307027,
315221,
323414,
315223,
241496,
241498,
307035,
307040,
110433,
282465,
241509,
110438,
298860,
110445,
282478,
315249,
110450,
315251,
282481,
315253,
315255,
339838,
315267,
282499,
315269,
241544,
282505,
241546,
241548,
298896,
298898,
282514,
241556,
44948,
298901,
241560,
282520,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
36779,
241581,
282542,
241583,
323504,
241586,
282547,
241588,
290739,
241590,
241592,
241598,
290751,
241600,
241605,
151495,
241610,
298975,
241632,
298984,
241640,
241643,
298988,
241646,
241649,
241652,
323574,
290807,
299003,
241661,
299006,
282623,
315396,
241669,
315397,
282632,
307211,
282639,
290835,
282645,
241693,
282654,
241701,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
307278,
192596,
176213,
307287,
307290,
217179,
315482,
192605,
315483,
233567,
299105,
200801,
217188,
299109,
307303,
315495,
356457,
45163,
307307,
315502,
192624,
307314,
323700,
299126,
233591,
299136,
307329,
307338,
233613,
241813,
307352,
299164,
299167,
315552,
184479,
184481,
315557,
184486,
307370,
307372,
184492,
307374,
307376,
299185,
323763,
184503,
176311,
299191,
307385,
307386,
307388,
258235,
307390,
176316,
299200,
184512,
307394,
299204,
307396,
184518,
307399,
323784,
233679,
307409,
307411,
176343,
299225,
233701,
307432,
184572,
282881,
184579,
282893,
291089,
282906,
291104,
233766,
295583,
176435,
307508,
315701,
332086,
307510,
307512,
168245,
307515,
307518,
282942,
282947,
323917,
110926,
282957,
233808,
323921,
315733,
323926,
233815,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299388,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
315801,
283033,
242075,
291226,
194654,
61855,
291231,
283042,
291238,
291241,
127403,
127405,
291247,
299440,
127407,
299444,
127413,
283062,
291254,
127417,
291260,
283069,
127421,
127424,
299457,
127429,
127431,
127434,
315856,
176592,
315860,
176597,
127447,
283095,
299481,
176605,
242143,
127457,
291299,
340454,
127463,
242152,
291305,
127466,
176620,
127469,
127474,
291314,
291317,
127480,
135672,
291323,
233979,
127485,
291330,
127490,
283142,
127494,
127497,
233994,
135689,
127500,
291341,
233998,
127506,
234003,
127509,
234006,
127511,
152087,
283161,
242202,
234010,
135707,
242206,
135710,
242208,
291361,
242220,
291378,
234038,
152118,
234041,
315961,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
291456,
135808,
373383,
299655,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
225948,
135839,
299680,
225954,
299684,
135844,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
119509,
226005,
226008,
299740,
242396,
201444,
299750,
283368,
234219,
283372,
226037,
283382,
316151,
234231,
234236,
226045,
242431,
234239,
209665,
234242,
299778,
242436,
226053,
234246,
226056,
234248,
291593,
242443,
234252,
242445,
234254,
291601,
234258,
242450,
242452,
234261,
348950,
201496,
234264,
234266,
234269,
283421,
234272,
234274,
152355,
299814,
234278,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
160572,
283452,
234302,
234307,
242499,
234309,
292433,
316233,
234313,
316235,
234316,
283468,
234319,
242511,
234321,
234324,
185173,
201557,
234329,
234333,
308063,
234336,
242530,
349027,
234338,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
226171,
291711,
234368,
291714,
234370,
291716,
234373,
201603,
226182,
234375,
308105,
226185,
234379,
324490,
234384,
234388,
234390,
324504,
234393,
209818,
308123,
324508,
234396,
291742,
226200,
234398,
234401,
291747,
291748,
234405,
291750,
234407,
324520,
324518,
324522,
234410,
291756,
226220,
291754,
324527,
291760,
234417,
201650,
324531,
234414,
234422,
226230,
275384,
324536,
234428,
291773,
242623,
324544,
234431,
234434,
324546,
324548,
226245,
234437,
234439,
226239,
234443,
291788,
234446,
275406,
193486,
234449,
316370,
193488,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234475,
234478,
316400,
234481,
316403,
234484,
234485,
234487,
324599,
234490,
234493,
316416,
234496,
308226,
234501,
275462,
308231,
234504,
234507,
234510,
234515,
300054,
316439,
234520,
234519,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
144430,
234543,
234546,
275508,
300085,
234549,
300088,
234553,
234556,
234558,
316479,
234561,
316483,
160835,
234563,
308291,
234568,
234570,
316491,
234572,
300108,
234574,
300115,
234580,
234581,
242777,
234585,
275545,
234590,
234593,
234595,
234597,
300133,
234601,
300139,
234605,
160879,
234607,
275569,
234610,
316530,
300148,
234614,
398455,
144506,
234618,
234620,
275579,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
308373,
226453,
234647,
275606,
275608,
234650,
308379,
234648,
300189,
324766,
119967,
234653,
283805,
234657,
324768,
242852,
300197,
234661,
283813,
234664,
275626,
234667,
316596,
308414,
234687,
300223,
300226,
308418,
234692,
300229,
308420,
308422,
226500,
283844,
300234,
283850,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
300267,
161003,
300270,
300272,
120053,
300278,
275703,
316663,
300284,
275710,
300287,
292097,
300289,
161027,
300292,
300294,
275719,
234760,
177419,
300299,
242957,
300301,
283917,
177424,
275725,
349464,
283939,
259367,
292143,
283951,
300344,
226617,
243003,
283963,
226628,
300357,
283973,
177482,
283983,
316758,
357722,
316766,
292192,
316768,
218464,
292197,
316774,
243046,
218473,
284010,
136562,
324978,
275834,
333178,
275836,
275840,
316803,
316806,
226696,
316811,
226699,
316814,
226703,
300433,
234899,
300436,
226709,
357783,
316824,
316826,
144796,
300448,
144807,
144810,
144812,
284076,
144814,
144820,
374196,
284084,
292279,
284087,
144826,
144828,
144830,
144832,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
226787,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
292338,
226802,
227440,
316917,
308727,
292343,
300537,
316933,
316947,
308757,
308762,
284191,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
194101,
284213,
316983,
194103,
284215,
308790,
284218,
226877,
292414,
284223,
284226,
284228,
292421,
226886,
284231,
128584,
243268,
284234,
276043,
317004,
366155,
284238,
226895,
284241,
194130,
284243,
300628,
284245,
276053,
284247,
317015,
284249,
243290,
284251,
276052,
284253,
300638,
284255,
235097,
243293,
284258,
292452,
292454,
284263,
177766,
284265,
292458,
284267,
292461,
284272,
284274,
284278,
292470,
276086,
292473,
284283,
276093,
284286,
276095,
284288,
292481,
284290,
325250,
284292,
292485,
292479,
276098,
284297,
317066,
284299,
317068,
284301,
276109,
284303,
284306,
276114,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
284329,
317098,
284331,
276137,
284333,
284335,
276144,
284337,
284339,
300726,
284343,
284346,
284350,
276160,
358080,
284354,
358083,
284358,
276166,
358089,
284362,
276170,
284365,
276175,
284368,
276177,
284370,
358098,
284372,
317138,
284377,
276187,
284379,
284381,
284384,
358114,
284386,
358116,
276197,
317158,
358119,
284392,
325353,
358122,
284394,
284397,
358126,
284399,
358128,
276206,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
300819,
317207,
284440,
300828,
300830,
276255,
300832,
325408,
300834,
317221,
227109,
358183,
186151,
276268,
300845,
243504,
300850,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
300872,
292681,
153417,
358224,
284499,
276308,
284502,
317271,
178006,
276315,
292700,
317279,
284511,
227175,
292715,
300912,
292721,
284529,
300915,
284533,
292729,
317306,
284540,
292734,
325512,
169868,
276365,
317332,
358292,
284564,
284566,
350106,
284572,
276386,
284579,
276388,
358312,
317353,
284585,
276395,
292776,
292784,
276402,
358326,
161718,
358330,
276410,
276411,
276418,
276425,
301009,
301011,
301013,
292823,
358360,
301017,
301015,
292828,
276446,
153568,
276448,
276452,
292839,
276455,
292843,
276460,
292845,
276464,
178161,
227314,
276466,
325624,
276472,
317435,
276476,
276479,
276482,
276485,
317446,
276490,
292876,
317456,
276496,
317458,
178195,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
276528,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
276544,
284739,
325700,
243779,
292934,
243785,
276553,
350293,
350295,
309337,
194649,
227418,
350299,
350302,
227423,
350304,
178273,
309346,
194657,
194660,
350308,
309350,
309348,
292968,
309352,
227426,
276579,
227430,
276583,
309354,
301167,
276590,
350321,
350313,
350316,
284786,
350325,
252022,
276595,
350328,
292985,
301178,
350332,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
350366,
276638,
284837,
153765,
350375,
350379,
350381,
350383,
129200,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
301258,
309450,
276685,
309455,
276689,
309462,
301272,
276699,
194780,
309468,
309471,
301283,
317672,
317674,
325867,
243948,
194801,
227571,
309491,
309494,
243960,
276735,
227583,
227587,
276739,
211204,
276742,
227593,
227596,
325910,
309530,
342298,
211232,
317729,
276775,
211241,
325937,
325943,
211260,
260421,
276809,
285002,
276811,
235853,
276816,
235858,
276829,
276833,
391523,
276836,
293227,
276843,
293232,
276848,
186744,
211324,
227709,
285061,
317833,
178572,
285070,
285077,
178583,
227738,
317853,
276896,
317858,
342434,
285093,
317864,
285098,
276907,
235955,
276917,
293304,
293307,
293314,
309707,
293325,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
227810,
293346,
276964,
293352,
236013,
293364,
301562,
293370,
317951,
309764,
301575,
121352,
293387,
236043,
342541,
317963,
113167,
55822,
309779,
317971,
309781,
277011,
55837,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
285236,
23094,
277054,
244288,
129603,
301636,
318020,
301639,
301643,
277071,
285265,
399955,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
121458,
277106,
170618,
170619,
309885,
309888,
277122,
227975,
277128,
285320,
301706,
318092,
326285,
334476,
318094,
277136,
277139,
227992,
334488,
318108,
285340,
318110,
227998,
137889,
383658,
285357,
318128,
277170,
293555,
342707,
154292,
277173,
318132,
285368,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
137946,
113378,
203491,
228069,
277223,
342760,
285417,
56041,
56043,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
228113,
285459,
277273,
293659,
326430,
228128,
285474,
293666,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
285494,
301880,
285499,
301884,
310080,
293696,
277317,
277322,
277329,
162643,
310100,
301911,
301913,
277337,
301921,
400236,
236397,
162671,
326514,
310134,
236408,
15224,
277368,
416639,
416640,
113538,
310147,
416648,
39817,
187274,
277385,
301972,
424853,
277405,
277411,
310179,
293798,
293802,
236460,
277426,
293811,
293817,
293820,
203715,
326603,
276586,
293849,
293861,
228327,
228328,
318442,
228330,
228332,
326638,
277486,
318450,
293876,
293877,
285686,
302073,
121850,
293882,
302075,
285690,
244731,
293887,
277504,
277507,
277511,
293899,
277519,
293908,
302105,
293917,
293939,
318516,
277561,
277564,
310336,
7232,
293956,
277573,
228422,
293960,
310344,
277577,
277583,
203857,
293971,
310355,
310359,
236632,
277594,
138332,
277598,
203872,
277601,
285792,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
367737,
285817,
302205,
285821,
392326,
285831,
253064,
294026,
302218,
285835,
162964,
384148,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
302241,
285862,
277671,
302248,
64682,
277678,
294063,
294065,
302258,
277687,
294072,
318651,
294076,
277695,
318657,
244930,
302275,
130244,
302277,
228550,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
310486,
302296,
384222,
310498,
285927,
318698,
302315,
195822,
228592,
294132,
138485,
228601,
204026,
228606,
204031,
64768,
310531,
285958,
138505,
228617,
318742,
204067,
277798,
130345,
277801,
113964,
285997,
277804,
285999,
277807,
113969,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
417086,
277822,
286016,
302403,
294211,
384328,
277832,
277836,
294221,
294223,
326991,
277839,
277842,
277847,
277850,
179547,
277853,
146784,
277857,
302436,
277860,
294246,
327015,
310632,
327017,
351594,
277864,
277869,
277872,
351607,
310648,
277880,
310651,
277884,
277888,
310657,
351619,
294276,
310659,
327046,
277892,
253320,
310665,
318858,
277894,
277898,
277903,
310672,
351633,
277905,
277908,
277917,
310689,
277921,
130468,
228776,
277928,
277932,
310703,
277937,
310710,
130486,
310712,
277944,
310715,
277947,
302526,
228799,
277950,
277953,
302534,
310727,
64966,
245191,
163272,
277959,
277963,
302541,
277966,
302543,
310737,
277971,
228825,
163290,
277978,
310749,
277981,
277984,
310755,
277989,
277991,
187880,
277995,
310764,
286188,
278000,
228851,
310772,
278003,
278006,
40440,
212472,
278009,
40443,
286203,
40448,
228864,
286214,
228871,
302603,
65038,
302614,
286233,
302617,
302621,
286240,
146977,
187939,
40484,
294435,
40486,
286246,
294440,
40488,
294439,
294443,
40491,
294445,
278057,
310831,
245288,
286248,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
327240,
40521,
286283,
40525,
40527,
212560,
400976,
228944,
40533,
147032,
40537,
40539,
40541,
278109,
40544,
40548,
40550,
40552,
286313,
40554,
286312,
310892,
40557,
40560,
188022,
122488,
294521,
343679,
294537,
310925,
286354,
278163,
302740,
122517,
278168,
179870,
327333,
229030,
212648,
278188,
302764,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
294601,
302793,
343757,
212690,
319187,
278227,
286420,
229076,
286425,
319194,
278235,
301163,
278238,
229086,
286432,
294625,
294634,
302838,
319226,
286460,
278274,
302852,
278277,
302854,
294664,
311048,
352008,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
278320,
319280,
319290,
229192,
302925,
188247,
188252,
237409,
229233,
294776,
360317,
294785,
327554,
40840,
40851,
294803,
188312,
294811,
237470,
319390,
40865,
319394,
294817,
294821,
311209,
180142,
343983,
294831,
188340,
40886,
319419,
294844,
294847,
393177,
294876,
294879,
294883,
294890,
311279,
278513,
237555,
278516,
311283,
278519,
237562
] |
db6bc41624e15be97e32ab694ea309f4383a1ec6 | eea189f501da3f29a100c4b690edaede468e0fd6 | /webview1UITests/webview1UITests.swift | f8f8742c93c3f6044829ce9f2d44081dc3f258cf | [
"MIT"
] | permissive | myteeNatanwit/webview1 | ae96790adb57234e2ec35201425841524b3e4c6b | b4b5a01d34f629aca36e317cc1862795040bff29 | refs/heads/master | 2021-01-10T06:56:15.466760 | 2015-11-11T05:22:56 | 2015-11-11T05:22:56 | 45,957,414 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,248 | swift | //
// webview1UITests.swift
// webview1UITests
//
// Created by Michael Tran on 10/11/2015.
// Copyright © 2015 intcloud. All rights reserved.
//
import XCTest
class webview1UITests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
// In UI tests it is usually best to stop immediately when a failure occurs.
continueAfterFailure = false
// UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
XCUIApplication().launch()
// In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
}
| [
155665,
237599,
229414,
278571,
229425,
180279,
229431,
319543,
213051,
286787,
237638,
311373,
278607,
196687,
311377,
368732,
180317,
278637,
319599,
278642,
131190,
131199,
278669,
278676,
311447,
327834,
278684,
278690,
311459,
278698,
278703,
278707,
180409,
278713,
295099,
139459,
131270,
229591,
147679,
311520,
147680,
319719,
295147,
286957,
319764,
278805,
311582,
278817,
311596,
336177,
98611,
278843,
287040,
319812,
311622,
319816,
229716,
278895,
287089,
139641,
311679,
311692,
106893,
156069,
311723,
377265,
311739,
319931,
278974,
336319,
311744,
278979,
336323,
278988,
278992,
279000,
279009,
369121,
188899,
279014,
319976,
279017,
311787,
319986,
279030,
311800,
279033,
279042,
287237,
377352,
279053,
303634,
303635,
279060,
279061,
279066,
188954,
279092,
377419,
303693,
115287,
189016,
287319,
295518,
287327,
279143,
279150,
287345,
287348,
189054,
287359,
303743,
164487,
311944,
279176,
344714,
311948,
311950,
311953,
287379,
336531,
295575,
303772,
205469,
221853,
279207,
295591,
295598,
279215,
279218,
287412,
164532,
287418,
303802,
66243,
287434,
287438,
164561,
303826,
279249,
369365,
369366,
279253,
230105,
295653,
230120,
279278,
312046,
230133,
279293,
205566,
295688,
312076,
295698,
221980,
336678,
262952,
262953,
279337,
262957,
164655,
328495,
303921,
230198,
295745,
222017,
279379,
295769,
230238,
230239,
279393,
303973,
279398,
295797,
295799,
279418,
336765,
287623,
279434,
320394,
189327,
189349,
279465,
304050,
189373,
213956,
345030,
213961,
279499,
304086,
304104,
123880,
320492,
320495,
287730,
320504,
214009,
312313,
312317,
328701,
328705,
418819,
320520,
230411,
320526,
238611,
140311,
238617,
197658,
336930,
132140,
189487,
312372,
238646,
238650,
320571,
336962,
238663,
296023,
205911,
156763,
214116,
230500,
279659,
238706,
312435,
279666,
230514,
279686,
222344,
337037,
296091,
238764,
279729,
148674,
312519,
279752,
148687,
189651,
279766,
189656,
279775,
304352,
304353,
279780,
279789,
279803,
320769,
312588,
320795,
320802,
304422,
312628,
345398,
222523,
181568,
279872,
279874,
304457,
230730,
345418,
337228,
296269,
222542,
238928,
296274,
230757,
312688,
296304,
230772,
337280,
296328,
296330,
304523,
9618,
279955,
148899,
279979,
279980,
279988,
173492,
280003,
370122,
280011,
337359,
329168,
312785,
222674,
329170,
280020,
280025,
239069,
320997,
280042,
280043,
329198,
337391,
296434,
288248,
288252,
312830,
230922,
304655,
329231,
230933,
222754,
312879,
230960,
288305,
239159,
157246,
288319,
288322,
280131,
124486,
288328,
239192,
99937,
345697,
312937,
312941,
206447,
288377,
337533,
280193,
239238,
288391,
239251,
280217,
198304,
337590,
280252,
296636,
280253,
321217,
280259,
321220,
239305,
296649,
280266,
9935,
313042,
280279,
18139,
280285,
321250,
337638,
181992,
288492,
34547,
67316,
313082,
288508,
288515,
280326,
116491,
280333,
124691,
116502,
321308,
321309,
280367,
280377,
321338,
280381,
345918,
280386,
280391,
280396,
18263,
370526,
296807,
296815,
313200,
313204,
124795,
280451,
305032,
67464,
124816,
214936,
337816,
239515,
214943,
313257,
288698,
214978,
280517,
280518,
214983,
231382,
329696,
190437,
313322,
329707,
174058,
296942,
124912,
313338,
239610,
182277,
313356,
305173,
223269,
354342,
354346,
313388,
124974,
321589,
215095,
288829,
288835,
313415,
239689,
354386,
329812,
223317,
354394,
321632,
280676,
313446,
215144,
288878,
288890,
215165,
329884,
215204,
125108,
280761,
223418,
280767,
338118,
280779,
321744,
280792,
280803,
182503,
338151,
125166,
125170,
395511,
313595,
125180,
125184,
125192,
125197,
125200,
125204,
338196,
125215,
125225,
338217,
321839,
125236,
280903,
289109,
379224,
239973,
313703,
280938,
321901,
354671,
199030,
223611,
248188,
313726,
158087,
313736,
240020,
190870,
190872,
289185,
305572,
289195,
338359,
289229,
281038,
281039,
281071,
322057,
182802,
322077,
289328,
338491,
322119,
281165,
281170,
281200,
313970,
297600,
289435,
314020,
248494,
166581,
314043,
363212,
158424,
322269,
338658,
289511,
330473,
330476,
289517,
215790,
125683,
199415,
322302,
289534,
35584,
322312,
346889,
264971,
322320,
166677,
207639,
281378,
289580,
281407,
289599,
281426,
281434,
322396,
281444,
207735,
314240,
158594,
330627,
240517,
289691,
240543,
289699,
289704,
289720,
289723,
281541,
19398,
191445,
183254,
183258,
207839,
314343,
183276,
289773,
248815,
240631,
330759,
330766,
281647,
322609,
314437,
207954,
339031,
314458,
281698,
281699,
322664,
314493,
347286,
330912,
339106,
306339,
249003,
208044,
322733,
3243,
339131,
290001,
339167,
298209,
290030,
208123,
322826,
126229,
298290,
208179,
159033,
216387,
372039,
224591,
331091,
150868,
314708,
314711,
314721,
281958,
314727,
134504,
306541,
314734,
314740,
314742,
314745,
290170,
224637,
306558,
290176,
306561,
314752,
314759,
298378,
314765,
314771,
306580,
224662,
282008,
314776,
282013,
290206,
314788,
298406,
314790,
282023,
241067,
314797,
306630,
306634,
339403,
191980,
282097,
306678,
191991,
290304,
323079,
323083,
323088,
282132,
282135,
175640,
282147,
306730,
290359,
323132,
282182,
224848,
224852,
290391,
306777,
323171,
282214,
224874,
314997,
290425,
339579,
282244,
323208,
282248,
323226,
282272,
282279,
298664,
298666,
306875,
282302,
323262,
323265,
282309,
306891,
241360,
282321,
241366,
282330,
282336,
12009,
282347,
282349,
323315,
200444,
282366,
249606,
282375,
323335,
282379,
216844,
118549,
282390,
282399,
241440,
282401,
339746,
315172,
216868,
241447,
282418,
282424,
282428,
413500,
241471,
315209,
159563,
307024,
307030,
241494,
307038,
282471,
282476,
339840,
315265,
282503,
315272,
315275,
184207,
282517,
298912,
118693,
298921,
126896,
200628,
282572,
282573,
323554,
298987,
282634,
241695,
315433,
102441,
102446,
282671,
241717,
307269,
315468,
233548,
315477,
200795,
323678,
315488,
315489,
45154,
233578,
307306,
217194,
241809,
323730,
299166,
233635,
299176,
184489,
323761,
184498,
258233,
299197,
299202,
176325,
299208,
233678,
282832,
356575,
307431,
184574,
217352,
315674,
282908,
299294,
282912,
233761,
282920,
315698,
332084,
307514,
282938,
127292,
168251,
323914,
201037,
282959,
250196,
168280,
323934,
381286,
242027,
242028,
250227,
315768,
315769,
291194,
291193,
291200,
242059,
315798,
291225,
283039,
242079,
299449,
291266,
283088,
283089,
242138,
176602,
160224,
291297,
242150,
283138,
233987,
324098,
340489,
283154,
291359,
283185,
234037,
340539,
234044,
332379,
111197,
242274,
291455,
316044,
184974,
316048,
316050,
340645,
176810,
299698,
291529,
225996,
135888,
242385,
299737,
234216,
234233,
242428,
299777,
291591,
291605,
283418,
234276,
283431,
242481,
234290,
201534,
283466,
201562,
234330,
275294,
349025,
357219,
177002,
308075,
242540,
242542,
201590,
177018,
308093,
291713,
340865,
299912,
316299,
234382,
308111,
308113,
209820,
283551,
177074,
127945,
340960,
234469,
340967,
324587,
234476,
201721,
234499,
234513,
316441,
300087,
21567,
308288,
160834,
349254,
300109,
234578,
250965,
250982,
234606,
300145,
300147,
234626,
234635,
177297,
308375,
324761,
119965,
234655,
300192,
234662,
300200,
324790,
300215,
283841,
283846,
283849,
316628,
251124,
234741,
283894,
316661,
292092,
234756,
242955,
177420,
292145,
300342,
333114,
333115,
193858,
300354,
300355,
234830,
283990,
357720,
300378,
300379,
316764,
292194,
284015,
234864,
316786,
243073,
112019,
234902,
333224,
284086,
259513,
284090,
54719,
415170,
292291,
300488,
300490,
144862,
300526,
308722,
300539,
210429,
292359,
218632,
316951,
374297,
235069,
349764,
194118,
292424,
292426,
333389,
349780,
128600,
235096,
300643,
300645,
243306,
325246,
333438,
235136,
317102,
300729,
333508,
333522,
325345,
153318,
333543,
284410,
284425,
300810,
300812,
284430,
161553,
284436,
325403,
341791,
325411,
186148,
186149,
333609,
284460,
300849,
325444,
153416,
325449,
317268,
325460,
341846,
284508,
300893,
284515,
276326,
292713,
292719,
325491,
333687,
317305,
317308,
325508,
333700,
243590,
243592,
325514,
350091,
350092,
350102,
333727,
333734,
219046,
284584,
292783,
300983,
153553,
292835,
6116,
292838,
317416,
325620,
333827,
243720,
292901,
325675,
243763,
325695,
333902,
227432,
194667,
284789,
284790,
292987,
227459,
194692,
235661,
333968,
153752,
284827,
333990,
284840,
284843,
227517,
309443,
227525,
301255,
227536,
301270,
301271,
325857,
334049,
317676,
309504,
194832,
227601,
325904,
334104,
211239,
334121,
317738,
325930,
227655,
383309,
391521,
285031,
416103,
227702,
211327,
227721,
285074,
227730,
317851,
293275,
285083,
227743,
293281,
285089,
301482,
375211,
334259,
293309,
317889,
326083,
129484,
326093,
285152,
195044,
334315,
236020,
293368,
317949,
342537,
309770,
334345,
342560,
227881,
293420,
236080,
23093,
244279,
244280,
301635,
309831,
55880,
301647,
326229,
309847,
244311,
244326,
301688,
244345,
301702,
334473,
326288,
227991,
285348,
318127,
285360,
293552,
285362,
342705,
154295,
342757,
285419,
170735,
342775,
375552,
228099,
285443,
285450,
326413,
285457,
285467,
326428,
318247,
293673,
318251,
301872,
285493,
285496,
301883,
342846,
293702,
318279,
244569,
301919,
293729,
351078,
310132,
228214,
269179,
228232,
416649,
252812,
293780,
310166,
277404,
310177,
293801,
326571,
326580,
326586,
359365,
211913,
56270,
203758,
277493,
293894,
293911,
326684,
113710,
318515,
203829,
277600,
285795,
228457,
318571,
187508,
302202,
285819,
285823,
285833,
285834,
318602,
228492,
162962,
187539,
326803,
285850,
302239,
302251,
294069,
294075,
64699,
228541,
343230,
310496,
228587,
302319,
228608,
318732,
318746,
245018,
130342,
130344,
130347,
286012,
294210,
286019,
318804,
294236,
327023,
327030,
310650,
179586,
294278,
318860,
368012,
318876,
343457,
245160,
286128,
286133,
310714,
302523,
228796,
302530,
228804,
310725,
302539,
310731,
310735,
327122,
310747,
286176,
187877,
310758,
40439,
286201,
359931,
286208,
245249,
228868,
302602,
294413,
359949,
302613,
302620,
245291,
310853,
286281,
196184,
212574,
204386,
204394,
138862,
310896,
294517,
286344,
179853,
286351,
188049,
229011,
179868,
229021,
302751,
245413,
212649,
286387,
286392,
302778,
286400,
212684,
302798,
286419,
294621,
294629,
286457,
286463,
319232,
278273,
278292,
278294,
286507,
294699,
319289,
237397,
188250,
237411,
327556,
188293,
311183,
294806,
294808,
319393,
294820,
294824,
343993,
98240,
294849,
24531,
294887,
278507,
311277,
327666,
278515
] |
bebb050becf3d18d94a644bc105fc7db314115fa | 862e07ac66fceff30a155cf3bbf90b04bb9daf8d | /Homework_3/吴岚锋/Homework_3/Homework_3/ViewController.swift | c62e07a5b19848133c50883b0cb7ef2688bfd97d | [] | no_license | zhenpingchen/IOS-develope | 078ae5682e2fb7d436183d58c70f6545aff2e608 | b798d351f888933d5e0236691996522d04b6eb00 | refs/heads/master | 2020-07-17T12:22:11.393287 | 2019-11-27T05:46:29 | 2019-11-27T05:46:29 | 206,019,041 | 0 | 4 | null | 2019-10-08T06:20:55 | 2019-09-03T07:44:43 | Swift | UTF-8 | Swift | false | false | 2,198 | swift | //
// ViewController.swift
// Homework_3
//
// Created by Apple on 2019/10/8.
// Copyright © 2019 Apple. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
var running = false
var timer = Timer()
var m = 00
var s = 00
var ms = 00
@IBOutlet weak var min: UILabel!
@IBOutlet weak var second: UILabel!
@IBOutlet weak var msecond: UILabel!
@IBOutlet weak var startBtn: UIButton!
@IBOutlet weak var stopBtn: UIButton!
@IBOutlet weak var resetBtn: UIButton!
@IBAction func start(_ sender: UIButton) {
timer = Timer.scheduledTimer(timeInterval: 0.01, target: self, selector: #selector(updateTime), userInfo: nil, repeats: true)
running = true
startBtn.isEnabled = false
stopBtn.isEnabled = true
}
@IBAction func stop(_ sender: UIButton) {
timer.invalidate()
running = false
startBtn.isEnabled = true
stopBtn.isEnabled = false
}
@IBAction func reset(_ sender: UIButton) {
timer.invalidate()
running = false
startBtn.isEnabled = true
stopBtn.isEnabled = false
m = 00
s = 00
ms = 00
setTime(m: m, s: s, ms: ms)
}
@objc func updateTime() {
ms += 1
if ms == 100 {
ms = 00
s += 1
}
if s == 60 {
s = 00
m += 1
}
setTime(m: m, s: s, ms: ms)
}
func setTime(m: Int, s: Int, ms: Int) {
if m < 10 {
min.text = "0" + String(m)
}
else {
min.text = String(m)
}
if s < 10 {
second.text = "0" + String(s)
}
else {
second.text = String(s)
}
if ms < 10 {
msecond.text = "0" + String(ms)
}
else {
msecond.text = String(ms)
}
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
stopBtn.isEnabled = false
}
}
| [
-1
] |
07d6d1f0c232b47c83087355433cc6d398a7a427 | 84ef0e780c659d9b618b8219268b3add8a52418c | /Other Projects/Jike/SwiftUI_Jike/Cell/GYSegmentView.swift | 7769b17e68500302d3467e88d43fad8dc6075b02 | [
"MIT"
] | permissive | guangqiang-liu/SwiftUI | 57042a8ca01a5889d5e99b19d511ea829021e348 | ec256804f9234257e637883c12da48fa9aea7663 | refs/heads/master | 2020-06-28T11:58:35.123023 | 2019-07-31T14:14:41 | 2019-07-31T14:14:41 | 200,228,828 | 2 | 0 | MIT | 2019-08-02T12:12:54 | 2019-08-02T12:12:54 | null | UTF-8 | Swift | false | false | 1,316 | swift | //
// GYSegmentView.swift
// Landmarks
//
// Created by alexyang on 2019/6/6.
// Copyright © 2019 Apple. All rights reserved.
//
import UIKit
import SwiftUI
struct GYSegmentView : UIViewRepresentable {
func makeCoordinator() -> GYSegmentView.Coordinator {
Coordinator(self)
}
var titles:[String]
@Binding var currentPage: Int
func makeUIView(context: Context) -> UISegmentedControl
{
let segment = UISegmentedControl(items: titles)
segment.addTarget(context.coordinator, action:#selector(Coordinator.updateCurrentPage(sender:)) , for: .valueChanged)
return segment
}
func updateUIView(_ segment: UISegmentedControl, context: Context) {
segment.selectedSegmentIndex = currentPage
}
class Coordinator: NSObject {
var control: GYSegmentView
init(_ control: GYSegmentView) {
self.control = control
}
@objc func updateCurrentPage(sender: UISegmentedControl) {
control.currentPage = sender.selectedSegmentIndex
}
}
}
#if DEBUG
struct GYSegmentView_Previews : PreviewProvider {
static var previews: some View {
GYSegmentView(titles: ["哈哈","你好","无聊"], currentPage: .constant(0))
}
}
#endif
| [
-1
] |
20c8d4c7937f7d076de9ea3ea408784ae23fdd8a | 64b24ec0d833accaf7a848ae2209a41b796f31ad | /Sandwich/autoresize.swift | d80731c9297a387431570b3f76d3f7db5fb92783 | [] | no_license | brandly/Sandwich | 8960813a97fbcc1c0c04cc2a995a2055aa132872 | 920fe4cf6bd17eedf6bb9702eeb7aad3e06c7a83 | refs/heads/master | 2021-01-19T14:04:59.350827 | 2014-10-02T08:12:04 | 2014-10-02T08:12:04 | 24,582,290 | 1 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 601 | swift | //
// autoresize.swift
// Sandwich
//
// Created by Matthew Brandly on 9/28/14.
//
//
import UIKit
extension UILabel {
func autoresize() {
if let textNSString: NSString = self.text {
let rect = textNSString.boundingRectWithSize(CGSizeMake(self.frame.size.width, CGFloat.max),
options: NSStringDrawingOptions.UsesLineFragmentOrigin,
attributes: [NSFontAttributeName: self.font],
context: nil)
self.frame = CGRectMake(self.frame.origin.x, self.frame.origin.y, self.frame.size.width, rect.height)
}
}
}
| [
-1
] |
de577793a1904b732e615b4b6aad89cf09c2d1a5 | 00528929b2f412200a847d80ed921e69698eee81 | /Weather/utils/extensions/UIViewExtension.swift | 95786e248b4bfa9a10d5f05bfaf39e7e6242297b | [] | no_license | ganimades/weather | e4570ab2f2d3e151e5e91be185e66f70e05bfd47 | adfa72e7b6cf04f961e0425be126d53e32c86e19 | refs/heads/master | 2021-01-08T06:58:36.696114 | 2020-02-20T21:08:47 | 2020-02-20T21:08:47 | 241,948,673 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,286 | swift | //
// UIViewExtension.swift
// Weather
//
// Created by Gitko on 20/02/2020.
// Copyright © 2020 Filip Nowicki. All rights reserved.
//
import UIKit
extension UIView {
func anchor (top: NSLayoutYAxisAnchor?, paddingTop: CGFloat, leading: NSLayoutXAxisAnchor?, paddingLeft: CGFloat, bottom: NSLayoutYAxisAnchor?, paddingBottom: CGFloat, trailing: NSLayoutXAxisAnchor?, paddingRight: CGFloat, width: CGFloat, height: CGFloat) {
translatesAutoresizingMaskIntoConstraints = false
if let top = top {
topAnchor.constraint(equalTo: top, constant: paddingTop).isActive = true
}
if let leading = leading {
leadingAnchor.constraint(equalTo: leading, constant: paddingLeft).isActive = true
}
if let trailing = trailing {
trailingAnchor.constraint(equalTo: trailing, constant: -paddingRight).isActive = true
}
if let bottom = bottom {
bottomAnchor.constraint(equalTo: bottom, constant: -paddingBottom).isActive = true
}
if height != 0 {
heightAnchor.constraint(equalToConstant: height).isActive = true
}
if width != 0 {
widthAnchor.constraint(equalToConstant: width).isActive = true
}
}
}
| [
-1
] |
d43ce61c982ff4045715e83d9a8ff73ec5b64e5f | 0fc63fda5afedc55400d54df76709c1b9dffb342 | /Todoey/Data Model/Category.swift | 01cc2c31f91420b8a6ba85bf0ed50e7b35ab76ec | [] | no_license | Selecao/Todoey | 7a1cdb364413805b7a7cb8d334591eb694defa60 | 011eb7b9c2cb1c2d45fe6543eb1b65897b25fbf8 | refs/heads/master | 2020-03-22T03:54:09.088001 | 2018-07-09T12:51:54 | 2018-07-09T12:51:54 | 139,459,186 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 305 | swift | //
// Category.swift
// Todoey
//
// Created by Ivan Nekoz on 07.07.2018.
// Copyright © 2018 Vaan Neko. All rights reserved.
//
import Foundation
import RealmSwift
class Category: Object {
@objc dynamic var name: String = ""
//forward relathionship by realm
let items = List<Item>()
}
| [
-1
] |
0a45951b7d36b1f6904b3305e1b38984284bbebd | 212dcc09f2d7c5942f36719d4fdc7e3b02ed1332 | /Halfway/Event.swift | 1070e952b40abefba42d6e29bbaca99389f3dc2d | [] | no_license | mitasray/Halfway | c2a06e9f689c5f11e65f53bc01fd2c471c89bf60 | e63a14764859aa8d3fabe7824bfddcf814b0a6ba | refs/heads/master | 2021-01-18T20:30:28.109999 | 2015-10-24T06:05:21 | 2015-10-24T06:05:21 | 36,824,880 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 450 | swift | //
// Event.swift
// Halfway
//
// Created by Kevin Arifin on 8/24/15.
// Copyright (c) 2015 mitas.ray. All rights reserved.
//
import Foundation
import RealmSwift
class Event: Object {
let invitedUsers = List<User>()
dynamic var details = ""
dynamic var date = NSDate()
dynamic var latitude: Double = 0.0
dynamic var longitude: Double = 0.0
dynamic var meeting_point: String = ""
dynamic var address: String = ""
}
| [
-1
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.