THE BLOG

13
Sep

MKMapView too slow? Use preview – MKMapSnapshotter

Did you ever needed to just show a piece of map and added it disabling all touch events and end up with crazy slow unneccesary MKMapView? I’ve recently discovered

MKMapSnapshotter

which solves all the issues. We can use it since iOS7 so MKMapView can be easily replaced and snapshotter result (which is an image) can be cached – clean and quick!

import MapKit
import CoreLocation

let coords = CLLocationCoordinate2D(latitude: 52.235799, longitude: 20.995958)
let distanceInMeters: Double = 500
let size = CGSize(width: 200, height: 200)

let options = MKMapSnapshotOptions()
options.region = MKCoordinateRegionMakeWithDistance(coords, distanceInMeters, distanceInMeters)
options.size = size

let snapShotter = MKMapSnapshotter(options: options)
let bgQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)
// this might be run in foregourd but we want to have responsive UI
// which helped a lot being a UITableViewCell which lagged a lot
snapShotter.startWithQueue(bgQueue) { [weak self] (snapShot, error) in
    guard error == nil else {
        return
    }

    if let snapShotImage = snapShot?.image, let coordinatePoint = snapShot?.pointForCoordinate(coords), let pinImage = UIImage(named: "pinImage") {
        UIGraphicsBeginImageContextWithOptions(snapShotImage.size, true, snapShotImage.scale)
        snapShotImage.drawAtPoint(CGPointZero)
        // need to fix the point position to match the anchor point of pin which is in middle bottom of the frame
        let fixedPinPoint = CGPointMake(coordinatePoint.x - pinImage.size.width / 2, coordinatePoint.y - pinImage.size.height)
        pinImage.drawAtPoint(fixedPinPoint)
        let mapImage = UIGraphicsGetImageFromCurrentImageContext()
        dispatch_async(dispatch_get_main_queue(), {
            self?.mapPreviewImageView.image = mapImage
            // stop and hide spinner which was in image center place
            self?.activityIndicator.stopAnimating()
        })
        UIGraphicsEndImageContext()
    }
}

I’ve put some comments to explain some non standard stuff but overall it should be simple enough. If you have any questions just ask!

23
Apr

Impact of mobile applications in healthcare

Mоbіlе hеаlth, оr mHealth, іѕ a tеrm uѕеd to dеѕсrіbе the use of mobile telecommunication dеvісеѕ as hеаlthсаrе. Wе use mobile dеvісеѕ to read thе nеwѕ, wаtсh sports аnd communicate wіth others, аnd nоw it’s bеіng used to іmрrоvе hеаlthсаrе.

Innоvаtіvе features like dіgіtаl hоѕріtаl rooms and vіrtuаl mеdісіnе kiosks аrе аlrеаdу еnаblіng рhуѕісіаnѕ tо monitor, dіаgnоѕе and trеаt patients frоm rеmоtе lосаtіоnѕ. It’ѕ сhаngіng the wау healthcare іѕ dеlіvеrеd – providing dосtоrѕ аnd раtіеntѕ wіth аnуtіmе/аnуwhеrе access.

Continue Reading..

15
Apr

Work Perks: Unlimited vacation vs Productivity

There is a tenuous balance that every business organization must face—a positive and relaxing work culture and the need to maximize productivity. Some companies, particularly the more established ones, tend to forego developing a positive work culture altogether and simply expect employees to be the henchmen of the management’s will. This state of affairs is naturally demotivating and these companies have seen a dip in their productivity related to that. Now that even the most ardent Old School business men and women are coming to grips with the benefits of a positive work culture, they are left with the challenge of figuring out how to design a maximally productive one.
Continue Reading..

17
Oct

Picking a sport smartwatch – Garmin Vívoactive

Getting a right sports smartwatch could be a challenge especially that we are now overwhelmed with amount of manufacturers that grew out of sudden. I am currently using Garmin Vívoactive and I will show you here why. I did quite a research and I’ve been using few others wearables before I ended up with Garmin.
Continue Reading..

18
Jul

XCode 7 Beta 3 crash after opening project

Apple recently released another beta version of it’s XCode 7. Unfortunately it comes not only with fixes but with one extremely annoying bug. After you try to create new or open existing project it just crashes. Lucky for us there is a quick solution for this. We need to remove some XCode configuration file (which will be regenerated after XCode will launch).

rm ~/Library/Preferences/com.apple.dt.Xcode.plist

05
Jun

Swift first steps: Singleton

Next day next challenge, as simple as it may be – creating Singleton – it can bring some problems in now known language using not known syntax. Lucky enough I was able to write my first Swift class and make it a working singleton (I have wrote unit tests that will testify it). So let’s take a look and next explain.

import Foundation

class Singleton {
    static let sharedInstance = Singleton()
    private init() {}
}

Continue Reading..

03
Jun

Apple’s Swift for iOS

Swift was introduced on WWDC by Apple as a new programming language for iOS and OS X. Apple claims that it’s much faster than Objective-C and has better syntax but let’s get deeper into to to judge ourselves. Official apple note:

Swift is an innovative new programming language for Cocoa and Cocoa Touch. Writing code is interactive and fun, the syntax is concise yet expressive, and apps run lightning-fast. Swift is ready for your next iOS and OS X project — or for addition into your current app — because Swift code works side-by-side with Objective-C.

Now we all have to download the Apple’s book and dive into it. Below I present some of my first impressions.Continue Reading..

07
Feb

Sharing subfolders of shared folder – dropbox

synappse dropbox share

Recently I came to a scenario when I had shared folder and wanted to share it with someone new – but not all of it, just one subfolder. Dropbox isn’t yet giving us good solution for this but we can do a little trick here and make it happen.

So the workaround is to create a symbolic link, you can do it either on widows and linux base systems. Go to the terminal and type:

For Windows

For Linux / OS X

After doing that just share newly created symbolic link with the person and you’re done.

26
Jan

UPC Think Big Final Gala

upc think big synappse museum guide

On the 22nd of the January we attended UPC Think Big final gala which featured 10 contest finalists. We had there opportunity to bring closer our idea to the judges who after 3 minutes of our presentation were entitled to ask three questions.Continue Reading..

04
Dec

Estimote hackathon

estimote ibeacons

On Saturday (30th November 2013) had place a first of the series of preparation hackathons for the Jitter hackathon at Mobile Central Europe conference. The Synappse Team went there to participate and make friends with this hackathon partner – Estimote.Continue Reading..