How to read and write file in Swift

In Swift 3 the syntax is a just a few different than the 1 or 2 version:

let file = "file.txt" //this is the file. we will write to and read from it

let text = "some text" //just a text

if let dir = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first {

    let path = dir.appendingPathComponent(file)

    // writing
    do {
        try text.write(to: path, atomically: false, encoding: String.Encoding.utf8)
    catch {/* error handling here */}

    do {
        let text2 = try String(contentsOf: path, encoding: String.Encoding.utf8)
    catch {/* error handling here */}


How to sniff iPhone web traffic with Wireshark

Open Xcode and click on top Devices like in the image below:

Devices from Xcode

Copy the identifier (in the black row):

Identifier iPhone from Xcode

Now open the terminal and paste:

rvictl -s idcopyed

If it show:

Starting device identifiercopiato [SUCCEEDED] with interface rvi0

Open Wireshark and start sniffing from rvi0. Voilà!

How to delete cache and free space on Xcode

If something goes wrong or the simple Clean and rebuild does not work, you must delete the contents of these folders right now (carefully).

~/Library/Developer/Xcode/iOS DeviceSupport
~/Library/Application Support/MobileSync/Backup

Thanks to the source.

Word of the day

Do you want to show off a sophisticated language but your vocabulary is always reduced to the same words?

Do you want to enrich your dictionary with the words that you often hear?

Word of the day is the app for you!

Every day you will have at hand a new word with its meaning and you can display it within the application, in the notification center, or on your Apple Watch.

You can also tap on the circle to generate a new random word so you’ll never get tired. In the archive there are a myriad of definitions, and you can suggest new words in the section that will be added in the next version!

All definitions were found online.


Suppose you bought a new car and want to know what cost the last thee years. If you paid $ 20,000, and 365 days have passed, what will it cost per day? Dailycharge does the calculation for you! And… it is easy: $ 54.79!

Do you want to know how much it costs you daily the new computer that you buy?

With Dailycharge you may calculate it in a heartbeat! Simply you can just enter the name of the product, date of purchase and the price! The daily calculation does the app!

That’s all! Download now Dailycharge.