<!–Swift for Home Windows arrives finally, But InfoWorld
Knowledgeable information diagnosis every weekday
Developers who want to try out Apple’s language on Home Windows can get began with this unofficial port, But an reliable Model is not going until Swift Three.0
// Keep Away From putting Elements too soon as a result of non-Massive figures inflating the cumulative Peak
if ($(this).is(“Determine”) && !$(this).is(“Figure.Large”))
cumulativeHeight += grafHeight;
// clone Associated Tales module to return in after eighth para in article body for Mobile breakpoint display
var $relatedStories = $(‘.Related-promo-wrapper’);
if ($relatedStories.size)
var $relatedStoriesClone = $relatedStories.clone();
$relatedStoriesClone.insertAfter( “#drr-container > p:eq(7)”);
// For Cell simplest, Situation Advert after second paragraph.
if (firstMobileAdHtml)
$(firstMobileAdHtml).insertAfter(“#drr-container > p:eq(1)”);
var $insiderPromo = $(‘.insider-promo-wrapper’);
if ($insiderPromo.length)
var $insiderPromoClone = $insiderPromo.clone();
$insiderPromoClone.insertAfter( “#drr-container > p:eq(1)”);
//Place left aspect Part
cumulativeHeight = 0;
var leftPlacementTarget = tagHeight = leftPlacementTarget)
if (debug)
console.log(“congratulations… now we have handed the preliminary Start level”);
if (leftPlacementIndex == null)
//It’s Not excellent sufficient to Not be a left Avoid – it additionally is not a
with an immediately preceding small or medium image left Keep Away From.
if (!isLeftAvoid($(this)) && noPrevFigures($(this)) )
leftPlacementIndex = $(this).index();
$leftPlacementElement = $(this);
leftPlacementLookaheadStart = cumulativeHeight;
if (debug)
console.log(“shouldn’t be a left Steer Clear Of and no prev figures. ########## set placementIndex (“+leftPlacementIndex+”) and lookaheadStart (“+leftPlacementLookaheadStart+”) ##########”);
else
if (debug)
console.log(“is a left Steer Clear Of or has earlier figures. proceed”);
else
if (debug)
console.log(“#### leftPlacementIndex already set to “+leftPlacementIndex+”. looking AHEAD…”);
//Now Not null; has been set
if ((cumulativeHeight – leftPlacementLookaheadStart) > leftIntervalHeight)
if (debug)
console.log(“###### THRESHOLD REACHED. LOOKAHEAD COMPLETE. Finish ###### (cumulativeHeight – leftPlacementLookaheadStart) (“+(cumulativeHeight-leftPlacementLookaheadStart)+”) > leftIntervalHeight (“+leftIntervalHeight+”).”);
return false;
else
if (debug) $(this).hasClass(‘medium’)
);
if (leftPlacementIndex != null && elementNotNearEnd($leftPlacementElement, leftPixelWindow))
if (debug)
console.log(” insert into index “+leftPlacementIndex);
// Add Right rail module content
for (var i=0; i” + adString + “
“;
function getEpoParams()
/**
* @param jqo Authentic jquery object Goal
* @param divString The div to be inserted.
* @return Distinction in Height between Unique placement Goal and closing Goal.
* Assessments first 6 Components for an allowable placement (600 pixel window).
* If none, Test nearby for Elements that aren’t Proper avoids.
* If none, Location Element sooner than current Target.
*/
operate applyInsert(jqo, divString)
if (debug)
console.log(“applyInsert at high and jqo index is: ” + jqo.index());
for (var i=Zero; i Zero)
children = $(“#drr-container”).children().slice(jqo.index(), allowElement.index() );
if (children != null)
children.EVERY(function(i)
if (debug)
console.log(“About so as to add this Component’s Top to heigh diff offset”);
console.log($(this));
Top += $(this).Height() + grafHeight;
);
if (offset 300)
if (debug)
console.log(“isRightAvoid: discovered pre. return proper”);
return proper;
if (jqo.is(“Determine”) && jqo.hasClass(‘Large’))
if (debug)
console.log(“isRightAvoid: found Determine.Massive return authentic”);
return actual;
if (jqo.is(“Figure”) && jqo.hasClass(‘medium’) && jqo.hasClass(‘inline’))
if (debug)
console.log(“isRightAvoid: discovered Determine has Type medium and inline.”);
return actual;
if (jqo.is(‘div’) && jqo.hasClass(‘Desk-wrapper’))
if (debug)
console.log(“isRightAvoid: discovered div with Type Desk-wrapper”);
return proper;
if (jqo.is(‘aside’))
if (jqo.hasClass(‘sidebar’) && !jqo.hasClass(‘medium’))
if (debug)
console.log(“isRightAvoid: found apart with Class sidebar, with out Category medium”);
return real;
if (jqo.hasClass(‘statsTable’))
if (debug)
console.log(“isRightAvoid: found aside with Classification statsTable”);
return true;
if (jqo.hasClass(‘download-asset’))
if (debug)
console.log(“isRightAvoid: found Category download-asset return true”);
return authentic;
if (jqo.hasClass(‘tableLarge’))
if (debug)
console.log(“isRightAvoid: discovered Category tableLarge return true”);
return authentic;
if (jqo.hasClass(‘reject’))
if (debug)
console.log(“isRightAvoid: discovered Class reject. return genuine”);
return genuine;
if (jqo.is(‘Desk’) && jqo.hasClass(‘scorecard’))
if (debug)
console.log(“isRightAvoid: found div with Class scorecard”);
return real;
return false;
// Return actual if Part has Classification ‘reject’: is not going to Situation drr modules/ads subsequent to these Components
function isRightReject(jqo)
console.log(“in isRightReject”);
if (jqo != null)
if (jqo.hasClass(“reject”))
if (debug)
console.log(“isRightReject: discovered ‘reject’ Category”);
return true;
return false;
return false;
// Returns genuine if Height of all Parts after this one is greater than 500; false otherwise
function elementNotNearEnd(Element, pixelWindow)
if (pixelWindow == null)
pixelWindow = 500;
if (Component == null)
return false;
var remainingHeight = Zero;
var youngsters = $(“#drr-container”).kids().slice(Element.index());
if (children == null)
return false;
else
if (debug)
console.log(“Part too as regards to Finish. Remaining Peak is: ” + remainingHeight + ” and window is ” + pixelWindow);
return false;
/**
* Return proper if need to Avoid this Component when inserting left module.
*/
operate isLeftAvoid(jqo)
if (jqo.is(“Figure”))
if (debug)
console.log(“isLeftAvoid: found Determine. return real”);
return genuine;
if (jqo.is(“aside.pullquote”))
if (debug)
console.log(“isLeftAvoid: found pullquote. return real”);
return true;
if (jqo.is(“pre”))
if (debug)
console.log(“isLeftAvoid: found pre. return proper”);
return true;
if (jqo.is(“div.gist”))
if (debug)
console.log(“isLeftAvoid: discovered github code block. return authentic”);
return true;
if (jqo.is(“aside”) && jqo.hasClass(“sidebar”) && jqo.hasClass(“medium”))
if (debug)
console.log(“isLeftAvoid: found medium sidebar. return real”);
return actual;
if (jqo.hasClass(“statsTable”))
if (debug)
console.log(“isLeftAvoid: found Type statsTable. return real”);
return real;
return false;
/**
* return proper if there are not any figures prior to the Target placement that might bleed down into placement Element
*/
operate noPrevFigures($originalTarget)
var targetIndex = $originalTarget.index();
var numElementsLookBack = 5;
var figureIndex = null;
var figureHeight = null;
var startIndex = targetIndex – numElementsLookBack
An open Supply effort to port Apple’s Swift language to Home Windows last week launched new Variations of each Supply code and binaries.
Swift was once in the beginning developed through Apple as a alternative for the objective-C language used to Strengthen apps for iOS. However after being released as an open Source undertaking, Swift speedy gained traction out of doors of iOS developer circles, as when IBM created a cloud-hosted development environment for Swift.
Versions of the language already exist for Mac OS X and Linux, However except now no open Supply port of Apple’s Swift code to Windows used to be on hand or introduced. An respectable Home Windows unencumber might Still be drawing close, However in the interim this Version — which does No Longer appear to be backed or developed through someone from Apple or Microsoft — claims to supply general Swift functionality on Sixty Four-bit Windows 10.
The Home Windows port is to be had on GitHub in its Original incarnation, and pre-built binaries are to be had using both Microsoft Visual C++ and Cygwin (even supposing the MSVC builds are likely to be extra reliable). Any Other challenge on Microsoft’s CodePlex hub provides a Home Windows compiler for Swift, with a easy GUI to make it easier to use.
The Most recent build of Swift for Home Windows requires Visible Studio 2015 and LLVM 3.8.0 to assemble Swift Source code to binaries. To Just run the Swift interpreter, you need simplest the Visible C++ Redistributable for Visual Studio 2015. Compiling and linking with each static and dynamic libraries is supported.
Different Versions of Swift were implemented for Home Windows, However they are not open Source. Silver, For Instance, is an implementation of Swift supposed for developing platform-native functions. It leverages the .Net CLR (with Visual Studio integration), the Java and Android digital machines, and Apple’s Cocoa runtime on their respective systems. However Silver, even supposing it’s free to make use of, shouldn’t be an open Source product.
Apple has made it clear that its long-time period plans for Swift Three.0 embody platform portability, so Swift code written on one platform may also be ported with minimal changes. It’s possible the primary “official” Home Windows Versions of Swift will appear when Version Three.0 of the language is released. Nonetheless, this unofficial port must permit the Swift-curious on Home Windows to get aware of the language without needing to vary platforms.
You must be logged in to post a comment Login