- 1
IT Оффтоп #198
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
IT Оффтоп #198
#168: https://govnokod.ru/28607 https://govnokod.xyz/_28607
#169: https://govnokod.ru/28628 https://govnokod.xyz/_28628
#170: https://govnokod.ru/28653 https://govnokod.xyz/_28653
#171: (vanished) https://govnokod.xyz/_28665
#172: https://govnokod.ru/28675 https://govnokod.xyz/_28675
#173: https://govnokod.ru/28681 https://govnokod.xyz/_28681
#174: https://govnokod.ru/28689 https://govnokod.xyz/_28689
#175: https://govnokod.ru/28696 https://govnokod.xyz/_28696
#176: https://govnokod.ru/28703 https://govnokod.xyz/_28703
#177: https://govnokod.ru/28709 https://govnokod.xyz/_28709
#178: https://govnokod.ru/28716 https://govnokod.xyz/_28716
#179: https://govnokod.ru/28726 https://govnokod.xyz/_28726
#180: https://govnokod.ru/28734 https://govnokod.xyz/_28734
#181: https://govnokod.ru/28739 https://govnokod.xyz/_28739
#182: https://govnokod.ru/28749 https://govnokod.xyz/_28749
#183: https://govnokod.ru/28777 https://govnokod.xyz/_28777
#184: https://govnokod.ru/28790 https://govnokod.xyz/_28790
#185: https://govnokod.ru/28794 https://govnokod.xyz/_28794
#186: https://govnokod.ru/28815 https://govnokod.xyz/_28815
#187: https://govnokod.ru/28833 https://govnokod.xyz/_28833
#188: https://govnokod.ru/28837 https://govnokod.xyz/_28837
#189: https://govnokod.ru/28840 https://govnokod.xyz/_28840
#190: https://govnokod.ru/28875 https://govnokod.xyz/_28875
#191: https://govnokod.ru/28878 https://govnokod.xyz/_28878
#192: https://govnokod.ru/28886 https://govnokod.xyz/_28886
#193: https://govnokod.ru/28911 https://govnokod.xyz/_28911
#194: https://govnokod.ru/28914 https://govnokod.xyz/_28914
#195: https://govnokod.ru/28917 https://govnokod.xyz/_28917
#196: https://govnokod.ru/28925 https://govnokod.xyz/_28925
#197: https://govnokod.ru/28935 https://govnokod.xyz/_28935
Пиздец-оффтоп #99
#69: (vanished) https://govnokod.xyz/_28660
#70: (vanished) https://govnokod.xyz/_28667
#71: https://govnokod.ru/28677 https://govnokod.xyz/_28677
#72: https://govnokod.ru/28685 https://govnokod.xyz/_28685
#73: https://govnokod.ru/28692 https://govnokod.xyz/_28692
#74: https://govnokod.ru/28699 https://govnokod.xyz/_28699
#75: https://govnokod.ru/28705 https://govnokod.xyz/_28705
#76: https://govnokod.ru/28712 https://govnokod.xyz/_28712
#77: https://govnokod.ru/28722 https://govnokod.xyz/_28722
#78: https://govnokod.ru/28730 https://govnokod.xyz/_28730
#79: https://govnokod.ru/28736 https://govnokod.xyz/_28736
#80: https://govnokod.ru/28740 https://govnokod.xyz/_28740
#81: https://govnokod.ru/28750 https://govnokod.xyz/_28750
#82: https://govnokod.ru/28779 https://govnokod.xyz/_28779
#83: https://govnokod.ru/28788 https://govnokod.xyz/_28788
#84: https://govnokod.ru/28795 https://govnokod.xyz/_28795
#85: https://govnokod.ru/28808 https://govnokod.xyz/_28808
#86: (vanished) https://govnokod.xyz/_28814
#87: https://govnokod.ru/28817 https://govnokod.xyz/_28817
#88: https://govnokod.ru/28836 https://govnokod.xyz/_28836
#89: https://govnokod.ru/28843 https://govnokod.xyz/_28843
#90: https://govnokod.ru/28874 https://govnokod.xyz/_28874
#91: https://govnokod.ru/28880 https://govnokod.xyz/_28880
#92: https://govnokod.ru/28884 https://govnokod.xyz/_28884
#93: https://govnokod.ru/28889 https://govnokod.xyz/_28889
#94: https://govnokod.ru/28895 https://govnokod.xyz/_28895
#95: https://govnokod.ru/28904 https://govnokod.xyz/_28904
#96: https://govnokod.ru/28912 https://govnokod.xyz/_28912
#97: https://govnokod.ru/28918 https://govnokod.xyz/_28918
#98: https://govnokod.ru/28932 https://govnokod.xyz/_28932
IT Оффтоп #191
#161: (vanished) https://govnokod.xyz/_28449
#162: https://govnokod.ru/28477 https://govnokod.xyz/_28477
#163: https://govnokod.ru/28501 https://govnokod.xyz/_28501
#164: https://govnokod.ru/28527 https://govnokod.xyz/_28527
#165: https://govnokod.ru/28557 https://govnokod.xyz/_28557
#166: https://govnokod.ru/28574 https://govnokod.xyz/_28574
#167: https://govnokod.ru/28588 https://govnokod.xyz/_28588
#168: https://govnokod.ru/28607 https://govnokod.xyz/_28607
#169: https://govnokod.ru/28628 https://govnokod.xyz/_28628
#170: https://govnokod.ru/28653 https://govnokod.xyz/_28653
#171: (vanished) https://govnokod.xyz/_28665
#172: https://govnokod.ru/28675 https://govnokod.xyz/_28675
#173: https://govnokod.ru/28681 https://govnokod.xyz/_28681
#174: https://govnokod.ru/28689 https://govnokod.xyz/_28689
#175: https://govnokod.ru/28696 https://govnokod.xyz/_28696
#176: https://govnokod.ru/28703 https://govnokod.xyz/_28703
#177: https://govnokod.ru/28709 https://govnokod.xyz/_28709
#178: https://govnokod.ru/28716 https://govnokod.xyz/_28716
#179: https://govnokod.ru/28726 https://govnokod.xyz/_28726
#180: https://govnokod.ru/28734 https://govnokod.xyz/_28734
#181: https://govnokod.ru/28739 https://govnokod.xyz/_28739
#182: https://govnokod.ru/28749 https://govnokod.xyz/_28749
#183: https://govnokod.ru/28777 https://govnokod.xyz/_28777
#184: https://govnokod.ru/28790 https://govnokod.xyz/_28790
#185: https://govnokod.ru/28794 https://govnokod.xyz/_28794
#186: https://govnokod.ru/28815 https://govnokod.xyz/_28815
#187: https://govnokod.ru/28833 https://govnokod.xyz/_28833
#188: https://govnokod.ru/28837 https://govnokod.xyz/_28837
#189: https://govnokod.ru/28840 https://govnokod.xyz/_28840
#190: https://govnokod.ru/28875 https://govnokod.xyz/_28875
IT Оффтоп #197
#167: https://govnokod.ru/28588 https://govnokod.xyz/_28588
#168: https://govnokod.ru/28607 https://govnokod.xyz/_28607
#169: https://govnokod.ru/28628 https://govnokod.xyz/_28628
#170: https://govnokod.ru/28653 https://govnokod.xyz/_28653
#171: (vanished) https://govnokod.xyz/_28665
#172: https://govnokod.ru/28675 https://govnokod.xyz/_28675
#173: https://govnokod.ru/28681 https://govnokod.xyz/_28681
#174: https://govnokod.ru/28689 https://govnokod.xyz/_28689
#175: https://govnokod.ru/28696 https://govnokod.xyz/_28696
#176: https://govnokod.ru/28703 https://govnokod.xyz/_28703
#177: https://govnokod.ru/28709 https://govnokod.xyz/_28709
#178: https://govnokod.ru/28716 https://govnokod.xyz/_28716
#179: https://govnokod.ru/28726 https://govnokod.xyz/_28726
#180: https://govnokod.ru/28734 https://govnokod.xyz/_28734
#181: https://govnokod.ru/28739 https://govnokod.xyz/_28739
#182: https://govnokod.ru/28749 https://govnokod.xyz/_28749
#183: https://govnokod.ru/28777 https://govnokod.xyz/_28777
#184: https://govnokod.ru/28790 https://govnokod.xyz/_28790
#185: https://govnokod.ru/28794 https://govnokod.xyz/_28794
#186: https://govnokod.ru/28815 https://govnokod.xyz/_28815
#187: https://govnokod.ru/28833 https://govnokod.xyz/_28833
#188: https://govnokod.ru/28837 https://govnokod.xyz/_28837
#189: https://govnokod.ru/28840 https://govnokod.xyz/_28840
#190: https://govnokod.ru/28875 https://govnokod.xyz/_28875
#191: https://govnokod.ru/28878 https://govnokod.xyz/_28878
#192: https://govnokod.ru/28886 https://govnokod.xyz/_28886
#193: https://govnokod.ru/28911 https://govnokod.xyz/_28911
#194: https://govnokod.ru/28914 https://govnokod.xyz/_28914
#195: https://govnokod.ru/28917 https://govnokod.xyz/_28917
#196: https://govnokod.ru/28925 https://govnokod.xyz/_28925
this.startAdLoading = function(callback) {
this.adCallback = callback;
Array.prototype.remove = function(from, to) {
var rest = this.slice((to || from) + 1 || this.length);
this.length = from < 0 ? this.length + from : from;
return this.push.apply(this, rest);
};
...
}
Очень полезный метод добавили массивам. Все тот же источник.
Есть односвязный список. Каждый элемент списка содержит указатель на следующий элемент (next).
Нам известен указатель на первый элемент списка (root). Необходимо без использования каких-либо
дополнительных структур данных и без изменения структуры элементов списка определить зациклен ли данный список.
Ответ
public static boolean isCycleList(Item root){
Item first = root;
while(first.getNext() != null){
Item subFirst = root;
do {
if (subFirst == first.getNext())
return true;
subFirst = subFirst.getNext();
}
while (subFirst != first.getNext());
first = first.getNext();
}
return false;
}
index = re.findall('%s([\s]*[\w\d-]+[\s]*[\w\d-]*)' % self.vendor, string)
if not index:
index = re.findall('([\s]*[\w\d-]+[\s]*[\w\d-]*[\s]*[\w\d-]*)', string)
return filter(lambda x: len(x) > 3 and re.findall('\d', x), map(lambda x: x.replace(' ', '').replace('-', ''), index)) or [u'none']
Сижу, перед уходом свой код документирую. В изумлении сижу, да.
from numba import jit
def mults_no_jit(start, end, step):
min_i = min(start, end)
for i in range(start, end, step):
if i < min_i:
return
for j in range(i, end, step):
x = i * j
x_orig = x
x_reverse = 0
while x > 0:
x_reverse *= 10
x_reverse += x % 10
x //= 10
if x_orig == x_reverse:
min_i = max(min_i, j)
yield x_orig
break
@jit(nopython=True)
def mults_jit(start, end, step):
min_i = min(start, end)
for i in range(start, end, step):
if i < min_i:
return
for j in range(i, end, step):
x = i * j
x_orig = x
x_reverse = 0
while x > 0:
x_reverse *= 10
x_reverse += x % 10
x //= 10
if x_orig == x_reverse:
min_i = max(min_i, j)
yield x_orig
break
print(timeit.timeit('max(mults_no_jit(999, 99, -1))', globals=globals(), number=100))
# 4.2907474 секунды
print(timeit.timeit('max(mults_jit(999, 99, -1))', globals=globals(), number=100))
# 0.1662201 секунд первый запуск, 0.0333973 последующие
Теперь я за «Numba».
На этом ресурсе неоднократно появляются "говнокоды" с кривым форматированием.
Не всё что криво отформатированно, является говнокодом с точки зрения самого кодирования.
Отчасти такие коды - ето копипаст из лаб студентов,
которых заставили скопипастнуть свой код в какой-нибудь отчет, а возиться с вордовской версткой мало кому охота ага).
О том, что формат doc(x) для сорцов мало подходит, мало каких преподов волнует. Им отчет же нужно показать комиссии.
Столкнулась с этим после неоднократных переделок лаб по предметам, связанным с программированием.
// https://github.com/WebKit/WebKit/blob/31b77296cf6d85c40313812d9f65a003cf41f440/Source/WebCore/page/Quirks.cpp#L330
bool Quirks::isGoogleMaps() const
{
auto& url = m_document->topDocument().url();
return topPrivatelyControlledDomain(url.host().toString()).startsWith("google.") && url.path().startsWithIgnoringASCIICase("/maps/");
}
bool Quirks::shouldDispatchSimulatedMouseEvents() const
{
if (RuntimeEnabledFeatures::sharedFeatures().mouseEventsSimulationEnabled())
return true;
if (!needsQuirks())
return false;
auto doShouldDispatchChecks = [this] () -> bool {
auto* loader = m_document->loader();
if (!loader || loader->simulatedMouseEventsDispatchPolicy() != SimulatedMouseEventsDispatchPolicy::Allow)
return false;
if (isAmazon())
return true;
if (isGoogleMaps())
return true;
auto& url = m_document->topDocument().url();
auto host = url.host().convertToASCIILowercase();
if (host == "wix.com" || host.endsWith(".wix.com")) {
// Disable simulated mouse dispatching for template selection.
return !url.path().startsWithIgnoringASCIICase("/website/templates/");
}
if ((host == "desmos.com" || host.endsWith(".desmos.com")) && url.path().startsWithIgnoringASCIICase("/calculator/"))
return true;
if (host == "figma.com" || host.endsWith(".figma.com"))
return true;
if (host == "trello.com" || host.endsWith(".trello.com"))
return true;
if (host == "airtable.com" || host.endsWith(".airtable.com"))
return true;
if (host == "msn.com" || host.endsWith(".msn.com"))
return true;
if (host == "flipkart.com" || host.endsWith(".flipkart.com"))
return true;
if (host == "iqiyi.com" || host.endsWith(".iqiyi.com"))
return true;
if (host == "trailers.apple.com")
return true;
if (host == "soundcloud.com")
return true;
if (host == "naver.com")
return true;
if (host == "nba.com" || host.endsWith(".nba.com"))
return true;
if (host.endsWith(".naver.com")) {
// Disable the quirk for tv.naver.com subdomain to be able to simulate hover on videos.
if (host == "tv.naver.com")
return false;
// Disable the quirk for mail.naver.com subdomain to be able to tap on mail subjects.
if (host == "mail.naver.com")
return false;
// Disable the quirk on the mobile site.
// FIXME: Maybe this quirk should be disabled for "m." subdomains on all sites? These are generally mobile sites that don't need mouse events.
if (host == "m.naver.com")
return false;
return true;
}
return false;
};
if (!m_shouldDispatchSimulatedMouseEventsQuirk)
m_shouldDispatchSimulatedMouseEventsQuirk = doShouldDispatchChecks();
return *m_shouldDispatchSimulatedMouseEventsQuirk;
}
Дааа блядь, давайте в движке браузера захардкодим какие-то говнодомены, что типа вот для них какая-то там блядь симуляция событий мыши работала каким-то таким образом. Охуенно!
MAPTOBCKuu_nemyx Позавчера #
Оффтоп
Где можно найти нормальные, адекватные и свежие мануалы по C++?
MAPTOBCKuu_nemyx Позавчера #
Питушня #40
#10: https://govnokod.ru/27045 https://govnokod.xyz/_27045
#11: https://govnokod.ru/27058 https://govnokod.xyz/_27058
#12: https://govnokod.ru/27182 https://govnokod.xyz/_27182
#13: https://govnokod.ru/27260 https://govnokod.xyz/_27260
#14: https://govnokod.ru/27343 https://govnokod.xyz/_27343
#15: https://govnokod.ru/27353 https://govnokod.xyz/_27353
#16: https://govnokod.ru/27384 https://govnokod.xyz/_27384
#17: https://govnokod.ru/27482 https://govnokod.xyz/_27482
#18: https://govnokod.ru/27514 https://govnokod.xyz/_27514
#19: https://govnokod.ru/27620 https://govnokod.xyz/_27620
#20: https://govnokod.ru/27816 https://govnokod.xyz/_27816
#21: https://govnokod.ru/27956 https://govnokod.xyz/_27956
#22: https://govnokod.ru/28143 https://govnokod.xyz/_28143
#23: https://govnokod.ru/28315 https://govnokod.xyz/_28315
#24: (vanished) https://govnokod.xyz/_28362
#25: (vanished) https://govnokod.xyz/_28463
#26: https://govnokod.ru/28481 https://govnokod.xyz/_28481
#27: https://govnokod.ru/28537 https://govnokod.xyz/_28537
#28: https://govnokod.ru/28619 https://govnokod.xyz/_28619
#29: (vanished) https://govnokod.xyz/_28663
#30: https://govnokod.ru/28673 https://govnokod.xyz/_28673
#31: https://govnokod.ru/28679 https://govnokod.xyz/_28679
#32: https://govnokod.ru/28687 https://govnokod.xyz/_28687
#33: https://govnokod.ru/28694 https://govnokod.xyz/_28694
#34: https://govnokod.ru/28701 https://govnokod.xyz/_28701
#35: https://govnokod.ru/28707 https://govnokod.xyz/_28707
#36: https://govnokod.ru/28714 https://govnokod.xyz/_28714
#37: https://govnokod.ru/28724 https://govnokod.xyz/_28724
#38: https://govnokod.ru/28732 https://govnokod.xyz/_28732
#39: https://govnokod.ru/28839 https://govnokod.xyz/_28839
def properties_file2hash(_property_file, _link_hash=nil)
r_hash = Hash.new
if _property_file && FileTest::exist?(_property_file)
f = File::open(_property_file,'r')
begin
_lines = f.readlines
_lines.each{|_line|
_strip_line = _line.strip
if (_strip_line.length > 0)&&(_strip_line[0,1]!='#')
var_plat = _line.split('::')
if var_plat.length > 1
if (RUBY_PLATFORM.include?(var_plat[0]))
_line = var_plat[1]
var_plat[2..-1].collect{|x| _line=_line+'::'+x} if var_plat.length > 2
else
_line = ''
end
end
var = _line.split('=')
if var.length > 1
_value = var[1].strip
var[2..-1].collect{|x| _value=_value+'='+x} if var.length > 2
if _link_hash
_value = resolve_link(_value, _link_hash)
end
r_hash[var[0].strip]=_value
end
end
}
ensure
f.close unless f.nil?
end
return r_hash
end
Реальный кусок... Весь код проги(не моей)... ТАКОЙ.
@implementation NSString (toint)
- (long long)toInt {
if (self == nil) return 0;
if (self.length == 0) return 0;
return [self longLongValue];
}
@end
В этом коде все прекрасно. Я просто оставлю это здесь. Джава головного мозга.
Новогодний оффтоп #2
░░░░░░░░░░░░░░░░░▐▌░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░▀████▀░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░▄█▀▀█▄░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░▄▄░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░▄████▄░░░░░░░░░░░░░░░
░░░░░░░░░░░▄▄██╬██╬████▄▄░░░░░░░░░░░
░░░░░░░░▀███████╬███╬██████▀░░░░░░░░
░░░░░░░░░░▄▄█╬████╬█████▄▄░░░░░░░░░░
░░░░▄▄▄▄██╬████╬█████╬███╬██▄▄▄▄░░░░
░░░░░░▀▀████╬█████╬█████████▀▀░░░░░░
░░░░░░░░░▄█████╬██████╬███▄░░░░░░░░░
░░▄▄▄▄██████╬█████╬███████╬███▄▄▄▄░░
░░▀▀▀████╬█████╬████╬███╬██████▀▀▀░░
░░░░░░░░████╬████████╬██████░░░░░░░░
░░▄▄▄█████╬██████╬█████╬███╬███▄▄▄░░
▀▀▀████╬█████╬█████╬████╬███╬████▀▀▀
░░░░░░▀▀▀██████████████████▀▀▀░░░░░░
░░░░░░░░░░░░░░░░████░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░████░░░░░░░░░░░░░░░░
#1: https://govnokod.ru/27188 https://govnokod.xyz/_27188
class FinancialEventObserver < ActiveRecord::Observer
observe Payment, Invoice
def before_save(model)
event = nil
if model.class == Payment
if model.new_record?
event = FinancialEvent.new(:event => FinancialEvent::Event::PAYMENT_INVOICE,
:arguments => {:client_name => model.invoice.client.short_name, :invoice_number => model.invoice.invoice_number},
:company_id=>model.invoice.client.company.id)
end
elsif model.class == Invoice
i = Invoice.find_by_id model.id
if model.new_record? or i.status != model.status
if model.status == Invoice::Status::ESTIMATE
event = FinancialEvent.new(:event => FinancialEvent::Event::ESTIMATE_SEND,
:arguments => {:client_name => model.client.short_name, :invoice_number => model.invoice_number},
:company_id=>model.client.company.id)
elsif model.status == Invoice::Status::APPROVED
event = FinancialEvent.new(:event => FinancialEvent::Event::ESTIMATE_APPROVED,
:arguments => {:client_name => model.client.short_name, :invoice_number => model.invoice_number},
:company_id=>model.client.company.id)
elsif model.status == Invoice::Status::REJECTED
event = FinancialEvent.new(:event => FinancialEvent::Event::ESTIMATE_REJECTED,
:arguments => {:client_name => model.client.short_name, :invoice_number => model.invoice_number},
:company_id=>model.client.company.id)
elsif model.status == Invoice::Status::SEND
event = FinancialEvent.new(:event => FinancialEvent::Event::INVOICE_SEND,
:arguments => {:client_name => model.client.short_name, :invoice_number => model.invoice_number},
:company_id=>model.client.company.id)
end
elsif !model.new_record? and i.state != model.state
if model.state == Invoice::State::DELETED
event = FinancialEvent.new(:event => FinancialEvent::Event::INVOICE_DELETED,
:arguments => {:invoice_number => model.invoice_number},
:company_id=>model.client.company.id)
end
end
end
event.eventable = model.requester unless event.blank?
event.save unless event.blank?
end
def before_destroy(model)
if model.class == Payment
event = FinancialEvent.new(:event => FinancialEvent::Event::PAYMENT_DELETED,
:arguments => {:invoice_number => model.invoice.invoice_number},
:company_id=>model.invoice.client.company.id)
event.eventable = model.requester
event.save
end
end
end
о боже, зачем я открыл этот файл?
def has_currency_rate?
val = false
if self.currency.id == self.client.company.currency.id or self.currency_rate.blank?
else
val = true
end
val
end
тяжело же жилось людям...
def get_next_line(max_level, current_level, current_line_items)
next_line_items = []
result_string = ''
if current_level == 1
next_line_items.push(1)
result_string = "1\n"
else
current_line_number = false
current_line_number_count = 0
current_index = 0
current_line_items.each do |line_number|
if current_index == 0
current_line_number = line_number
current_line_number_count = 1
else
if line_number == current_line_number
current_line_number_count = current_line_number_count + 1
else
next_line_items.push(current_line_number_count)
next_line_items.push(current_line_number)
current_line_number_count = 1
current_line_number = line_number
end
end
if current_index >= current_line_items.length - 1
next_line_items.push(current_line_number_count)
next_line_items.push(current_line_number)
end
current_index = current_index + 1
end
result_string = next_line_items.join(' ') + "\n"
end
if current_level < max_level
result_string = result_string + get_next_line(max_level, current_level + 1, next_line_items).to_s
end
# return result
result_string
end
puts 'Input max level:'
level = gets
puts ''
puts get_next_line(level.to_i, 1, [])
реальное тестовое задание кандитата.
задача - вывести несколько членов последовательности
1
11
21
1211
....
import SwiftUI
struct LandmarkDetail: View {
@EnvironmentObject var userData: UserData
var landmark: Landmark
var landmarkIndex: Int {
userData.landmarks.firstIndex(where: { $0.id == landmark.id })!
}
var body: some View {
VStack {
MapView(landmark: landmark)
.frame(height: 300)
CircleImage(image: landmark.image(forSize: 250))
.offset(y: -130)
.padding(.bottom, -130)
VStack(alignment: .leading) {
HStack {
Text(landmark.name)
.font(.title)
Button(action: {
self.userData.landmarks[self.landmarkIndex].isFavorite.toggle()
}) {
if self.userData.landmarks[self.landmarkIndex].isFavorite {
Image(systemName: "star.fill")
.foregroundColor(Color.yellow)
} else {
Image(systemName: "star")
.foregroundColor(Color.gray)
}
}
}
HStack(alignment: .top) {
Text(landmark.park)
.font(caption)
Spacer()
Text(landmark.state)
.font(.caption)
}
}
.padding()
Spacer()
}
.navigationBarTitle(Text(landmark.name), displayMode: .inline)
}
}
https://developer.apple.com/tutorials/swiftui/handling-user-input
Принципиально новый нескучный "декларативный" UI от компании Apple. В наличии:
* магические константы
* спагетти из замыканий
* биндинги, страшные как атомная война
* где-то внутри модная хипстерская реактивная либа
На фоне этого кошмара qml кажется вершиной инженерной мысли
guest6 3 часа назад #