Skip to content

Instantly share code, notes, and snippets.

I said yeah.

Sofia Swidarowicz phynet

I said yeah.
View GitHub Profile
phynet / parse-html-string.swift
Created Oct 5, 2017
parse html string to string in swift
View parse-html-string.swift
import Foundation
import UIKit
@objc extension NSString {
class func parseHTMLString(stringHTML: String) -> NSString {
return try! NSAttributedString(
data: String.Encoding.unicode, allowLossyConversion: true)!,
options: [ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType],
View font-size-screen-size.m
#import "UIScreen+SizeScreenDevice.h"
#import "DeviceUtil.h"
//#warning [DeviceUtil hardware]
// pod DeviceUtil shows all iOS sizes...
typedef NS_ENUM(NSUInteger, DEVICE){
phynet / raw-representable.swift
Created Sep 27, 2017
To use other value of enums rawValue: enum person -> person.RawValue is now person.string
View raw-representable.swift
extension RawRepresentable where RawValue == Int {
var number: Int {
return rawValue
extension RawRepresentable where RawValue == String {
var string: String {
return rawValue
phynet / addColorString.swift
Last active Aug 9, 2017
Add color to a certain part of a string (or NSString)
View addColorString.swift
func configureTextr() -> NSAttributedString{
let text = "first string"
let aviso = "second string"
let mainText = text! + " " + aviso!
let attributeText = aviso
let range = (mainText as NSString).range(of: attributeText!)
let attributedString = NSMutableAttributedString(string:mainText)
attributedString.addAttribute(NSForegroundColorAttributeName, value: UIColor.rentaliaLightBlue(withAlpha: 1), range: range)
return attributedString
phynet / Golden
Created May 24, 2017 — forked from jaylyerly/Golden
Draw the Golden Spiral in Swift
View Golden
let 𝜋 = M_PI
let ɸ = (1 + sqrt(5))/2
func drawTiles(tileCount: Int, height: Double, context: CGContext) {
let red = CGFloat(arc4random_uniform(100)) / 100.0
let green = CGFloat(arc4random_uniform(100)) / 100.0
let blue = CGFloat(arc4random_uniform(100)) / 100.0
context.setFillColor(red: red, green: green, blue: blue, alpha: 1.0)
let rect = CGRect(x: 0, y: 0, width: height, height: height) // CGFloat, Double, Int
phynet / bridging-error.mkd
Last active Aug 13, 2020
implicit import bridging header in module is deprecated
View bridging-error.mkd

now in swift 4 you just have to import a briding header into Test target and reference objc-class .h files there...using @testable import nameOfYourApp should work

In Swift there's a message in "Test Target" that states that the bridging header will be removed in newer versions of swift. I'm using mixed objc and swift clasess, but the UnitTest class is a swift file. Using @testable key was there in code

  @testable import YourProject

You fix it by adding in your Test area the bridging header with objc headers that your test will use:

phynet / Log environment variables in xcode.mkd
Last active Mar 23, 2017
Log environment variables available in Xcode
View Log environment variables in xcode.mkd

To know all environment variables used for building in Xcode. Good to use with any run script use:

  1. Create a new Run Script Phase in Menu Build Phases option.
  2. Add export text inside
  3. Move the script after Target Dependcies
  4. Compile or Run
  5. Go to Navigation Pane (to the left) and select the Log navigator item (the last one in the series, looks like a bubble message)
  6. Check all the variables available in the message pane

Xcode Log env variables

phynet / map-reduce-filter-flatMap.swift
Created Mar 19, 2017
Examples for flatMap, Map, Reduce, Filter in Swift
View map-reduce-filter-flatMap.swift
//Use reduce to combine all items in a collection to create a single new value.
let numbers = [1, 3, 5, 7, 9]
//sum all values from the array (+)
let result = numbers.reduce(0, +)
//sum all values from the array (+) plus one
let result2 = numbers.reduce(1, +)
let result3 = numbers.reduce(1, *)

From Alejandro Ramírez

Does my server supports ATS?

 nscurl --ats-diagnostics

The tool will run through several different combinations of ATS exceptions, trying a secure connection to the given host under each ATS configuration and reporting the result. The ATS configuration changes made by nscurl include:

• Turning on the “allow arbitrary loads” flag
• Dropping the minimum required TLS version to 1.1, then 1.0
phynet / Type of Software Testing.mkd
Last active Jul 25, 2021
Different types of software testing
View Type of Software Testing.mkd


Testing to verify a product meets customer specified requirements. A customer usually does this type of testing on a product that is developed externally.


Testing without knowledge of the internal workings of the item being tested. Tests are usually functional.


Testing to ensure compatibility of an application or Web site with different browsers, OSs, and hardware platforms. Compatibility testing can be performed manually or can be driven by an automated functional or regression test suite.