Package ca.weblite.objc.util

Source Code of ca.weblite.objc.util.CocoaUtils

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package ca.weblite.objc.util;

import ca.weblite.objc.NSObject;
import static ca.weblite.objc.RuntimeUtils.sel;
import ca.weblite.objc.annotations.Msg;

/**
*
* @author shannah
*/
public class CocoaUtils {
   
   
    public static void dispatch_async(final Runnable r){
        (new NSObject("NSObject"){
            @Msg(selector="run", like="NSObject.finalize")
            public void run(){
                r.run();
            }
        }).send("performSelectorOnMainThread:withObject:waitUntilDone:", sel("run"), null, false);
    }
   
   
    public static void dispatch_sync(final Runnable r){
        (new NSObject("NSObject"){
            @Msg(selector="run", like="NSObject.finalize")
            public void run(){
                r.run();
            }
        }).send("performSelectorOnMainThread:withObject:waitUntilDone:", sel("run"), null, true);
    }
   
}
TOP

Related Classes of ca.weblite.objc.util.CocoaUtils

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.