Must have iOS libraries

Posted on 10 Eylül 2018 in Programlama by

https://medium.com/app-coder-io/27-ios-open-source-libraries-to-skyrocket-your-development-301b67d3124c
Especially I love https://github.com/dzenbot/DZNEmptyDataSet

Action sheet controller
https://github.com/xmartlabs/XLActionController?utm_source=mybridge&utm_medium=blog&utm_campaign=read_more

Expanding collection
https://github.com/Ramotion/expanding-collection?utm_source=mybridge&utm_medium=blog&utm_campaign=read_more

Swift algorithms
https://github.com/raywenderlich/swift-algorithm-club

IOS library collection
https://github.com/matteocrippa/awesome-swift

ios swift mvvm tutorials

Posted on 02 Ağustos 2018 in Programlama by

You can find useful mvvm tutorials below:
https://medium.com/flawless-app-stories/how-to-use-a-model-view-viewmodel-architecture-for-ios-46963c67be1b
https://medium.com/@azamsharp/mvvm-in-ios-from-net-perspective-580eb7f4f129

A good video from raywenderlich

Aes encryption

Posted on 29 Haziran 2018 in Programlama by

http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html

iOS check update

Posted on 26 Haziran 2018 in Programlama by

Following is a swift code to check if update available.

    let plistUrl = "https://xyz.com/manifest.plist"
    let installationUrl = "itms-services://?action=download-manifest&url=https://xyz.com/manifest.plist"
    func checkForUpdates() {
        DispatchQueue.main.async(execute: {
            if let url = URL(string: self.plistUrl), let updateDictionary = NSDictionary(contentsOf: url) {
                let items = updateDictionary["items"]
                let itemDict = (items as AnyObject).lastObject as! NSDictionary
                let metaData = itemDict["metadata"] as! NSDictionary
                let serverVersion = metaData["bundle-version"] as! String
                let localVersion = Bundle.main.infoDictionary!["CFBundleShortVersionString"] as! String
                let updateAvailable = serverVersion.compare(localVersion, options: NSString.CompareOptions.numeric) == .orderedDescending;

                if updateAvailable {
                    self.showUpdateDialog(serverVersion: serverVersion)
                }
            }
        })
    }
    
    func showUpdateDialog(serverVersion: String) {
        let alertController = UIAlertController(title: "New version of MSP available", message:
            "MSP \(serverVersion) has been released. Would you like to download it now?", preferredStyle: UIAlertControllerStyle.alert)
        alertController.addAction(UIAlertAction(title: "Not now", style: .cancel,handler: self.updateHandler))
        alertController.addAction(UIAlertAction(title: "Update", style: .default, handler: self.updateHandler))
        self.present(alertController, animated: true, completion: nil)
    }

    func updateHandler(alert: UIAlertAction){
        switch alert.title {
        case "Update"?:
            UIApplication.shared.openURL(URL(string: self.installationUrl)!)
            exit(0)
        case "Not now"?: break
        default: break
        }
    }

git quick start guide

Posted on 14 Haziran 2018 in Programlama by

This tutorial guides starting git in a clear way:

https://git-scm.com/docs/gittutorial

IOS Notes

Posted on 17 Mayıs 2018 in Programlama by

To call a function when application becomes active

NotificationCenter.default.addObserver(self, selector: #selector(didBecomeActive), name: NSNotification.Name.UIApplicationDidBecomeActive, object: nil)

@objc func didBecomeActive() {
print(“did become active”)
//Do signaling offline works
}

—————

https://developer.apple.com/library/content/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/StrategiesforHandlingAppStateTransitions/StrategiesforHandlingAppStateTransitions.html

 

Creation of temporary url path:

let destURL = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent(“manifest.plist”)

Printing content of url

let contents = try String(contentsOf: destURL)

print(“!! contents:\(contents)”)

Must read iOS articles

Posted on 11 Mayıs 2018 in Programlama by

Debugging with xcode-8

Intermediate Debugging with Xcode 8

You can find pdf version of the page below
Intermediate Debugging with Xcode 8

Adaptive layout tutorial

Adaptive Layout Tutorial in iOS 11: Getting Started

You can find pdf version of the page and necessary attachments below
Adaptive Layout Tutorial in iOS 11: Getting Started
cloud_images
xcode project

IOS Visual format language

https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/AutolayoutPG/VisualFormatLanguage.html

https://code.tutsplus.com/tutorials/introduction-to-the-visual-format-language–cms-22715

You can find pdf version of the page below

Introduction to the Visual Format Language

Real-Time Communication with Streams Tutorial for iOS

How To: Pass Data Between View Controllers In Swift (Extended)

How to Use Xcode Targets to Manage Development and Production Builds

How to Use Xcode Targets to Manage Development and Production Builds

Closures
https://medium.com/@abhimuralidharan/functional-swift-all-about-closures-310bc8af31dd

Sending firebase requests over rest client

Posted on 08 Mayıs 2018 in Programlama by

First of all a rest client should be installed to pc. You may use “advanced rest client” extension for chrome browser for its simplicity or postman.

Following headers should be added:

Content-Type application/json
Authorization key=your server key or legacy key

Fcm uses following url to accept http queries:

https://fcm.googleapis.com/fcm/send

And at this point header configuration ui should be like similar to one below:

Server key could be obtained from firebase console page. It is located at “project settings”>>”cloud messaging” path. Following screenshot is added for illustration:

Continue reading…

Updating ios package on safari

Posted on 28 Mart 2018 in Programlama by

Just define a url as follows:

<a class=” btn-primary btn-lghref=”itms-services://?action=download-manifest&url=https://abc.com.tr/manifest.plist“>Download App</a>

and manifest.plist file should look like as follows:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>items</key>
    <array>
        <dict>
            <key>assets</key>
            <array>
                <dict>
                    <key>kind</key>
                    <string>software-package</string>
                    <key>url</key>
                    <string>https://abc.com.tr/xxx.ipa</string>
                </dict>
            </array>
            <key>metadata</key>
            <dict>
                <key>bundle-identifier</key>
                <string>com.def.abc</string>
                <key>bundle-version</key>
                <string>0.10.0</string>
                <key>kind</key>
                <string>software</string>
                <key>title</key>
                <string>XXX</string>
            </dict>
        </dict>
    </array>
</dict>
</plist>

As you can see ipa file path is defined in manifest file.

Java classpath usage

Posted on 20 Kasım 2016 in Programlama by

We will create following classes:
firstClass
\___ abc.java
secondClass
\___ xyz.java

Create a class with package name as p1.p2.p3 at firstClass directory

package p1.p2.p3;
public class abc {
    public void printName(String name) {
        System.out.println("your name is "+name);
    }
}

and compile it using following command:
javac abc.java -d .

lets add another class that uses abc class at secondClass directory

public class xyz extends p1.p2.p3.abc{
    public static void main(String prm[]) {
        System.out.println("xyz class");
        tt deneme = new tt();
        deneme.printName("Trump");
    }
}

and following command is used to compile it:
javac -classpath ../firstClass/ xyz.java

To execute compiled binary use following command:
java -cp .:../firstClass xyz